viernes, 27 de abril de 2018

codice fuente FiltroTendenza

//__________________________Filtrotendenza________________________//

Var: rangeminimi,rangemassimi,percentualemese;
Var: input1,input2;
Var: newday(false), mioopen(0), miomin(0), miomax(0), mioclose(0),metaieri;
Var: wmax,wmin,metaoggi,DMAX,DMIN;
Var: cambiatogiorno,prova,contagiornoinessere;
Var: vp1;
Var: meseprec,meseprec8,meseprec9;
Var: condizionelong,condizioneshort,contalong,contashort,numerogiornilong,numerogiornishort,contalungo,contacorto,entratalong,entratashort;
Var: entratalongprec,entratashortprec,entratalongprec1,entratashortprec1,entratalongprec2,entratashortprec2;
Var: primadiff,secondiff,terzadiff,totaldiff,totaldiff1;

///////////////////////////////////////////////////////////////////////////////////////////////////
rangeminimi=(((openm-lowm)/openm)*100);
rangemassimi=(((highm-openm)/openm)*100);
percentualemese=rangeminimi+rangemassimi;
/////////////////////////////////////////////////////////////////////////////////////////////////////
if IsFirstBarDay then input1=H;endif;
if IsFirstBarDay then input2=L;endif;
/////////////////////////////////////////////////////////////////////////////////////////////////////
newday=GetValues(days,1,mioopen,miomin,miomax,mioclose);
metaieri= 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]);
   metaoggi=wmax-(wmax-wmin)*0.5;
endif;
//////////////////////////////////////////////////////////////////////////////////////////////
if getmonth<>meseprec9 then contagiornoinessere=0;endif;
meseprec9=getmonth;
cambiatogiorno = GetValues(days, 1, prova, prova, prova, prova);
if cambiatogiorno then contagiornoinessere=contagiornoinessere+1;endif;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if c>highd(1)  and c>input1 then condizionelong=1;endif;
if  c<lowd(1)  and c<input2 then condizionelong=0;contalong=0;endif;
if c<lowd(1)   and c<input2 then condizioneshort=1;endif;
if c>highd(1)  and c>input1 then condizioneshort=0;contashort=0;endif;
if condizionelong=1 then contalong=contalong+1;endif;
numerogiornilong=op(contalong,34,divis);
if condizioneshort=1 then contashort=contashort+1;endif;
numerogiornishort=op(contashort,34,divis);
////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                              //
if condizionelong=1   then entratalong=o;endif;                                               //
if condizioneshort=1  then entratashort=o;endif;                                              //
if Condizionelong=1 and contalungo>1 then entratalong=entratalong[1];endif;                   //
if CondizioneShort=1 and contacorto>1 then entratashort=entratashort[1];endif;                //  tenuta in memoria ultime 2 entrate ( short e long )
If Condizionelong=1 and contalungo=1 then DrawVline (NEWOGG, 0, getdate, green, 1, 0);endif;  //
If Condizioneshort=1 and contacorto=1 then DrawVline (NEWOGG, 0, getdate, red, 1, 0);endif;   //
                                                                                              //
////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
if condizionelong=1 then contalungo=contalungo+1;endif;                                      //
if condizioneshort=1 then contacorto=contacorto+1;endif;                                     //
if condizionelong=1 then contacorto=0;endif;                                                 //
if condizioneshort=1 then contalungo=0;endif;                                                //
plotchart(entratalong, 0 , green, solid, 1);                                               //
plotchart(entratashort, 0 , red, solid, 1);                                                //
DrawText(NEWOGG,0 , D,entratalong , "last price lg",entratalong, green, 12, 1+4,Alleft);     //
DrawText(NEWOGG,0 , D,entratashort , "last price sh",entratashort , red, 12, 1+4,Alleft);    //
/////////////////////////////////////////////////////////////////////////////////////////////////
if entratalong<>entratalong[1] then entratalongprec=entratalong[2];endif;
if entratashort<>entratashort[1] then entratashortprec=entratashort[2];endif;
if entratalongprec<>entratalongprec[1] then entratalongprec1=entratalongprec[2];endif;
if entratashortprec<>entratashortprec[1] then entratashortprec1=entratashortprec[2];endif;
if entratalongprec1<>entratalongprec1[1] then entratalongprec2=entratalongprec1[2];endif;
if entratashortprec1<>entratashortprec1[1] then entratashortprec2=entratashortprec1[2];endif;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
primadiff=abs(entratashort-entratalong);
secondiff=abs(entratashort-c);
totaldiff=abs(((primadiff+secondiff)/entratalong)*100);
terzadiff=abs(c-entratalong);
totaldiff1=abs(((primadiff+terzadiff)/entratashort)*100);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
vp1 = Createviewport(450);
Plotchart(totaldiff,VP1,GREEN,solid,2);

3 comentarios:

  1. condizioni di entrata e uscita son le stesse dell'evoluzione ?
    //////////////////////////////////////////____________LONG___________________/////////////////////////////////////////////////////////
    if c>highd(1) //close sopra massimi di ieri
    and GetNumOpEnterLongToday=0 // solo un long al giorno
    and c>input1 //close sopra massimi prima candela a 15 minuti
    and condizioneB=0 // non entra long per 90 candele se ultimo gain short maggiore del 3%
    then enterlong( nextbar,atopen,STOP, 0,"Enter Lg 1");endif;
    ///////////////////// Exit Long ///////////////////////////////////////////////////////////////////////////////////////////
    if positiondir=1 and c20 and gain<1.00 and c1 and c>tp1up and contagiornoinessere>3 and condstay=0 then exitlong(nextbar,atopen,STOP, 0,"Exit Lg 3");endif;

    ma soprattutto

    if positiondir=1 and max_gain_perc>2 then ModifyStopLoss(INPERC,-0.50);endif;
    if positiondir=1 and max_gain_perc>3 then ModifyStopLoss(INPERC,-1.00);endif;
    if positiondir=1 and max_gain_perc>4 then ModifyStopLoss(INPERC,-2.0);endif;
    if positiondir=1 and max_gain_perc>5 then ModifyStopLoss(INPERC,-3.0);endif;
    if positiondir=1 and max_gain_perc>6 then ModifyStopLoss(INPERC,-4.00);endif;
    if positiondir=1 and max_gain_perc>7 then ModifyStopLoss(INPERC,-5.0);endif;
    if positiondir=1 and max_gain_perc>8 then ModifyStopLoss(INPERC,-6.0);endif;

    ResponderEliminar
  2. scusa, le uscite

    if positiondir=1 and c20 and gain<1.00 and c1 and c>tp1up and contagiornoinessere>3 and condstay=0 then exitlong(nextbar,atopen,STOP, 0,"Exit Lg 3");endif;

    ResponderEliminar
  3. è uno delle diverse modifiche del ts 50% base con mm..niente di particolare..gli input di entrata sono i soliti..gli exit anche ..era solo per mostrare come funziona il filtro della tendenza

    ResponderEliminar

 sirtuazione grafica su stellantis da metà  agosto 2026 in fase di rallentamento la discesa un segnale positivo sarebbe lo stazionamento del...