michelangelo....la sorgente ts 50% con modifica zone di eccesso prezzi
//__________________________________________Tecnica 50%________________________// 25 luglio 2017
Var: miomax5g,miomin5g,miomax11g,miomin11g,miomax22g,miomin22g,rangemensile5g,rangemensile11g,rangemensile22g;
Var: input1,input2,mediacinquanta;
Var: newday(false), mioopen(0), miomin(0), miomax(0), mioclose(0),dvmed;
Var: wmax,wmin,wmed,DMAX,DMIN,vp1;
Var: fflat,lg,sh,contalg,contash,contaflat,rapportosegnalepositivoup,contanuovimassimi,contanuoviminimi,rapportosegnalepositivodown;
Var: Pr_Ingr(0), Max_Gain(0), Max_Gain_perc(0), Gain(0),condizioneA,condizioneB,ivp;
Var: condizionenolong,condizionenoshort;
Var: contalongsi,contalongno,contashortsi,contashortno,vp2,vp3;
Var: formulaprimariaup,formulaprimariadown,codiceup,codiceup1,dayafter,tp1up,tp1down;
Var: formulaprimariaup1,formulaprimariadown1,codiceup2,codiceup3,tp1up1,tp1down1;
Var: indzona1,indzona2,meseprec,meseprec8,meseprec9;
Var: rangeminimi,rangemassimi,percentualemese,indzona3;
Var: meseprec9,contatp1up,contatp1down,indzona4,indzona5,indzona6;
Var: cambiatogiorno,prova,contagiornoinessere,averagecontaup,averagecontadown;
Var: miomax5g,miomin5g,miomax11g,miomin11g,miomax22g,miomin22g;
miomax5g = HHV (H, 187);
miomin5g = LLV (L, 187);
miomax11g = HHV (H, 374);
miomin11g = LLV (L, 374);
miomax22g = HHV (H, 748);
miomin22g = LLV (L, 748);
rangemensile5g=(((miomax5g-miomin5g)/miomin5g)*100);
rangemensile11g=(((miomax11g-miomin11g)/miomin11g)*100);
rangemensile22g=(((miomax22g-miomin22g)/miomin22g)*100);
if rangemensile5g<10 and miomax5g>miomax5g[136] and miomin5g=miomin5g[136] then condizionenoshort=1;else condizionenoshort=0;endif;
if rangemensile5g<10 and miomax5g=miomax5g[136] and miomin5g<miomin5g[136] then condizionenolong=1;else condizionenolong=0;endif;
//////////////////////////////////////////////////////////////////////////////////////////////////
formulaPrimariaup=openm+(openm/100)*20;
formulaPrimariadown=openm-(openm/100)*20;
codiceup=op(formulaprimariaup,openm,sub);
codiceup1=op(codiceup,22,divis);
formulaPrimariaup1=openm+(openm/100)*10;
formulaPrimariadown1=openm-(openm/100)*10;
codiceup2=op(formulaprimariaup1,openm,sub);
codiceup3=op(codiceup2,22,divis);
if getday<>dayafter and IsFirstBarDay then tp1up=tp1up+codiceup1;endif;
if getday<>dayafter and IsFirstBarDay then tp1down=tp1down-codiceup1;endif;
if getmonth<>meseprec then tp1up=openm;endif;
if getmonth<>meseprec then tp1down=openm;endif;
/////////////////////////////////////////////////////////////////////////////////////////////////////
if getday<>dayafter and IsFirstBarDay then tp1up1=tp1up1+codiceup3;endif;
if getday<>dayafter and IsFirstBarDay then tp1down1=tp1down1-codiceup3;endif;
dayafter=getday;
if getmonth<>meseprec then tp1up1=openm;endif;
if getmonth<>meseprec then tp1down1=openm;endif;
meseprec=getmonth;
if c>tp1up1 then contatp1up=contatp1up+1;endif;
if c<tp1down1 then contatp1down=contatp1down+1;endif;
if getmonth<>meseprec8 then contatp1up=0;endif;
if getmonth<>meseprec8 then contatp1down=0;endif;
meseprec8=getmonth;
PlotChart(tp1up,0,blue,solid,2);
PlotChart(tp1down,0,red,solid,2);
PlotChart(openm,0,gray,solid,2);
//PlotChart(c,indzona1,black,solid,2);
PlotChart(tp1up1,0,blue,solid,1);
PlotChart(tp1down1,0,red,solid,1);
DrawText(NEWOGG,0 , D,tp1up , "+20% mese",tp1up , white, 10, 1+4,Alleft);
DrawText(NEWOGG,0 , D,tp1up1 , "+10% mese",tp1up1 , red, 10, 1+4,Alleft);
DrawText(NEWOGG,0 , D,tp1down , "-20% mese",tp1down , yellow, 10, 1+4,Alleft);
DrawText(NEWOGG,0, D,tp1down1 , "-10% mese",tp1down1 , green, 10, 1+4,Alleft);
DrawText(NEWOGG,0, D,openm , "open mese",openm , green, 12, 1+4,Alleft);
/////////////////////////////////////////////////////////////////////////////////////////////////////
if IsFirstBarDay then input1=H;endif;
if IsFirstBarDay then input2=L;endif;
plotchart(input1, ivp, green, solid, 2);
plotchart(input2, ivp, red, solid, 2);
newday=GetValues(days,1,mioopen,miomin,miomax,mioclose);
dvmed= miomin+(50*(miomax-miomin))/100;
if isfirstbarday then
WMAX=H;
WMIN=L;
else
WMAX=iif(H>=WMAX[1],H,WMAX[1]);
WMIN=iif(L<=WMIN[1],L,WMIN[1]);
WMED=wmax-(wmax-wmin)*0.5;
endif;
PlotChart(WMED,0, gray, dot, 1);
Plotchart(dvmed,0,blue,solid,1);
DrawText(NEWOGG,0 , D,wmed , "50% intraday",wmed , red, 12, 2+2,Alright);
DrawText(NEWOGG,0 , D,dvmed , "50% ieri",dvmed , white, 14, 3+2,Alleft);
mediacinquanta=(dvmed+wmed)/2;
//////////////////////___CONTA_Situazione___///////////////////////////////////////////////
if positiondir=0 then fflat=1;endif; if positiondir<>0 then fflat=0;contaflat=0;endif; if fflat=1 and fflat[1]=1 then contaflat=(contaflat[1]+1);endif;
if positiondir=1 then lg=1;endif; if positiondir<>1 then lg=0;contalg=0;endif; if lg=1 and lg[1]=1 then contalg=(contalg[1]+1);endif;
if positiondir=-1 then sh=1;endif; if positiondir<>-1 then sh=0;contash=0;endif; if sh=1 and sh[1]=1 then contash=(contash[1]+1);endif;
if positiondir=1 and wmax>wmax[1] then contanuovimassimi=contanuovimassimi+1;endif;
if positiondir=1 and wmin<wmin[1] then contanuoviminimi=contanuoviminimi+1;endif;
if positiondir=-1 and wmin<wmin[1] then contanuoviminimi=contanuoviminimi+1;endif;
if positiondir=-1 and wmax>wmax[1] then contanuovimassimi=contanuovimassimi+1;endif;
if isfirstbarday and positiondir=1 then contanuovimassimi=contanuovimassimi+1;endif;
if isfirstbarday and positiondir=1 then contanuoviminimi=contanuoviminimi+1;endif;
if isfirstbarday and positiondir=-1 then contanuovimassimi=contanuovimassimi+1;endif;
if isfirstbarday and positiondir=-1 then contanuoviminimi=contanuoviminimi+1;endif;
if positiondir=0 then contanuovimassimi=0;endif;
if positiondir=0 then contanuoviminimi=0;endif;
rapportosegnalepositivoup=op(contanuovimassimi,contanuoviminimi,divis);
rapportosegnalepositivodown=op(contanuoviminimi,contanuovimassimi,divis);
//////////////////////////////////////////////////////////////////////////////////////////////
if getmonth<>meseprec9 then contagiornoinessere=0;endif;
meseprec9=getmonth;
cambiatogiorno = GetValues(days, 1, prova, prova, prova, prova);
if cambiatogiorno then contagiornoinessere=contagiornoinessere+1;endif;
/////////////////////////////////// Gain /////////////////////////////////////////////////////
if Positionvalue<>0 then
Pr_Ingr = positionValue;
if Positiondir=1 then
if (C>Max_Gain) or (Max_Gain=0) then
Max_Gain = C;
Max_Gain_perc = ((Max_Gain-Pr_ingr)*100)/Pr_Ingr;
endif;
Gain = ((C-Pr_ingr)*100)/Pr_Ingr;
else
if (C<Max_Gain) or (Max_Gain=0) then
Max_Gain = C;
Max_Gain_perc = ((Pr_ingr-Max_Gain)*100)/Pr_Ingr;
endif;
Gain = ((Pr_ingr-C)*100)/Pr_Ingr;
endif;
else
Pr_ingr = 0;
Max_Gain = 0;
Gain = 0;
endif;
/////////////////////////////////////////////////////////////////////////////
if (LastTradeClosedPerc > 3.00) and contaflat<90 and lastopclosed=1 then condizioneA=1;else condizioneA=0;endif;
if (LastTradeClosedPerc > 3.00) and contaflat<90 and lastopclosed=3 then condizioneB=1;else condizioneB=0;endif;
////////////////////////////////////////////////////////////////////////////////////////////////
if positiondir=1 and gain>0 then contalongsi=contalongsi+1;endif;
if positiondir=1 and gain<0 then contalongno=contalongno+1;endif;
if positiondir=-1 and gain>0 then contashortsi=contashortsi+1;endif;
if positiondir=-1 and gain<0 then contashortno=contashortno+1;endif;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
installstoploss(inperc,3.00,"SL", STARTNEXTBAR);
plotchartNoZero(getstoploss, 0, red, solid, 2);
DrawText(NEWOGG,0 , D,getstoploss , "sl",getstoploss , red, 25, 1+4,Alright);
//////////////////////////////////////////____________LONG___________________/////////////////////////////////////////////////////////
if c>highd(1)
and GetNumOpEnterLongToday=0 //and c>openm
and c>input1 //migliora un 100% a 14 anni
and condizioneB=0 // migliora un 25% a 14 anni
then enterlong( nextbar,atopen);endif;
///////////////////// Exit Long ///////////////////////////////////////////////////////////////////////////////////////////
if positiondir=1 and gain>1 and c>tp1up and contagiornoinessere>3 then exitlong(nextbar,atopen,STOP, 0,"Exit Long 5");endif;
if positiondir=1 and contalg>20 and gain<1.00 and c<wmed then exitlong(nextbar,atopen);endif;
if positiondir=1 and c<dvmed then exitlong(nextbar,atopen);endif;
if positiondir=1 and contalg>34 and rapportosegnalepositivoup<8 then exitlong(nextbar,atopen);endif; // migliora un 80% a 14 anni...meno tempo a mercato
if positiondir=1 and gain>2 and rangemensile22g<12 then exitlong(nextbar,atopen);endif;// non da fastidio
//////////////////////////////////////////____________SHORT___________________/////////////////////////////////////////////////////////
if c<lowd(1)
and GetNumOpEntershortToday=0 //and c<openm
and c<input2 // migliora un 100% a 14 anni
and condizioneA=0 // migliora un 25% a 14 anni
then entershort( nextbar,atopen);endif;
//////////////////// Exit Short ////////////////////////////////////////////////////////////////////////////////////////////
if positiondir=-1 and gain>1.0 and c<tp1down and contagiornoinessere>3 then exitshort(nextbar,atopen);endif;
if positiondir=-1 and contash>20 and gain<1.00 and c>wmed then exitshort(nextbar,atopen);endif;
if positiondir=-1 and c>dvmed then exitshort(nextbar,atopen);endif;
if positiondir=-1 and contash>34 and rapportosegnalepositivodown<8 then exitshort(nextbar,atopen);endif; // migliora un 80% a 14 anni...meno tempo a mercato
if positiondir=-1 and gain>2 and rangemensile22g<12 then exitshort(nextbar,atopen);endif;//non da fastidio
vp1 = Createviewport(150);
Plotchart(Max_Gain_perc,vp1,red,solid,2);
Plotchart(Gain,vp1,green,solid,2);
vp2=Createviewport(200);
PlotChart(contagiornoinessere,vp2,green,solid,2);