Traders Laboratory - View Single Post - Some EasyLanguage Help Please
View Single Post
  #2 (permalink)  
Old 10-14-2007, 06:56 PM
thrunner thrunner is online now
thrunner has no status.

 
Join Date: Feb 2007
Posts: 178
Thanks: 60
Thanked 47 Times in 25 Posts
Re: Some EasyLanguage Help Please

I am no EL expert here, but I think you should try the CountIf function:
example based on builit in MACD LE strategy of TS with added CountIf; you may need to play with Value1 and Condition1 test length to get the logic right.
Also search for this function in TS help and TS forum.
inputs: FastLength( 12 ), SlowLength( 26 ), MACDLength( 9 ) ; variables: MyMACD( 0 ), MACDAvg( 0 ), MACDDiff( 0 ) ; MyMACD = MACD( Close, FastLength, SlowLength ) ; MACDAvg = XAverage( MyMACD, MACDLength ) ; MACDDiff = MyMACD - MACDAvg ; Condition1 = MACDDiff crosses below 0; Value1 = CountIF(Condition1, 10); // CountIF returns A numeric value containing the number of true test condition occurrences for the current bar. if Value1>0 and CurrentBar > 2 and MACDDiff crosses over 0 then { CB > 2 check used to avoid spurious cross confirmation at CB = 2 (at CB = 1, MyMACD and MACDAvg will be the same) } Buy ( "MacdLE" ) next bar at market ; { ** Copyright (c) 2005 TradeStation Technologies, Inc. All rights reserved. ** ** TradeStation reserves the right to modify or overwrite this strategy component with each release. ** }


Last edited by thrunner; 10-14-2007 at 07:28 PM. Reason: program logic
Reply With Quote