A short code for slippage correction :
|
c100 = barindex = tradeindex spread = 1.2 If longonmarket and c100 then priceinlong = open + spread / 2 set stop ploss sl + (positionprice - priceinlong) set target pprofit tp - (positionprice - priceinlong) endif If shortonmarket and c100 then priceinshort = open – spread / 2 set stop ploss sl + (priceinshort - positionprice) set target pprofit tp - (priceinshort - positionprice) endif |