///trading system Reversal su STOXX – STILLER
///data1 15 min – data2 1440
input: nBar(5), mystop(2000), myprofit(1000),Mul(0.95),DonchianExitLenght(1){, NumBarreExit(0)};
////definizione del donchian per l’ingresso e per l’uscita
var: triglong(false), trigshort(false),exitlong(false), exitshort(false);
triglong = l < lowest(low of data2, nBar);
trigshort = h > highest(high of data2, nBar);
exitlong = h > highest(High of data2, DonchianExitLenght);
exitshort = l < lowest(Low of data2, DonchianExitLenght);
/////definizione filtro di vola - espansione
var: vola(false);
vola=average(Range of data2, 2)of data2 > Mul *average(Range of data2, 22) of data2;
If vola then begin
if triglong then buy (“EL_STOXX_Stiller”) next bar at low limit;
If trigshort then sellshort (“ES_STOXX_Stiller”) next bar at high limit;
end;
//////////// EXIT sui massimo/minimi
if exitlong then Sell (“Exit_L_STOXX_Stiller”)next bar at high limit;
if exitshort then Buytocover (“Exit_S_STOXX_Stiller”) next bar at low limit;
{
if marketposition > 0 and barssinceentry> NumBarreExit then sell next bar at market;
if marketposition < 0 and barssinceentry> NumBarreExit then buytocover next bar at market;
}
setstoploss(mystop);
setprofittarget(myprofit);