For some reason it is sending orders even if I have no market position open in the chart. Not sure why. Please help. May be missing a statement?
Thanks
Code: Select all
Inputs:
Length(10), ExitATRs1(1), ExitATRs2(1.5), ExitATRs3(2), TradeSize(25);
Vars: ATR(0);
ATR = AvgTrueRange (Length);
If Marketposition = 1 then begin
Sell ( "AtrLX1" )TradeSize shares {CurrentShares/3 shares} next bar at AvgEntryPrice + ATR * ExitATRs1 limit;
Sell ( "AtrLX2" )TradeSize shares {CurrentShares/2 shares} next bar at AvgEntryPrice + ATR * ExitATRs2 limit;
Sell ( "AtrLX3" )TradeSize shares next bar at AvgEntryPrice + ATR * ExitATRs3 limit;
end;