lunes, 1 de junio de 2020

questa una delle varie versioni del ts 50% con inserimento di opzioni di money management
( tipo un take fisso del 6%)

Var: newday(false), mioopen(0), miomin(0), miomax(0), mioclose(0),dvsup,dvmed,dvinf,input1,input2;
Var: wmax,wmin,wmed,DMAX,DMIN,rangemassimi,rangeminimi;
Var: fflat,lg,sh,contalg,contash,contaflat;
Var: massimosettimanascorsa,minimosettimanascorsa;


if IsFirstBarDay then input1=H;endif;
if IsFirstBarDay then input2=L;endif;
plotchart(input1, 0 , green, solid, 2);
plotchart(input2, 0 , red, solid, 2);

newday=GetValues(days,1,mioopen,miomin,miomax,mioclose);
dvsup= miomin+(261.8*(miomax-miomin))/100;
dvmed= miomin+(50*(miomax-miomin))/100;
dvinf= miomax-(261.8*(miomax-miomin))/100;
////////////////////////////////////////////////////////////////////////////////////
massimosettimanascorsa=highw(1);
minimosettimanascorsa=loww(1);
///////////////////////////////////////////////////////////////////////////////
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);
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);

/////////////////////////////////////////////////////////////////////////////
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;
/////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////
rangeminimi=(((openm-lowm)/openm)*100);
rangemassimi=(((highm-openm)/openm)*100);
////////////////////////////////////////////////////////////////////////////////////////////////
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, 6, "take");
///////////////////////////////////////////////////////////////////////////////////////////////////
if  c>highd(1)
and GetNumOpEnterLongToday=0
and c>input1
and c>minimosettimanascorsa
and rangemassimi<10
then enterlong( nextbar,atopen);endif;

if positiondir=1 and c<dvmed then exitlong(nextbar,atopen);endif;

if   c<lowd(1)
and GetNumOpEntershortToday=0
and c<input2
and c<massimosettimanascorsa
and rangeminimi<10
then entershort( nextbar,atopen);endif;

if positiondir=-1 and c>dvmed then exitshort(nextbar,atopen);endif;

plotchart(dvmed,0,blue,solid,1);


No hay comentarios:

Publicar un comentario

 oggi scadenze tecniche..le ultime di settembre risolte a 13.60€ vediamo alle 1200