Jump to content

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

Personal Information

  • First Name
    TradersLaboratory.com
  • Last Name
    User
  • City
    London
  • Country
    United Kingdom
  • Gender
    Male

Trading Information

  • Vendor
    No
  • Favorite Markets
    US equities, futures, forex
  • Trading Platform
    IB, Tradestation
  • Broker
    IB and Tradestation
  1. 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
  2. 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"
  3. 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.
  4. 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
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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} ;
  10. 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
  11. 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
  12. 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
  13. 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
  14. 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
  15. 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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.