Anyone can help??
vars: atr(0),longLiqPt(0),shortLiqPt(999999),protLongStop(0),protShortStop(0),lowestClose4(0),highestClose4(0),bed(0),sed(0),stb(0),sts(0),canTrade(0);
atr = avgtruerange(24);
lowestClose4 = lowest(close,4);
highestClose4 = highest(close,4);
canTrade = 0;
if(highestClose4 - lowestClose4 < atr) then canTrade = 1;
stb = open of tomorrow + .5*truerange;
sts = open of tomorrow - .5*truerange;
If(canTrade = 1 and entriesttoday(date) = 0) then
begin
buy("pattbuy") tomorrow at stb stop;
sell("pattsell") tomorrow at sts stop;
end;
if(canTrade = 0) then
begin
exitlong("longliq") at sts stop;
exitshort("shrtliq") at stb stop;
end;
Many thanks!!
vars: atr(0),longLiqPt(0),shortLiqPt(999999),protLongStop(0),protShortStop(0),lowestClose4(0),highestClose4(0),bed(0),sed(0),stb(0),sts(0),canTrade(0);
atr = avgtruerange(24);
lowestClose4 = lowest(close,4);
highestClose4 = highest(close,4);
canTrade = 0;
if(highestClose4 - lowestClose4 < atr) then canTrade = 1;
stb = open of tomorrow + .5*truerange;
sts = open of tomorrow - .5*truerange;
If(canTrade = 1 and entriesttoday(date) = 0) then
begin
buy("pattbuy") tomorrow at stb stop;
sell("pattsell") tomorrow at sts stop;
end;
if(canTrade = 0) then
begin
exitlong("longliq") at sts stop;
exitshort("shrtliq") at stb stop;
end;
Many thanks!!