lunes, 12 de junio de 2017

//__________________________________________Tecnica 50% due uscite________________________// __

Var: newday(false), mioopen(0), miomin(0), miomax(0), mioclose(0),dvsup,dvmed,dvinf;
Var: wmax,wmin,wmed,DMAX,DMIN,rrange,vp1;
Var: Pr_Ingr(0), Max_Gain(0), Max_Gain_perc(0), actual(0),qtaincaricomax;

qtaInCaricoMax=1000;

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;

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;
rrange=(((highd(1)-lowd(1))/lowd(1))*100);
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);

/////////////////////////////////// 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;
/////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////
installstoploss(inperc,3.00,"SL", STARTNEXTBAR);
plotchartNoZero(getstoploss, 0, red, solid, 2);
DrawText(NEWOGG,0 , D,getstoploss , "sl",getstoploss , red, 25, 1+4,Alright);
///////////////////////////////////////////////////////////////////////////////////////////////////
if positiondir<>1 and c<dvsup and c>highd(1) and GetNumOpEnterLongToday=0  then  Buy(this, nextbar, atopen,1000 );endif;
if positiondir=1 and actual>1  and Abs(positionqta) = Abs(qtaInCaricoMax)  then sell(this, nextbar, atopen,500);endif;
if positiondir=1 and c<dvmed then sell(this, nextbar, atopen,Allqta);endif;

if positiondir<>-1 and c>dvinf and c<lowd(1)  and GetNumOpEntershortToday=0  then Sell(this, nextbar, atopen,1000 ) ;endif;
if positiondir=-1 and actual>1  and Abs(positionqta) = Abs(qtaInCaricoMax)  then buy (this, nextbar, atopen,500);endif;
if positiondir=-1 and c>dvmed then buy (this, nextbar, atopen,Allqta);endif;

if positiondir=1 and Abs(positionqta) <> Abs(qtaInCaricoMax) then ModifyStopLoss(INPERC,1.00);endif;
if positiondir=-1 and Abs(positionqta) <> Abs(qtaInCaricoMax) then ModifyStopLoss(INPERC,1.00);endif;


plotchart(dvsup,0,green,dot,1);
plotchart(dvmed,0,blue,solid,1);
plotchart(dvinf,0,red,dot,1);
vp1 = Createviewport(150);
Plotchart(rrange,vp1,red,solid,1);
DrawText(NEWOGG,vp1, D,rrange, "range % di ieri",rrange , red, 12, 2+3,Alright);

3 comentarios:

  1. lo scrivo anche di qua...
    "Bruno e se invece di chiudere la quota rimanente col c>dvmed, la si chiude col 2%?"

    ResponderEliminar
  2. rino...intendi chiudere metà al 1% di gain e inserire un altra uscita con il rimanente al 2% ? un take profit fisso del 2% ?

    ResponderEliminar
  3. si...metà al 1% ed il rimanente al 2%...sempre con lo stop che si modifica al 1%...come stamane...invece se guardi il 1 giugno dopo il primo take è salita ancora (FCA) e probabilmente avrebbe chiuso tutto al raggiungimento del 2%...

    ResponderEliminar

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