Using Strings in EL for multi-step System

This little strategy uses EasyLanguage’s string manipulation to keep track of a multi-step, mutli-criteria, multi-state trade entry. You don’t buy until the buyString is equal to “BUY”. The sell side is just the opposite. When you program a multi-step entry you also need to build a reset situation. In the case of this system you reset the string to null(“”) when the price dips back down below the 9 day moving average. After resetting the process starts over again.


{Use curly brackets for mult-line
 comments
 
 This system needs three criteria to be met
 before a trade is initiated
 Buy Criteria 1:  C > 9 day movAvg - trend Up
 Buy Criteria 2:  H = HighestHigh 10 days - break Out
 Buy Criteria 3:  C < C[2] - retracement }
 
 vars:buyString(""),sellString("");
 
 
 if marketPosition = 0 then {If flat then reset strings}
 begin
 	buyString = "";
 	sellString = "";
 end;
 
 if c >= average(c,9) then buyString = "B";  //First criteria met
 if c < average(c,9) then buyString = "";
 
 if c > average(c,9) then sellString = "";
 if c <= average(c,9) then sellString = "S"; 
 
 if buyString = "B" then
 begin
 	if h > highest(h,10)[1] then buyString = buyString + "U"; //Second Criteria met
 end;
 
 if buyString = "BU" then
 begin
 	if c < c[2] then buyString = buyString + "Y"; //Third criteria met
 end;
 
 if buyString = "BUY" then buy ("BuyString") next bar at open; //Read BUY
 
 if sellString = "S" then
 begin
 	if l > lowest(l,10)[1] then sellString = sellString + "E";
 end;
 
 if sellString = "SE" then
 begin
 	if c > c[2] then sellString = sellString + "LL";
 end;
 
 if sellSTring = "SELL" then sellShort ("sellString") next bar at open; 
 setStopLoss(1000);

 SetPercentTrailing(1000, 30);  

Please follow and like us:
error

4 thoughts on “Using Strings in EL for multi-step System”

  1. Hello,

    I purchased your Building Winning Trading Strategies with TradeStation book. Page 29 recommends downloading eh companion code for this book, however, no link is provided…at least not on that page.

    John

    1. Hello John,

      Sorry for the delay. Which edition are you referring. If its the second edition go to :www.wiley.com/go/tradingsystems. Plug in your email and password. If this doesn’t work let me know and I will email the ELD directly.

      Best regards,

      George

  2. Dear Sir,

    First of all, thanks for sharing some of your work and thoughts.

    I would like to ask why using this method for entry and not just demand that if condition1=TRUE, condition2=TRUE, etc, then buy/sell.

    Is there any specific advantage or you are just showing another way?

    Kind regards

    Christos

    1. Hello Christos – you are exactly right I am using Strings as an alternative method. Building the string doesn’t require the conditions to be consecutive. You can definitely use different Condition variables. Thanks for the input.

Leave a Reply