Var:Massimi_Crescenti,Minimi_Decrescenti,Chiusura_Crescente,Chiusura_Decrescente,Range_Crescente,Volume_Crescente,Avg_Crescente,Avg_Decrescente;
Var:Apertura_Crescente,Apertura_Decrescente,Volume_Decrescente,Range_Decrescente,Massimi_Decrescenti,Minimi_Crescenti;
VAR:MC(0),MCD(0),MD(0),MDC(0),CC(0),CD(0),RC(0),AVGC(0),AVGD(0),VC(0),AC(0),AD(0),VD(0),RD(0),zone1,zone1a,zone2,zone3,zone4,zone5;
//InstallStopLoss (INperc,3.5,"SL");
InstallTrailingProfitAndReverse(INperc,0.6,1.0,"Take&Reverse");
//IF T>1000 and T<1100 THEN
Massimi_Crescenti = BarSince(H>H[1])>1; if Massimi_Crescenti then MC=MC+1; else MC=0; endif;
Massimi_Decrescenti= BarSince(H<H[1])>1; if Massimi_crescenti then MCD=MCD+1; else MCD=0; endif;
Minimi_Crescenti = BarSince(L>L[1])>1; if Minimi_Crescenti then MDC=MDC+1; else MDC=0; endif;
Minimi_Decrescenti = BarSince(L<L[1])>1; if Minimi_Decrescenti then MD=MD+1; else MD=0; endif;
Chiusura_Crescente = BarSince(C>C[1])>1; if Chiusura_Crescente then CC=CC+1; else CC=0; endif;
Chiusura_Decrescente =BarSince(C<C[1])>1; if Chiusura_Decrescente then CD=CD+1; else CD=0; endif;
Range_Crescente = BarSince(R>R[1])>1; if Range_Crescente then RC=RC+1; else RC=0; endif;
Range_Decrescente = BarSince(R<R[1])>1; if Range_Decrescente then RD=RD+1; else RD=0; endif;
Avg_Crescente = BarSince(A>A[1])>1; if Avg_Crescente then AVGC=AVGC+1; else AVGC=0; endif;
Avg_Decrescente = BarSince(A<A[1])>1; if Avg_Decrescente then AVGD=AVGD+1; else AVGD=0; endif;
Volume_Crescente = BarSince(V>V[1])>1; if Volume_Crescente then VC=VC+1; else VC=0; endif;
Volume_Decrescente = BarSince(V<V[1])>1; if Volume_Decrescente then VD=VD+1; else VD=0; endif;
Apertura_Crescente = BarSince(O>O[1])>1; if Apertura_Crescente then AC=AC+1; else AC=0; endif;
Apertura_Decrescente =BarSince(O<O[1])>1; if Apertura_Decrescente then AD=AD+1; else AD=0; endif;
{******************************************************************************
Saltiamo la fase dalle 9, alle 10 per adesso
******************************************************************************
//IF T>100 and T<1100 THEN //10-11 mod 9-15
IF Chiusura_Crescente AND Range_Crescente AND Volume_Crescente AND Massimi_Crescenti THEN
enterLong(nextbar,atopen);
ENDIF;
IF Chiusura_Decrescente AND Range_Crescente AND Volume_Crescente AND Minimi_Decrescenti THEN
enterShort(nextbar,atopen);
ENDIF;
//ENDIF;
{******************************************************************************
dalle 11 alle 14
*******************************************************************************}
if HHV(C,14)>chiusura_crescente and AVGC>3 and MCD>3 then entershort(bar,AtClose);endif;
if LLV(O,14)>chiusura_crescente and AVGD>6 then enterlong(bar,AtClose);endif;
if barsince(positiondir=1)>13 and CD>1 then exitlong(bar,AtCLose);endif;
//if barsince(positiondir=-1)>13 and VD>2 then exitshort(bar,AtClose);endif;
IF T>1100 and T<1400 THEN
ENDIF;
{******************************************************************************
dalle 14 alle 17
*******************************************************************************}
IF T>1400 and T<1700 THEN
ENDIF;
{******************************************************************************
Chiusura di tutte le posizioni a fine giornata
*******************************************************************************}
{
IF T>1730 THEN
IF positionlong THEN
exitlong(nextbar,atopen);
ENDIF;
IF positionshort THEN
exitshort(nextbar,atopen);
ENDIF;
ENDIF;
}
zone1=CreateViewport(150,true,true);
PlotChart(MC,zone1,aqua,solid,1);
PlotChart(MCD,zone1,red,solid,1);
Zone1a=CreateViewport(150,true,true);
plotChart(MDC,zone1a,aqua,solid,1);
plotchart(MD,zone1a,red,solid,1);
zone2=CreateViewport(150,true,true);
PlotChart(AC,zone2,aqua,solid,1);
PlotChart(AD,zone2,red,solid,1);
PlotChart(CC,zone2,yellow,solid,1);
PlotChart(CD,zone2,blue,solid,1);
zone3=CreateViewport(150,true,true);
PlotChart(VC,zone3,aqua,solid,1);
PlotChart(VD,zone3,red,solid,1);
zone4=CreateViewport(150,true,true);
PlotChart(RC,zone4,yellow,solid,1);
PlotChart(RD,zone4,blue,solid,1);
zone5=CreateViewport(150,true,true);
PlotChart(AVGC,zone5,aqua,solid,1);
PlotChart(AVGD,zone5,red,solid,1);