Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.
Charlton
Members-
Content Count
43 -
Joined
-
Last visited
Content Type
Profiles
Forums
Calendar
Articles
Everything posted by Charlton
-
EL - Can It Return All Permutations for a Set of Values?
Charlton replied to BlueHorseshoe's topic in TradeStation
Variables: First(0), Second(0), Third(0), mystring(""); Variables: First_text(""), Second_text(""), third_text(""); For First = 0 To 1 Begin If First = 0 then first_text = "U"; If First = 1 then first_text = "D"; For Second = 0 to 1 Begin If Second = 0 then second_text = "U"; If Second = 1 then second_text = "D"; For Third = 0 to 1 Begin If Third = 0 then third_text = "U"; If Third = 1 then third_text = "D"; Mystring = First_text + second_text + third_text; print(Mystring); End; End; End; If you stick this in an indicator and insert the indicator into some chart it will continually send the 3 letter combinations to the print log. It's not elegant but it is simple Charlton -
You could start with Tradestation's own material Books | School of EasyLanguage | TradeStation University Some is free - some is not. Then there are various links on the web which will start you off: Free Tutorials for EasyLanguage Services for TradeStation EasyLanguage Tutorials Just google "Easylanguage Examples"
-
In fact with Tradestation 9.1 which uses Object Oriented Easy Language, you don't even need to set up 2 charts and hide them. You set up two Priceseriesproviders. Each one can have different timeframes or symbols, which can be manipulated either in charts or on the same row of radarscreen.
-
The function is Text_SetLocation(Text_ID, BarDate, BarTime, Price) The last element in the brackets refers to the vertical point at which you want to set the text. Most people want to set it close to the top or bottom of the bar to which it refers, so they would specify something like: Text_SetLocation(Value1, Date, Time, High + Range*.25); This sets it at one quarter of the range above the high of the bar. However you can set it at a fixed position e.g Text_SetLocation(2, 990114, 1500, 150.00) ; will fix it at price level 150 on every bar. So in summary you can set it at fixed points or based upon any calculation (which may or may not include open, close, high, low, range) Charlton
-
You make sure you have a suitable stop-loss or you reduce position size so it won't hurt too much and then just pull it.......pull it ...........pull it '..........PULL IT ........ DO IT !!!!!! Like any phobia it's all in the mind and you will only get over it by facing it and taking action. Afterwards you will find it wasn't so bad after all. The next time it will be easier still. Charlton
-
Discipline means proper assessment of risk. Risk is something you an evaluate and control. You can control risk because: (1) You can simply choose not to trade in any particular market situatioin (2) You can choose to trade but adjust position size to take into account the likely risk In a lottery for example there is huge risk and hugh rewards, so you adjust risk by betting/trading just £1 (1$). As risk reduces e.g. safe stocks or government bonds your position size can increase. (3) You can reduce risk by proper money management and stops. Stops should not be based on fixed percentages, but based upon what the market tells you. First the market will tell you if your assessment of market direction was correct. If price patterns, indicators, common sense tells you that you called the wrong market direction then get out asap. You can always re-enter the market if it turns and proves you right. Market direction is the only thing that matters. You are either right or wrong. Stops should look at what the market tells you, which is why volatility based stops (e.g. ATR) are the next best thing after readiing market direction. They tell you how far in the wrong direction you are prepared to go based upon how volatile, how irrational, how unpredictable the instrument that you are trading is in that particular market at that particular time. Thie is where the true disicpline lies. It is in reading the market and taking the necessary steps to respond to the market without being arrogant enough to think that you can predict the market. All you can really do is assess risk and probability. Charlton
-
I return to your basic adage "The Adage Goes “it’s Better Not to Trade Than to Lose Money Trading”… " This is the ideal. This is probably the most important point in trading i.e. maintain capital. However to realise this truism requires experience of it. This is why the ideal in your statement has to be broken. You have to feel the pain of losing to stop doing it. You have to feel the pain of not having a stop-loss. Only when you have felt this pain can you move on and correct your errors. This is why I think the title of the thread is a hurdle to be overcome, rather than something you avoid. You cannot avoid it, but you can learn from it. Charlton
-
If you follow Tams advice of drawing out the logic think about: (a) How you might count whether an initiating trade took place during a bar (b) How you reset the count to zero when a new bar forms © How you know if there are currently any open positions in play during this bar Charlton
-
If you watch a 1 min bar you will notice that the closing line will move up and down and show the current price during the creation of the bar. The same happens if you plot an indicator provided that you have formatted the indicator on the general tab as "Update intrabar (tick by tick). So in this case the indicator would be acted upon on every tick and the close at the time would be the tick price. Obviously if you are plotting a 1 min or above bar then these tick prices become "absorbed" into the 1 min bar such that you can only see 4 of them once the bar is complete (O, H, L, C). The only way of recording what they were during the formation of the bar would be to use the print to the easylanguage output bar. The problem is that the date/time that can be included in the print is not sufficiently precise, although you could use the current computer time (COMPUTERDATETIME) to get more precise. Within an indicator easylanguage code you can set up logic that is interval dependent (see bar type below) and you can also force the indicator to act only on certain ticks (see bar status below). Thus you can decide whether to print out price on a tick within a bar or just on completion of the bar. Of course the other possibility is to plot a tick chart, in which case you will get the tick prices, Having said all this I am not sure what the question is. What are you actually trying to achieve ? Charlton Returns a number indicating the type of bar (chart type) that an analysis technique or strategy is applied to. This chart type is set by the user in the Select Interval section of the Settings tab within the Format Symbol dialog for a chart. Remarks The number returned is based on the interval selected. BarType will return: 0 = TickBar 1 = Intraday 2 = Daily 3 = Weekly 4 = Monthly 5 = Point & Figure 6 = (reserved) 7 = (reserved) 8 = Kagi 9 = Kase 10 = Line Break 11 = Momentum 12 = Range 13 = Renko Refer to Chart Type Reserved Word Values for examples of values returned for various chart types. Examples BarType returns 0 when applied to a Tick chart. BarType returns 2 when applied to a Daily chart. Additional Example To assure that a statement is executed only on a daily chart we can write: If BarType = 2 then Sell next bar at market; This reserved word is used to determine whether the current tick is the opening or closing tick of a bar, or whether it is a tick ’inside the bar.’ BarStatus(DataNum) DataNum is a numeric expression representing the data stream that is being evaluated. 1 refers to Data1, 2 to Data2 and so on. DataNum can be between 1 and 50, inclusive. Notes: This reserved word will return one of four possible values: 2 = the closing tick of a bar 1 = a tick within a bar 0 = the opening tick of a bar (relevant only for strategies using Open Next Bar order actions) -1 = an error occurred while executing the reserved word When used with multi-data charts the data series referenced must be applied to the chart. For example, to use BarStatus (2), a second data series must be applied to the chart. Example To perform an operation at the closing tick on the last bar you could write: if LastBarOnChart and BarStatus( 1 ) = 2 then {Your Operation Here} ;
-
You are using a position based stoploss, so if it is set to say $500 and the trade goes against you then it will be stopped when the total position has made $500 loss, regardless of the data compression (time period of bars used). I suspect that what you are trying to do is to set the stoploss to be based upon the price movement expected in the time period (data compression) being used e.g. to base it upon the bar range or the ATR. If that is what you are trying to do then it is probably easier (from a visualisation viewpoint) to use SETSTOPSHARE. This sets the amount per share or contract. The important point is that it does not need to be a fixed amount. You can have an input or variable called, say, SL_AMOUNT. Then you have the code SETSTOPSHARE; SETSTOPLOSS(SL_AMOUNT); This will set the stop loss per share/contract to be the amount the input or variable contains. So you could set it to ATR SL_AMOUNT = AvgTrueRange(10); This would set it to the average true range based on 10 bars for the time interval (data compression) chosen in the plot. In other words the ATR and hence the SL_AMOUNT and hence the stop loss would vary according to the data compression. You could also use an IF statement to set it to specific values based on bar type and interval e;g. IF BARTYPE = 1 AND BARINTERVAL = 10 then SL_AMOUNT = 5; This would set the stop loss amount to 5 for a 10 min intraday bar. BARTYPE values are 0 = TickBar 1 = Intraday 2 = Daily 3 = Weekly 4 = Monthly 5 = Point & Figure 6 = (reserved) 7 = (reserved) 8 = Kagi 9 = Kase 10 = Line Break 11 = Momentum 12 = Range 13 = Renko Personally however I would recommend using something like a volatility based stopped such as ATR which would automatically select stoploss levels at a basis appropirate to the time interval being traded. You don't have to think about it then. Finally another possibility of course is to set a stop loss based on 1 time interval but to use it in a stategy based on another interval. For example you could have a strategy entered onto a 1 min chart, which uses an ATR taken from a 10 min chart, but that's a whole new thread on multiple data feeds and potentially GVs, ADEs and so on, which I don't want to go into at present. Charlton
-
The answer was given in post 7 of this thread. Anway here is the answer with a little more explanation Used to plot values (numeric, boolean or string) in a price chart or in an grid-based analysis window. Plotted values can be standard bar values (such as Close or Volume), inputs, or variable values resulting from a calculation or an expression. PlotN(Expression[,"<PlotName>"[,ForeColor[,Default[,Width]]]]); N is a number between 1 and 99, representing one of the ninety-nine available plots. Expression is the value to be plotted and <PlotName> is the name of the plot. ForeColor is an Easy Language color used for the plot (also referred to as PlotColor), Default (reserved for future use), and Width is a numeric value representing the width of the plot. The parameters <PlotName>, ForeColor, Default, and Width are optional. So in summary to plot the current price would be something like: Plot1(Close, "Curr", Black); Charlton
-
Paul I assume that this is on the basis that if the Dow opened at less than +/- 50 points of the previous close, there is no strong conviction to either continue in the direction it was going on the previous day or to reverse direction. If there is no strong conviction either way then the assumption would be that we have a consolidation day and therefore pair trading would be a viable option. The basic concept then being to trade with reversion to mean vwap. If on the other hand the day exhibits trending characteristics then a directional trade that enters near vwap and exits at the MPD bands would be in order, but based on stocks chosen as exhibiting the appropriate strength or weakness with respect to the market according to the market direction being taken. Charlton
-
In fact you cannot see the whole book. You will find pages are missing in the Google review. However, if you are searching for something specific or browse as you would do in a physical bookshop it can be useful. Not all publishers allow Google or Amazon to show previews inside their books though. Anyway I have found it handy to preview books before I go out spending $40 + on books. Charlton
- 41 replies
-
- ehlers
- moving average
-
(and 3 more)
Tagged with:
-
Besides the advice that Tams gave about writing out your rules in English in advance, I would also suggest that you always include some print statements for use during debugging. An example is shown below: Print(ELDATETOSTRING(Date), " ", Time, " LongTrigger: ", LongTrigger, " LongTriggerValue: ", longtriggervalue, " Fastvalue: ", fastvalue, " Slowvalue: ", slowvalue, " A"); The idea is to print out the current values of important variables on each bar. These print out to the Easylanguage output bar, which can be automatically saved to a file upon exit. Each one shows the date and time of the bar plus the variables required. Note that I have also included a reference "A" at the end, because you might want to insert the same print statement at different points in your logic to see how the variables change as the code is processed. By using a different reference for each print statement you can see exactly which part of the code triggers any changes in values. Normally this will highlight any problems with your logic. Logic/coding problems are IMHO the normal cause of funny results, rather than TS technical issues. It can be useful also to have an input at the start of the statement, something like: Inputs: Print_On("N"); Then you can add a line before the print statement: If Print_On = "Y" then print(message that needs to be printed); This allows you to turn the printing on or off during run-time by changing the input. Charlton
-
Look at the Afta 2003 powerpoint - pass all the mathematical bits and there are suggestiions on how to trade it Home Also look either at his orgiinal book (excerpt here) Rocket science for traders: digital ... - Google Books Or his book"Cybernetic analysis for stocks and futures", where he explains the crossover strategy and gives profitability and drawdown analysis. Basically the strategy is to buy at next bar if the trigger line crosses over the trendline, sell short at next bar if trigger crosses under trend line. He tested the strategy on currency futures because of the tendency to trend. He also describes it in chap 9 of his book Mesa and Trading Market cycles. An interesting mathematical exercise perhaps - has the advantage of using crossovers, which are easy to trade - BUT whether it provides any substantial benefits compare to other tools e.g. MA is for you to decide for yourselves. Charlton
- 41 replies
-
- ehlers
- moving average
-
(and 3 more)
Tagged with:
-
Most people make use of standard tools within the core of the package they are using whether it is Multi-Charts or Tradestation or whatever. You turn to "extras" that might be available for more advanced programming only if there is something vital you must do where the standard tools won't suffice. Who knows ? It depends on what strategies you want to code and how complex they are. Can they be coded using standard tools e.g. indicators or do you need to resort to more complex stuff. If you are making repairs to your house, you don't go and learn how to plumb, how to do electrics, how to lay carpets, how to do carpentry etc etc FIRST unless you want to become an all-round handyman. You normally start with a NEED and then find appropriate tools to fulfil that need. Notice in my examples I was not trying to create globalvariables.dll files. I used the existing one that comes with Tradestation and used STANDARD Easylanguage commands to put values into/take values from globalvariables. I still don't get your aim. Are you trying to provide programming services to others to build trading systems ? If that is the case then I can understand why you want to learn all sorts of programming techniques. Or do you want to be a trader and to try to automate your strategies ? If this is your aim then write out our strategies in English in logical steps and then attempt to code them using just the standard Easylanguage commands. If there is some point at which Easylanguage does not do what you require, then it may be necessary to use GVs. You gave the example of building a floating toolbar to change the MA length. Is that really necessary ? In Easylanguage I would use a standard input variable to change such a value and then don't need any external tools at all. If a pretty floating toolbar is essential then, yes, you will need to do lots of programming outside of Multicharts or TS, because you are then building a platform rather than using one. Charlton
-
It's coming along slowly thanks. I took some time out, but am trying to make up ground again. It was quite some session with Lote_tree by the sound of it ! Thank you for your most generous offer about any problems I may have and the possibility of a meet up. It would be something I would like to do very much and I think sometime post-Christmas would be great so that I can get a little more development work done so that I might be able to also show you what I have done. Fly me to the Moon :rofl: Charlton
-
I would agree with Tams. Before you spend "millions of hours" learning how to write global variables, you should be asking yourself why. There may be a valid reason that you can explain to us here, but to write Tradestation strategies you probably do no need to do that, but simply use them. For example in one window I could set a global variable that I call pos_quantity concatenated with the symbol name in which I hold the position quantity open. The code fragment would be something like: ReturnCode = GVSetNamedInt("Pos_quantity" + CurrSymbol, OpenQty); So if I bought 1000 IBM shares this would create a global variable called Pos_quantityIBM, which would have a value of 1000. Now that I have done this I could pick up the quantity of IBM shares anywhere from any window and use it in a calculation I could for example set a variable called open_qty in code something like: open_qty = GVGetNamedInt("Pos_quantity" + currsymbol,0); This means that you can store symbol specific variable information for use across different windows in Tradestation - very powerful stuff. So I think you should first follow Tam's advice and read up on how to use GVs and you may find that you don't need anything more than that Charlton
-
Although I can see the point of posting P/L because it demonstrates that it is possible to make money from trading, I am sure (from knowing Grey1's material on another site) that readers will find what he has to say extremely interesting and useful. I am sure that he will show very clearly how successful traders manage trades, because trade management and especially risk management forms a major part of his strategy. Many people followed his technical trader's thread over on T2W and found it beneficial. A number of people including myself have incorporated these ideas into automated or semi-automated trading engines. Charlton
-
Silly question - did you leave the // at the beginning of the relevant lines of codes, because that just makes them into comments ? Charlton
-
If I understand your requirement correctly then the code below will enable you to change the lookback period using input parameters. They are set as a default to a lookback period of 1, but you can change them at runtime to any value you wish by using format analysis techniques. Furthermore you could make this a calculated variable. So for example you could include a statement such as if datacompression = 1 then length = 50 else if datacompression = 0 then length = 100 else length = 1; This will change the lookback period according to the data compression chosen at run time, so in this example if the chart is intra-day then it uses a lookback period of 50, for a tick chart 100 and for everything else 1. 0 for tick, 1 for intra-day, 2 for dly, 3 for wkly, 4 for mnthly, 5 for P&&F Charlton {1.0 Inputs and Variables} {1.1. Declaration of Inputs} Inputs: ADXLenght (14), UpColor (cyan), DnColor (magenta), UnChngColor (white), LENGTH(1); {1.2. Declaration of Variables} variables: var0 (0), var1 (0), var2 (0), var3 (0), var4 (0), var5 (0); {2.0. Start Code} {2.1. Call ADX & DMI} Value1 = DirMovement(High, Low, Close, ADXLenght, var0, var1, var2, var3, var4, var5); {2.2. Check Slope and SetPlotColor} if var3 > var3[LENGTH] then SetPlotColor[LENGTH](3, UpColor) else if var3 < var3[LENGTH] then SetPlotColor[LENGTH](3, DnColor) else SetPlotColor[LENGTH](3, UnChngColor); {3.0. Plot Values} Plot1(var0, "DMI+"); Plot2(var1, "DMI-"); Plot3(var3, "ADX");
-
Not to mention T2W where you have posed the same question and where I have left a response Charlton
-
I must also agree. On September 21st I gave a reply, admittedly not on this site but on T2W, to an issue that Chrisleonard had and to this day I don't know if my advice solved his problem. Charlton
-
I think you asked this question on another thread as well and was recommended by Tams to look at Easylanguage, which is used within Tradestation. This allows you to write algos as a retail trader, although there is more "heavy duty" software aimed at insitutions. There are some free downloads of documentation at the following link: https://www.tradestation.com/support/books/default.aspx Look at Easylanguage essentials and Easy language functions and reserved words. Also take a look at Amibroker which has a similar language, Again you can download free manuals at: AmiBroker - AFL Library AmiBroker Formula Language Function Reference That site also has a free download of the platform and this includes the AFL code wizard. This would allow you to practice the concepts behind writing simple algorithms. Charlton
-
I already explained to you in two previous posts on 18th Sept, how to place it a set distance from the bottom of the candle e.g. L - 0.01. You have to experiment with the figure The easiest way is to to have an input called for example dec_places. You set this up with 6 for forex. Save the code as, for example, forex_indicator, You change the input to 2 and save this code as, for example, oil_indicator. When you set up your charts just insert the appropriate one and then you won't need to change your code or the input. If however you want just one indicator and for it to automatically pick up the correct decimal places you will need to incorporate your ID line in an IF statement along the lines of if GETSYMBOLNAME = "EURUSD" then ID = Text_New(D,T,H + 0.000003 , "Stop: " + numtostr(AvgTrueRange(14)*1000000 + 5,0 )); If you don't want to specify each currency pair then you could use: if CATEGORY = 12 then ID = Text_New(D,T,H + 0.000003 , "Stop: " + numtostr(AvgTrueRange(14)*1000000 + 5,0 )); The numeric id of the FOREX category = 12. Charlton