I've tried with this code:
Code: Select all
[IntrabarOrderGeneration=true]
if marketposition = 0 and EntriesToday(date)=0 then buy 1000 contracts next bar at market;
sell next bar at close-averagetruerange(3) stop;
" [IntrabarOrderGeneration=true]" I get the same result. Why?
Second question... why in this code the Stoploss is generated only at the opening of the next candle?
Code: Select all
input: ptnshort(18), mystop(200), myprofit(500), FixedRatio(true),deltas (550),profittopassato(-416.88);
Inputs: ControlloOgniSec(30);
Variables:
IntraBarPersist PrevATSStatus(0), atsStatus(0), m0(0), m1(0);
var: mycontracts(1);
if (LastBarOnChart_s = True) then begin
atsStatus = GetAppInfo(aiStrategyAuto);
if (atsStatus <> PrevATSStatus) and (PrevATSStatus = 1) then begin
Alert(Text("STOPPATOOOOO"));
end;
PrevATSStatus = atsStatus;
RecalcLastBarAfter(ControlloOgniSec);
end;
if time = 0915 and ptnbasesa(1) and PtnBaseSA(ptnshort) then begin
sellshort mycontracts contract next bar at market;
end;
if time = 1720 and marketposition <> 0 then begin
buytocover next bar at market;
end;
setstopcontract;
if mystop > 0 then setstoploss(mystop);
If myprofit > 0 then setprofittarget(myprofit);
thanks a lot.