Ronzy2001
Forumer storico
Picchio prova questo, ma fai dei controlli che non ho verificato.....
Dove il plot del trailing diventa verde è quando si attiva......
var:ma,mi,valtrailing,miovt,coloretr,coloretrprec,colorenow,valactive,trailon;
valtrailing=0.8;
valactive=1.6;
//Sezione di ingresso
if t = 900 and c > o then
enterlong(nextbar,atopen);
ma=h;
endif;
if t = 900 and c < o then
entershort(nextbar,atopen);
mi=l;
endif;
//controllo nuovi minimi/massimi
if positiondir = 1 then
if h[1] > ma then
ma=h[1];
endif;
endif;
if positiondir = -1 then
if l[1] < mi then
mi=l[1];
endif;
endif;
if positiondir =1 and h > positionvalue+(positionvalue*valactive/100) and trailon = 0 then
trailon=1;
endif;
if positiondir =-1 and l < positionvalue-(positionvalue*valactive/100) and trailon=0 then
trailon=-1;
endif;
//controllo rottura livello trailing
if c <= ma-(ma*valtrailing/100) and positiondir = 1 and trailon = 1 then
exitlong(bar,atclose);
endif;
if c > mi+(mi*valtrailing/100) and positiondir = -1 and trailon= -1 then
exitshort(bar,atclose);
endif;
if positiondir = 0 then
trailon=0;
endif;
//sezione di uscita
if t=1725 then
exitlong(nextbar,atopen);
exitshort(nextbar,atopen);
endif;
//PLOT TRAILING
if valtrailing <> 0 then
if PositionDir = 1 then
miovt = ma-(ma*valtrailing/100);
if trailon <>0 then
coloreTr = green;
endif;
if trailon = 0 then
coloreTr = red;
endif;
elseif PositionDir = -1 then
miovt = mi+(mi*valtrailing/100);
if trailon <> 0 then
coloreTr = green;
endif;
if trailon = 0 then
coloreTr = red;
endif;
else
coloreTr = white;
endif;
else
miovt = miovt;
coloreTr = fuchsia;
endif;
if coloreTrPrec = white then
colorenow = coloreTrPrec;
else
colorenow = coloreTr;
endif;
plotchart(miovt, 0, colorenow, solid, 2);
coloreTrPrec = coloreTr;

Dove il plot del trailing diventa verde è quando si attiva......
var:ma,mi,valtrailing,miovt,coloretr,coloretrprec,colorenow,valactive,trailon;
valtrailing=0.8;
valactive=1.6;
//Sezione di ingresso
if t = 900 and c > o then
enterlong(nextbar,atopen);
ma=h;
endif;
if t = 900 and c < o then
entershort(nextbar,atopen);
mi=l;
endif;
//controllo nuovi minimi/massimi
if positiondir = 1 then
if h[1] > ma then
ma=h[1];
endif;
endif;
if positiondir = -1 then
if l[1] < mi then
mi=l[1];
endif;
endif;
if positiondir =1 and h > positionvalue+(positionvalue*valactive/100) and trailon = 0 then
trailon=1;
endif;
if positiondir =-1 and l < positionvalue-(positionvalue*valactive/100) and trailon=0 then
trailon=-1;
endif;
//controllo rottura livello trailing
if c <= ma-(ma*valtrailing/100) and positiondir = 1 and trailon = 1 then
exitlong(bar,atclose);
endif;
if c > mi+(mi*valtrailing/100) and positiondir = -1 and trailon= -1 then
exitshort(bar,atclose);
endif;
if positiondir = 0 then
trailon=0;
endif;
//sezione di uscita
if t=1725 then
exitlong(nextbar,atopen);
exitshort(nextbar,atopen);
endif;
//PLOT TRAILING
if valtrailing <> 0 then
if PositionDir = 1 then
miovt = ma-(ma*valtrailing/100);
if trailon <>0 then
coloreTr = green;
endif;
if trailon = 0 then
coloreTr = red;
endif;
elseif PositionDir = -1 then
miovt = mi+(mi*valtrailing/100);
if trailon <> 0 then
coloreTr = green;
endif;
if trailon = 0 then
coloreTr = red;
endif;
else
coloreTr = white;
endif;
else
miovt = miovt;
coloreTr = fuchsia;
endif;
if coloreTrPrec = white then
colorenow = coloreTrPrec;
else
colorenow = coloreTr;
endif;
plotchart(miovt, 0, colorenow, solid, 2);
coloreTrPrec = coloreTr;