formula ts openmese
//______________________________________Tecnica openmese____________________________// aprile 2017 14
Var: fflat,lg,sh,contalg,contash,contaflat; // monitoraggio situazione flat / long / short
Var: Pr_Ingr(0), Max_Gain(0), Max_Gain_perc(0), actual(0); ///_____Actual=Gain
var: meseprec9,meseprec8,cambiatogiorno,contagiornoinessere,prova;
var: prox01,prox02,prox03,prox04,prox05,prox06,percentom,percentomHL,indzona1,indzona2,indzona3;
Var: idlastop,contagain;
//////////////////////___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;
/////////////////////////////////// ACTUAL /////////////////////////////////////////////////////
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;
Actual = ((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;
Actual = ((Pr_ingr-C)*100)/Pr_Ingr;endif;
else Pr_ingr = 0;Max_Gain = 0; Actual = 0;endif;
/////////////////////////////////////////////////////////////////////////////
cambiatogiorno = GetValues(days, 1, prova, prova, prova, prova);
if getmonth<>meseprec9 then contagiornoinessere=0;endif;
if cambiatogiorno then contagiornoinessere=contagiornoinessere+1;endif;
meseprec9=getmonth;
prox01=addperc(openm,3);
prox02=addperc(openm,-3);
{prox03=addperc(openm,10);
prox04=addperc(openm,-10);
prox05=addperc(positionvalue,7);
prox06=addperc(positionvalue,-7); }
PlotChart(openM,0, yellow, solid, 1);
PlotChart(prox01,0, white, dot, 1);
PlotChart(prox02,0, red, dot, 1);
{PlotChart(prox03,0, white, dot, 1);
PlotChart(prox04,0, red, dot, 1);
PlotChart(prox05,0, white, dot, 1);
PlotChart(prox06,0, red, dot, 1); }
DrawText(NEWOGG,0 ,D ,openm , "OpenMese=",openm , red, 13, 1+3,Alright);
DrawText(NEWOGG,0 ,D ,prox01 , "3 % sup.=",prox01 , white, 12, 1+3,Alright);
DrawText(NEWOGG,0 ,D ,prox02 , "3 % inf.=",prox02 , white, 12, 1+3,Alright);
{DrawText(NEWOGG,0 ,D ,prox03 , "7 % TP long=",prox03 , white, 12, 2+3,Alleft);
DrawText(NEWOGG,0 ,D ,prox04 , "7 % TP short=",prox04 , white, 12, 2+3,Alleft);
DrawText(NEWOGG,0 ,D ,prox05 , "7 % TP long reale=",prox05 , white, 12, 2+3,Alleft); }
////////////////////////////////////////////////////////////////////////////////////////////////
percentom=abs(((openm-c)/openm)*100);
percentomHL=abs(((HIGHM-LOWM)/highm)*100);
if c<openm then percentom=-1*percentom;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);
//InstallTakeProfit(INPERC, 7, "TP", STARTNEXTBAR);
if c>prox01 and contagain<4 and contagiornoinessere<19 and contaflat>1 then enterlong(nextbar,atopen);endif;
if positiondir=1 and contagiornoinessere>18 then exitlong(nextbar,atopen);endif;
if positiondir=1 and actual>6 then exitlong(nextbar,atopen);endif;
if c<prox02 and contagain<4 and contagiornoinessere<19 and contaflat>1 then entershort(nextbar,atopen);endif;
if positiondir=-1 and contagiornoinessere>18 then exitshort(nextbar,atopen);endif;
if positiondir=-1 and actual>6 then exitshort(nextbar,atopen);endif;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if getMonth <> meseprec8 then
contagain = 0;
endif;
if IdLastOpClosed > idlastop then
contagain = contagain + LastTradeClosedPerc;
endif;
idlastop = IdLastOpClosed;
meseprec8=getmonth;
///////////////////////////////////////////////////////////////////////////////////////////////////////////
indzona1=Createviewport(200, 0, true);
PlotChart(Percentom,indzona1,white,solid,2);
PlotChart(PercentomHL,indzona1,red,solid,2);
Indzona2=CreateViewport(100, 0, true);
plotchart(contagiornoinessere, indzona2,green, solid, 1 );
DrawText(NEWOGG,indzona2 ,D ,contagiornoinessere , "giorni borsistici=",contagiornoinessere , white, 10, 2+2,Alleft);
indzona3=CreateViewport(200, 0, true);
plotchart(contagain, indzona3,gray, solid, 2 );
//______________________________________Tecnica openmese____________________________// aprile 2017 14
Var: fflat,lg,sh,contalg,contash,contaflat; // monitoraggio situazione flat / long / short
Var: Pr_Ingr(0), Max_Gain(0), Max_Gain_perc(0), actual(0); ///_____Actual=Gain
var: meseprec9,meseprec8,cambiatogiorno,contagiornoinessere,prova;
var: prox01,prox02,prox03,prox04,prox05,prox06,percentom,percentomHL,indzona1,indzona2,indzona3;
Var: idlastop,contagain;
//////////////////////___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;
/////////////////////////////////// ACTUAL /////////////////////////////////////////////////////
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;
Actual = ((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;
Actual = ((Pr_ingr-C)*100)/Pr_Ingr;endif;
else Pr_ingr = 0;Max_Gain = 0; Actual = 0;endif;
/////////////////////////////////////////////////////////////////////////////
cambiatogiorno = GetValues(days, 1, prova, prova, prova, prova);
if getmonth<>meseprec9 then contagiornoinessere=0;endif;
if cambiatogiorno then contagiornoinessere=contagiornoinessere+1;endif;
meseprec9=getmonth;
prox01=addperc(openm,3);
prox02=addperc(openm,-3);
{prox03=addperc(openm,10);
prox04=addperc(openm,-10);
prox05=addperc(positionvalue,7);
prox06=addperc(positionvalue,-7); }
PlotChart(openM,0, yellow, solid, 1);
PlotChart(prox01,0, white, dot, 1);
PlotChart(prox02,0, red, dot, 1);
{PlotChart(prox03,0, white, dot, 1);
PlotChart(prox04,0, red, dot, 1);
PlotChart(prox05,0, white, dot, 1);
PlotChart(prox06,0, red, dot, 1); }
DrawText(NEWOGG,0 ,D ,openm , "OpenMese=",openm , red, 13, 1+3,Alright);
DrawText(NEWOGG,0 ,D ,prox01 , "3 % sup.=",prox01 , white, 12, 1+3,Alright);
DrawText(NEWOGG,0 ,D ,prox02 , "3 % inf.=",prox02 , white, 12, 1+3,Alright);
{DrawText(NEWOGG,0 ,D ,prox03 , "7 % TP long=",prox03 , white, 12, 2+3,Alleft);
DrawText(NEWOGG,0 ,D ,prox04 , "7 % TP short=",prox04 , white, 12, 2+3,Alleft);
DrawText(NEWOGG,0 ,D ,prox05 , "7 % TP long reale=",prox05 , white, 12, 2+3,Alleft); }
////////////////////////////////////////////////////////////////////////////////////////////////
percentom=abs(((openm-c)/openm)*100);
percentomHL=abs(((HIGHM-LOWM)/highm)*100);
if c<openm then percentom=-1*percentom;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);
//InstallTakeProfit(INPERC, 7, "TP", STARTNEXTBAR);
if c>prox01 and contagain<4 and contagiornoinessere<19 and contaflat>1 then enterlong(nextbar,atopen);endif;
if positiondir=1 and contagiornoinessere>18 then exitlong(nextbar,atopen);endif;
if positiondir=1 and actual>6 then exitlong(nextbar,atopen);endif;
if c<prox02 and contagain<4 and contagiornoinessere<19 and contaflat>1 then entershort(nextbar,atopen);endif;
if positiondir=-1 and contagiornoinessere>18 then exitshort(nextbar,atopen);endif;
if positiondir=-1 and actual>6 then exitshort(nextbar,atopen);endif;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if getMonth <> meseprec8 then
contagain = 0;
endif;
if IdLastOpClosed > idlastop then
contagain = contagain + LastTradeClosedPerc;
endif;
idlastop = IdLastOpClosed;
meseprec8=getmonth;
///////////////////////////////////////////////////////////////////////////////////////////////////////////
indzona1=Createviewport(200, 0, true);
PlotChart(Percentom,indzona1,white,solid,2);
PlotChart(PercentomHL,indzona1,red,solid,2);
Indzona2=CreateViewport(100, 0, true);
plotchart(contagiornoinessere, indzona2,green, solid, 1 );
DrawText(NEWOGG,indzona2 ,D ,contagiornoinessere , "giorni borsistici=",contagiornoinessere , white, 10, 2+2,Alleft);
indzona3=CreateViewport(200, 0, true);
plotchart(contagain, indzona3,gray, solid, 2 );
No hay comentarios:
Publicar un comentario