Code Interpretation

Discussion in 'Automated Trading' started by toby, Oct 17, 2005.

  1. toby

    toby

    Hello All

    I have been able to get a system code for Tradestation in ELD format but cannot seem to understand it.

    If anyone could assist in telling it in a simple statement, I would be very grateful.

    {***************************}
    {Program designed and coded by George Pruitt}

    vars: daysInTrade(0), lookBack(30), midLevel(0), longLiqPt(0), shortLiqPt(0);

    if(marketPosition=1) then
    begin
    midLevel = entryPrice(0) - (highest(high,30) - lowest(low,30))/2.0;
    end;
    if(marketPosition=-1) then
    begin
    midLevel = entryPrice(0) + (highest(high,30) - lowest(low,30))/2.0;
    end;

    if(marketPosition <> 0 and barsSinceEntry(0) > 0 and (Mod(barsSinceEntry(0),5)=0)) then
    begin
    lookBack = lookBack - 2;
    lookBack = maxlist(lookBack,6);
    end;

    longLiqPt = maxlist(lowest(low,lookBack),midLevel);
    shortLiqPt = minlist(highest(high,lookBack),midLevel);

    if(barsSinceEntry(0) = 0 and marketPosition <> 0) then
    begin
    longLiqPt = midLevel;
    shortLiqPt = midLevel;
    end;

    if(marketPosition = 1) then exitlong("long exit") at longLiqPt stop;
    if(marketPosition = -1) then exitshort("short exit") at shortLiqPt stop;

    buy("donchian buy") tomorrow at highest(high,30) stop;
    sell("donchian sell") tomorrow at lowest(low,30) stop;

    if(marketPosition = 0) then lookBack = 30;
    {****************************}

    Many thanks!!
     
  2. tomhaden

    tomhaden

    Its a donchian channel breakout system.
     
  3. It takes more than 15 lines to translate it into simple
    english, which specific parts you don't understand?
     
  4. toby

    toby

    if(marketPosition <> 0 and barsSinceEntry(0) > 0 and (Mod(barsSinceEntry(0),5)=0)) then
    begin
    lookBack = lookBack - 2;
    lookBack = maxlist(lookBack,6);
    end;

    longLiqPt = maxlist(lowest(low,lookBack),midLevel);
    shortLiqPt = minlist(highest(high,lookBack),midLevel);

    Thanks Nana Trader!
     
  5.