//TS RANGE SOLOSPREAD 5 minuti
var:miavar(0),val1,val2,r(0),RR,mioatr1,RR1,RR2,zona1,RR3,RR4,RR6,zona2,RR5,RR7;
mioatr1 = 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 > mioatr1*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 > mioatr1*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");
//****************************************************************************************
zona1=CreateViewport(300,true,true);
zona2 = CreateViewport(300,true,true);
plotchart(RR7,zona1,red,solid,1);
plotchart(RR6,zona2,blue,solid,1);
//plotchart(RR7,zona2,red,solid,1);