COSTRUZIONE INDICATORE PER ANALISI CICLICA CON VISUAL TRADER (2 lettori)

solospread

Forumer storico
Dopo essersi riposato tutta la giornata ADX entra short sui minimi. Io mi sono chiesto se aveva bevuto. Ora se il mercato sprofonda lo riprendo in mano altrimenti lo cestino.

ScreenHunter_02 Jan. 22 16.27.gif
 

solospread

Forumer storico
Ecco come si è comportato introducendo la modifica sopra esposta. Ora si tratta di togliere quelle false entrate attorno a S1 magari mettendo l'istruzione di due chiusure sotto il livello al posto di una sola e si toglie il difetto.

ScreenHunter_03 Jan. 22 16.48.gif
 

solospread

Forumer storico
Ho fatto una modifica per farlo entrare di piu'. Entra Short ora a 16960. Un'entrata strana come quella di ieri, vediamo se si riconferma.

ScreenHunter_07 Jan. 23 11.41.gif


ScreenHunter_05 Jan. 23 11.38.gif


ScreenHunter_04 Jan. 23 11.38.gif
 

solospread

Forumer storico
Per Tetoblu. te lo metto qui perchè in MP non ci stà
Codice:
Var: miavar(0), Miacondizione1,Miacondizione2,miacondizione3,Miacondizione4,Miacondizione5,Miacondizione6;
Var: Miacondizione7,Miacondizione8, Miacondizione9,Miacondizione10, Miacondizione11,Miacondizione12, Miacondizione13,Miacondizione14;
Var: Miacondizione15,Miacondizione16,Miacondizione17,miacondizione18,STOP;
Var: Semaforo0910(0), semaforo1010(0), semaforo1110(0), Semaforo1210(0), semaforo1310(0), semaforo1410(0),Semaforo1510(0), semaforo1610(0), semaforo1710(0);
Var: ultimaposizione(0), indzona1(0), valoreritracciamento(0), valore(0), ultimoprezzo(0), barra(0), ope1(0), min1(0), max1(0), clo1(0);
Var: miavel, mio10, vettorestop(0), pippo(0),semaforovettorestop,rientrolong,rientroshort,MioHight;

MioHight = HHV(REF(H,3),1);
//****************************************************************************************************************
 InstalltakeProfit(INPERC, 0.75, "take");
 //installtrailingprofit (inperc,0.8,0.1,trailing);
if T = 0910 then Miacondizione1 = C+20; Miacondizione2 = C-20; endif;
if T = 1010 then Miacondizione3 = C+20; Miacondizione4 = C-20; endif;
if T = 1110 then Miacondizione5 = C+20; Miacondizione6 = C-20; endif;
if T = 1210 then Miacondizione7 = C+20; Miacondizione8 = C-20; endif;
if T = 1310 then Miacondizione9 = C+20; Miacondizione10= C-20; endif;
if T = 1410 then Miacondizione11= C+20; Miacondizione12= C-20; endif;
if T = 1510 then Miacondizione13 =C+20; Miacondizione14= C-20; endif;
if T = 1610 then Miacondizione15 =C+20; Miacondizione16= C-20; endif;
if T = 1710 then Miacondizione17 =C+20; Miacondizione18= C-20; endif;
//*************************************************************************************************************************

//Non si riesce a capire perche ma se metto il controllo in T = non lo prende, probabilmente perche delle barre potrebbero mancare
//in assenza di contrattazione
if T >=0910 and T <= 1009 then if positiondir =  1 then semaforo0910 = 1; endif; if positiondir = - 1 then semaforo0910 = - 1; endif; endif;
if T >=1010 and T <= 1109 then if positiondir =  1 then semaforo1010 = 1; endif; if positiondir = - 1 then semaforo1010 = - 1; endif; endif;
if T >=1110 and T <= 1209 then if positiondir =  1 then semaforo1110 = 1; endif; if positiondir = - 1 then semaforo1110 = - 1; endif; endif;
if T >=1210 and T <= 1309 then if positiondir =  1 then semaforo1210 = 1; endif; if positiondir = - 1 then semaforo1210 = - 1; endif; endif;
if T >=1310 and T <= 1409 then if positiondir =  1 then semaforo1310 = 1; endif; if positiondir = - 1 then semaforo1310 = - 1; endif; endif;
if T >=1410 and T <= 1509 then if positiondir =  1 then semaforo1410 = 1; endif; if positiondir = - 1 then semaforo1410 = - 1; endif; endif;
if T >=1510 and T <= 1609 then if positiondir =  1 then semaforo1510 = 1; endif; if positiondir = - 1 then semaforo1510 = - 1; endif; endif;
if T >=1610 and T <= 1709 then if positiondir =  1 then semaforo1610 = 1; endif; if positiondir = - 1 then semaforo1610 = - 1; endif; endif;
if T >=1710 and T <= 1730 then if positiondir =  1 then semaforo1710 = 1; endif; if positiondir = - 1 then semaforo1710 = - 1; endif; endif;
//*******************************************************************************************************************************************
//Identifica il livello del ritracciamento
if lastopisstop = false then vettorestop = 0; colorbar(lime);endif; if lastbar = true then semaforovettorestop = 0; endif;
if lastopisstop = true  then vettorestop = 1; colorbar(red); endif;if lastbar = true then semaforovettorestop = 0; endif;
if vettorestop[1] <> vettorestop and  vettorestop = 0 then
//if ultimaposizione = 1 then valoreritracciamento = H[1];
       if ultimaposizione = 1 then valoreritracciamento = valexit;
       if (CompareTime(09, 10, 0) > 0) and (CompareTime(10,09, 0) < 0) then Miacondizione1 = Valexit + 30; semaforo0910 = 0; endif;
       if (CompareTime(10, 10, 0) > 0) and (CompareTime(11,09, 0) < 0) then Miacondizione3 = Valexit + 30; semaforo1010 = 0; endif;
       if (CompareTime(11, 10, 0) > 0) and (CompareTime(12,09, 0) < 0) then Miacondizione5 = Valexit + 30; semaforo1110 = 0; endif;
       if (CompareTime(12, 10, 0) > 0) and (CompareTime(13,09, 0) < 0) then Miacondizione7 = Valexit + 30; semaforo1210 = 0; endif;
       if (CompareTime(13, 10, 0) > 0) and (CompareTime(14,09, 0) < 0) then Miacondizione9 = Valexit + 30; semaforo1310 = 0; endif;
       if (CompareTime(14, 10, 0) > 0) and (CompareTime(15,09, 0) < 0) then Miacondizione11= Valexit + 30; semaforo1410 = 0; endif;
       if (CompareTime(15, 10, 0) > 0) and (CompareTime(16,09, 0) < 0) then Miacondizione13= Valexit + 30; semaforo1510 = 0; endif;
       if (CompareTime(16, 10, 0) > 0) and (CompareTime(17,09, 0) < 0) then Miacondizione15= Valexit + 30; semaforo1610 = 0; endif;
       if (CompareTime(17, 10, 0) > 0) and (CompareTime(17,30, 0) < 0) then Miacondizione17= Valexit + 30; semaforo1710 = 0; endif;
    endif;

    //if ultimaposizione = -1 then valoreritracciamento = valexit-30;
       if (CompareTime(09, 10, 0) > 0) and (CompareTime(10,09, 0) < 0) then Miacondizione2 = Valexit - 30; semaforo0910 = 0; endif;
       if (CompareTime(10, 10, 0) > 0) and (CompareTime(11,09, 0) < 0) then Miacondizione4 = Valexit - 30; semaforo1010 = 0; endif;
       if (CompareTime(11, 10, 0) > 0) and (CompareTime(12,09, 0) < 0) then Miacondizione6 = Valexit - 30; semaforo1110 = 0; endif;
       if (CompareTime(12, 10, 0) > 0) and (CompareTime(13,09, 0) < 0) then Miacondizione8 = Valexit - 30; semaforo1210 = 0; endif;
       if (CompareTime(13, 10, 0) > 0) and (CompareTime(14,09, 0) < 0) then Miacondizione10= Valexit - 30; semaforo1310 = 0; endif;
       if (CompareTime(14, 10, 0) > 0) and (CompareTime(15,09, 0) < 0) then Miacondizione12= Valexit - 30; semaforo1410 = 0; endif;
       if (CompareTime(15, 10, 0) > 0) and (CompareTime(16,09, 0) < 0) then Miacondizione14= Valexit - 30; semaforo1510 = 0; endif;
       if (CompareTime(16, 10, 0) > 0) and (CompareTime(17,09, 0) < 0) then Miacondizione16= Valexit - 30; semaforo1610 = 0; endif;
       if (CompareTime(17, 10, 0) > 0) and (CompareTime(17,30, 0) < 0) then Miacondizione18= Valexit - 30; semaforo1710 = 0; endif;
    endif;
 //endif;
   if lastbar = true then semaforovettorestop = 0; endif;
   if lastbar = true then semaforovettorestop = 0; endif;

if LastOpIsStop = TRUE  and LastOpClosed = 1 then
RIENTROLONG = ValExit +10;endif;
//PlotChart(rientrolong,0,red,solid,2);

if LastOpIsStop = TRUE and LastOpClosed = -1 then
RIENTROSHORT = ValExit - 10;endif;
PlotChart(valexit,0,blue,solid,2);
//**************************************************************************************************************************************************

if (CompareTime(09, 10, 0) > 0) and (CompareTime(10,09, 0) < 0) then
       if C > Miacondizione1  and semaforo0910 <>  1  and C > C[1] then EnterLong(NextBar, AtOpen); semaforo0910 =  1; ultimaposizione =  1; endif;
         if LastOpIsStop = TRUE  and LastOpClosed = 1 and semaforo0910 <> 1 and C > RIENTROLONG and C > C[1]then Enterlong(Nextbar,atopen); semaforo0910 = 1; ultimaposizione =1; endif;
       if C < Miacondizione2  and semaforo0910 <> -1 and C < C[1]then EnterShort(NextBar,AtOpen); semaforo0910 = -1; ultimaposizione = -1; endif;
        if LastOpIsStop = TRUE  and LastOpClosed = -1 and semaforo0910 <> -1 and C < RIENTROSHORT and C < C[1]then Entershort(Nextbar,atopen); semaforo0910 = -1; ultimaposizione = -1; endif;
endif;
if (CompareTime(10, 10, 0) > 0) and(CompareTime(11,09, 0) < 0) then
       if C > Miacondizione3  and semaforo1010 <>  1   and C > C[1]then EnterLong(NextBar, AtOpen); semaforo1010 =  1; ultimaposizione =  1; endif;
       if LastOpIsStop = TRUE  and LastOpClosed = 1 and semaforo1010 <> 1 and C > RIENTROLONG and C > C[1]then Enterlong(Nextbar,atopen); semaforo1010 = 1; ultimaposizione =1; endif;
       if C < Miacondizione4  and semaforo1010 <> -1  and C < C[1]then EnterShort(NextBar,AtOpen); semaforo1010 = -1; ultimaposizione = -1; endif;
     if LastOpIsStop = TRUE  and LastOpClosed = -1 and semaforo1010 <> -1 and C < RIENTROSHORT and C < C[1]then Entershort(Nextbar,atopen); semaforo1010 = -1; ultimaposizione = -1; endif;
       
endif;
if (CompareTime(11, 10, 0) > 0) and (CompareTime(12,09, 0) < 0) then
       if C > Miacondizione5  and semaforo1110 <>  1   and C > C[1]then EnterLong(NextBar, AtOpen); semaforo1110 =  1; ultimaposizione =  1; endif;
        if LastOpIsStop = TRUE  and LastOpClosed = 1 and semaforo1110 <> 1 and C > RIENTROLONG and C > C[1]then Enterlong(Nextbar,atopen); semaforo1110 = 1; ultimaposizione =1; endif;
       if C < Miacondizione6  and semaforo1110 <> -1   and C < C[1]then EnterShort(NextBar,AtOpen); semaforo1110 = -1; ultimaposizione = -1; endif;
        if LastOpIsStop = TRUE  and LastOpClosed = -1 and semaforo1110 <> -1 and C < RIENTROSHORT and C < C[1]then Entershort(Nextbar,atopen); semaforo1110 = -1; ultimaposizione = -1; endif;
endif;
if (CompareTime(12, 10, 0) > 0) and (CompareTime(13,09, 0) < 0) then
       if C > Miacondizione7  and semaforo1210 <>  1   and C > C[1]then EnterLong(NextBar, AtOpen); semaforo1210 =  1; ultimaposizione =  1; endif;
         if LastOpIsStop = TRUE  and LastOpClosed = 1 and semaforo1210 <> 1 and C > RIENTROLONG and C > C[1]then Enterlong(Nextbar,atopen); semaforo1210 = 1; ultimaposizione =1; endif;
       if C < Miacondizione8  and semaforo1210 <> -1   and C < C[1]then EnterShort(NextBar,AtOpen); semaforo1210 = -1; ultimaposizione = -1; endif;
       if LastOpIsStop = TRUE  and LastOpClosed = -1 and semaforo1210 <> -1 and C < RIENTROSHORT and C < C[1]then Entershort(Nextbar,atopen); semaforo1210 = -1; ultimaposizione = -1; endif;
endif;
if (CompareTime(13, 10, 0) > 0) and (CompareTime(14,09, 0) < 0) then
       if C > Miacondizione9  and semaforo1310 <>  1   and C > C[1]then EnterLong(NextBar, AtOpen); semaforo1310 =  1; ultimaposizione =  1; endif;
         if LastOpIsStop = TRUE  and LastOpClosed = 1 and semaforo1310 <> 1 and C > RIENTROLONG and C > C[1]then Enterlong(Nextbar,atopen); semaforo1310 = 1; ultimaposizione =1; endif;
       if C < Miacondizione10 and semaforo1310 <> -1   and C < C[1]then EnterShort(NextBar,AtOpen); semaforo1310 = -1; ultimaposizione = -1; endif;
       if LastOpIsStop = TRUE  and LastOpClosed = -1 and semaforo1310 <> -1 and C < RIENTROSHORT and C < C[1]then Entershort(Nextbar,atopen); semaforo1310 = -1; ultimaposizione = -1; endif;
endif;
if (CompareTime(14, 10, 0) > 0) and (CompareTime(15,09, 0) < 0) then
       if C > Miacondizione11 and semaforo1410 <>  1 and C > C[1]then EnterLong(NextBar, AtOpen); semaforo1410 =  1; ultimaposizione =  1; endif;
         if LastOpIsStop = TRUE  and LastOpClosed = 1 and semaforo1410 <> 1 and C > RIENTROLONG and C > C[1]then Enterlong(Nextbar,atopen); semaforo1410 = 1; ultimaposizione =1; endif;
       if C < Miacondizione12 and semaforo1410 <> -1   and C < C[1]then EnterShort(NextBar,AtOpen); semaforo1410 = -1; ultimaposizione = -1; endif;
      if LastOpIsStop = TRUE  and LastOpClosed = -1 and semaforo1410 <> -1 and C < RIENTROSHORT and C < C[1]then Entershort(Nextbar,atopen); semaforo1410 = -1; ultimaposizione = -1; endif;
endif;
if (CompareTime(15, 10, 0) > 0) and (CompareTime(16,09, 0) < 0) then
       if C > Miacondizione13 and semaforo1510 <>  1   and C > C[1]then EnterLong(NextBar, AtOpen); semaforo1510 =  1; ultimaposizione =  1; endif;
         if LastOpIsStop = TRUE  and LastOpClosed = 1 and semaforo1510 <> 1 and C > RIENTROLONG and C > C[1]then Enterlong(Nextbar,atopen); semaforo1510 = 1; ultimaposizione =1; endif;
       if C < Miacondizione14 and semaforo1510 <> -1   and C < C[1]then EnterShort(NextBar,AtOpen); semaforo1510 = -1; ultimaposizione = -1; endif;
       if LastOpIsStop = TRUE  and LastOpClosed = -1 and semaforo1510 <> -1 and C < RIENTROSHORT and C < C[1]then Entershort(Nextbar,atopen); semaforo1510 = -1; ultimaposizione = -1; endif;
endif;
if (CompareTime(16, 10, 0) > 0) and (CompareTime(17,09, 0) < 0) then
       if C > Miacondizione15 and semaforo1610 <>  1   and C > C[1]then EnterLong(NextBar, AtOpen); semaforo1610 =  1; ultimaposizione =  1; endif;
         if LastOpIsStop = TRUE  and LastOpClosed = 1 and semaforo1610 <> 1 and C > RIENTROLONG and C > C[1]then Enterlong(Nextbar,atopen); semaforo1610 = 1; ultimaposizione =1; endif;
       if C < Miacondizione16 and semaforo1610 <> -1  and C < C[1]then EnterShort(NextBar,AtOpen); semaforo1610 = -1; ultimaposizione = -1; endif;
       if LastOpIsStop = TRUE  and LastOpClosed = -1 and semaforo1610 <> -1 and C < RIENTROSHORT and C < C[1]then Entershort(Nextbar,atopen); semaforo1610 = -1; ultimaposizione = -1; endif;
endif;
if (CompareTime(17, 10, 0) > 0) and (CompareTime(17,30, 0) < 0) then
       if C > Miacondizione17 and semaforo1710 <>  1  and C > C[1]then EnterLong(NextBar, AtOpen); semaforo1710 =  1; ultimaposizione =  1; endif;
         if LastOpIsStop = TRUE  and LastOpClosed = 1 and semaforo1710 <> 1 and C > RIENTROLONG and C > C[1]then Enterlong(Nextbar,atopen); semaforo1710 = 1; ultimaposizione =1; endif;
       if C < Miacondizione18 and semaforo1710 <> -1   and C < C[1]then EnterShort(NextBar, AtOpen);semaforo1710 = -1; ultimaposizione = -1; endif;
       if LastOpIsStop = TRUE  and LastOpClosed = -1 and semaforo1710 <> -1 and C < RIENTROSHORT and C < C[1]then Entershort(Nextbar,atopen); semaforo1710 = -1; ultimaposizione = -1; endif;
endif;

//******************************************************************************************************************************************************
if t>=1732 then
if positiondir=1 then
exitlong(bar,atclose);
endif;
if positiondir=-1 then
exitshort(bar,atclose);
endif;
endif;
if lastbar = true then
Semaforo0910 = 0;
Semaforo1010 = 0;
semaforo1110 = 0;
Semaforo1210 = 0;
semaforo1310 = 0;
semaforo1410 = 0;
Semaforo1510 = 0;
semaforo1610 = 0;
semaforo1710 = 0;
endif;


PlotChart(MioHight,0,red,solid,2);
//PlotChart(rientroshort,0,blue,solid,2);
 

solospread

Forumer storico
E anche stavolta aveva ragione ADX. Poche operazioni ma pochi errori ed è questo l'importante. Due considerazioni. Se io avessi avuto davanti solo il grafico dov'è entrato short ADX, io sarei entrato dall'altra parte. Infatti quando è entrato io non l'ho seguito. Ho guardato anche le altre entrate ed ho visto che anticipa sempre di un centinaio di punti l'ingresso. A prima vista sembrerebbe un andicap, ma se lo si guarda dal punto di vista dello slippage siamo sicuri di avere un'entrata migliore di quella del TS. Addirittura si potrebbe posticipare di qualche minuto l'entry se fosse il caso. vediamo dove chiude lo short e se si gira per il reverse.

ScreenHunter_12 Jan. 23 14.35.gif
 

Users who are viewing this thread

Alto