Code Interpretation

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!!
 
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!
 
Quote from toby:

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


if there is a postion in the market (either short or long)
and number of bars for current entry is bigger than 0
(1 ,2, 3 ,....or more) and mod is equal 0 {mod is a function
in EL that has 2 parameters "num" and "divider" so
function is like this example mod(17, 5) is equal 2.
because if you divid 17/5 means 17=(3*5)+2}

Now if all above condition are true (available) then
following caclulation begins:
Lookback as been reassigned with it's previous,
where lookback is 30 as input
lookback=30-2
lookback=maxlist(28,6);
because maximumlsit function pick the greater number
within it's parameter so lookback=28

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

these are not more than bunch of numeric calculation
where lowest and highest function each returns(gives)
a number, as well midlevel numeric variable returns a
numer and maxlist picks the largest number between
lowest & midlevel and highest & midlevel, then assign
each to longliqpt and shortliqpt as point value for stop
exits
 
Back
Top