//Intraday break-out system
/*This system:
1) buys as the prices reach the high of the previus day,
at previus day high or if the open is in gap at todays open;
2) sells as the prices reach the low of the previus day,
or if the open is in gap down at the open;
*/
/* Modificato da antonio secondo il principio traders powerkit*/
SetOption("initialequity",5000000);
SetTradeDelays(0,0,0,0);
Buy=H>Ref(H,-1)+0.8*ATR(5);
Sell=L<Ref(L,-1)-0.8*ATR(5);
Short=Sell;
Cover=Buy;
//Short=L<Ref(L,-1);
//Cover=H>Ref(H,-1);
//BuyPrice=Ref(H,-1);
//SellPrice=Ref(L,-1);
//ShortPrice=Ref(L,-1);
//CoverPrice=Ref(H,-1);
BuyPrice=IIf(O>Ref(H,-1),O,Ref(H,-1));
SellPrice=IIf(O<Ref(L,-1),O,Ref(L,-1));
ShortPrice=SellPrice;
CoverPrice=BuyPrice;
/*PositionSize=MarginDeposit=1;/*Points only test is equivalent to trading just one contract.
This can be easily accomplished using Futures mode of the backtester AND adding the following one line to your formula:
//PositionSize = MarginDeposit = 1;*/
PositionSize=-0.0005*(C/ATR(5));