//TS RANGE SOLOSPREAD 5 minuti
var:miavar(0),val1,val2,r(0),RR,mioatr1,RR1,RR2,zona1,RR3,RR4,RR6,zona2,RR5,RR7,mioatr3,DDD;
Var:miavar(0),AA,BB,CC,zona1,DD,EE,FF,CB,Vol1,mioval, WW,ENT,mioatr1,mioatr2,ent1;
mioatr1 = rsi(C,14,s);
mioatr2 = rsi(C,50,s);
ENT = C> Mov(C,5,E) AND C>Mov(C,300,E) AND Crossover(mioatr1,mioatr2) AND Mov(V,30,E)> Mov(V,240,E) AND Mov(C,30,E)> Mov(C,240,E) AND V> Mov(V,5,E);
ENT1 = C<Mov(C,5,E) AND C<Mov(C,300,E) AND Crossover(mioatr2,mioatr1) AND Mov(V,30,E)< Mov(V,240,E) AND Mov(C,30,E)< Mov(C,240,E) AND V< Mov(V,5,E);
AA = HHV(H,5)+30;
BB = LLV(L,5)+30;
CC = HHV(H,20);
DD = LLV(L,20);
EE =CC-BB;
FF= AA-DD;
if ENT = true then
DDD = 100;
else
DDD= 10;
endif;
zona1=CreateViewport(300,true,true);
plotChart(EE,zona1,blue,solid,1);
plotChart(FF,zona1,red,solid,1);
//************************************************************************
if ent = true then enterlong(Nextbar,atopen);endif;
if ENT1 = true then entershort(nextbar,atopen);endif;
mioatr3 = atr(C,21);
RR = (r[1]+r[2]);
RR1 =(H-l)*V[1]/V*r*3000;
RR3 = LLV(L,10);
RR4 = HHV(H,10);
RR5 =HHV(C,10);
RR7 =LLV(O,10);
//*****************************************************************************
if RR1[1] > 10 and C > C[1] and C[1]< C[2] then
RR2 = rr1+50;
else
RR2 = 0;
endif;
if RR1[1] > 10 and C < C[1] and C[1] > C[2] then
RR2 = RR1-50;
else
RR2 = 0;
endif;
if (H-C) > (C-L)and B = true and R > mioatr3*2 then //MOTORE DEL TS
RR6 = 100;
else
RR6 = 0;
endif;
if (H-C) <(C-L)and W = TRUE and B[1] = true and R > mioatr3*1.5 then
RR7 = 100;
else
RR7 = 0;
endif;
//****************************************************************************************
if RR6[2] > 50 and C > C[1] and L > L[1] or H > H[1] then entershort(Nextbar,atopen);endif;
if RR6[2] > 70 and C < C[1] and H < H[1] or L < L[1] then enterlong (Nextbar,atopen);endif;
if RR7[1] > 70 and C > c[1] and RR2[1] > 70 and C > c[2] then entershort(NextBar,AtOpen); endif;
if RR7[1] > 70 and C < c[1] and RR2[1] > 70 and C < c[2] then enterlong(NextBar,AtOpen); endif;
installstoploss(INPERC,1.5,"STOP");
//****************************************************************************************