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

Ciao ragazzi, è da tempo che vi seguo .... rubandovi i TS, ma adesso la mia creatura è pronta e voglio condividerla con voi, magari accettando interessanti modifiche....

attendo con ansia !!!!

{******************************************************************************
* Il sistema è stato testato sul FIB
* Compressione grafico 5 minuti
*Il sistema vuole catturare i cambi di volatilità
*******************************************************************************}
Var: mediarange, macdf, macds, miomax, miomin, ora, mediavol;
Input: percrange (20), barre (12);
mediarange = mov (R,barre,s);
mediavol = mov (V,barre,s);
macdf = macd (C,12,26);
macds = macdsign (C,12,26,9);
installstoploss (inperc, 1);
installtrailingprofit (inperc,1,0.9);
// opera solo dalle 9.30 alle 17.00 con pausa pranzo
if (t > 930 and t<1100) or (t>1530 and t<1700) then
if R > mediarange*(1+percrange/100) and positiondir <> 1 and macdf>macds and V>mediavol
and H>=H[1] and H>=H[2] and H>=H[3] and H>=H[4] and H>=H[5] and H>=H[6] and H>=H[7] and H>=H[8]
and H>=H[9] and H>=H[10] and H>=H[11] and H>=H[12] then
enterlong (nextbar, atopen);
colorbar (green);
ora = gethour;
endif;
if R > mediarange*(1+percrange/100) and positiondir <>-1 and macdf<macds and V>mediavol
and L<= L[1] and L<= L[2] and L<= L[3] and L<= L[4] and L<= L[5] and L<= L[6] and L<= L[7] and L<= L[8]
and L<= L[9] and L<= L[10] and L<= L[11] and L<= L[12] then
entershort (nextbar, atopen);
colorbar (red);
ora = gethour;
endif;

// engulfing bullish and engulfing bearish
if positiondir = 1 then
if H>=H[1] and H>=H[2] and H>=H[3] and H>=H[4] and H>=H[5] and H>=H[6] and H>=H[7] and H>=H[8]
and H>=H[9] and H>=H[10] and H>=H[11] and H>=H[12] and C[1]> O[1] and O>= C and O>=C[1] and C<=O[1]
and V> mediavol then
exitlong (nextbar, addtick (L,-1),stop,5);
entershort (nextbar, addtick(L,-1),stop,5);
colorbar (red);
endif;
endif;
if positiondir = -1 then
if L<= L[1] and L<= L[2] and L<= L[3] and L<= L[4] and L<= L[5] and L<= L[6] and L<= L[7] and L<= L[8]
and L<= L[9] and L<= L[10] and L<= L[11] and L<= L[12]
and C > O and O<= C[1] and C>=O[1] and O[1]>=C[1] and V> mediavol then
exitshort (nextbar, addtick(H,1),stop,5);
enterlong (nextbar, addtick(H,1),stop,5);
colorbar (green);
endif;
endif;
//posizione non short : massimo relativo ed inverted hammer nero
if positiondir <>-1 then
if H>=H[1] and H>=H[2] and H>=H[3] and H>=H[4] and H>=H[5] and H>=H[6] and H>=H[7] and H>=H[8]
and H>=H[9] and H>=H[10] and H>=H[11] and H>=H[12]
and (C-L)<=(H-L)*0.1 and (O-C)<=(H-L)*0.33 and V> mediavol then
exitlong (nextbar, addtick (L,-1),stop,5);
entershort (nextbar, addtick(L,-1),stop,5);
colorbar (red);
endif;
endif;
// posizione non long: minimo relativo ed hammer bianco
if positiondir <> 1 then
if L<= L[1] and L<= L[2] and L<= L[3] and L<= L[4] and L<= L[5] and L<= L[6] and L<= L[7] and L<= L[8]
and L<= L[9] and L<= L[10] and L<= L[11] and L<= L[12]
and (H-C)<=(O-L)*0.1 and (C-O)<=(H-L)*0.33 and V> mediavol then
exitshort (nextbar, addtick(H,1),stop,5);
enterlong (nextbar, addtick(H,1),stop,5);
colorbar (green);
endif;
endif;
//posizione nonshort : massimo relativo ed inverted hammer bianco
if positiondir <>-1 then
if H>=H[1] and H>=H[2] and H>=H[3] and H>=H[4] and H>=H[5] and H>=H[6] and H>=H[7] and H>=H[8]
and H>=H[9] and H>=H[10] and H>=H[11] and H>=H[12]
and (O-L)<=(H-L)*0.1 and (C-O)<=(H-L)*0.33 and V> mediavol then
exitlong (nextbar, addtick (L,-1),stop,5);
entershort (nextbar, addtick(L,-1),stop,5);
colorbar (red);
endif;
endif;
// posizione non long: minimo relativo ed hammer nero
if positiondir <> 1 then
if L<= L[1] and L<= L[2] and L<= L[3] and L<= L[4] and L<= L[5] and L<= L[6] and L<= L[7] and L<= L[8]
and L<= L[9] and L<= L[10] and L<= L[11] and L<= L[12]
and (H-O)<=(C-L)*0.1 and (O-C)<=(H-L)*0.33 and V> mediavol then
exitshort (nextbar, addtick(H,1),stop,5);
enterlong (nextbar, addtick(H,1),stop,5);
colorbar (green);
endif;
endif;
// il tempo passa
if gethour > ora + 3 then
modifytrailingprofit (inperc, 0.2, 1);
endif;
endif;
if t > 1720 then
if positiondir = 1 then exitlong (bar, atclose);
endif;
if positiondir = -1 then exitshort (bar, atclose);
endif;
endif;

 

Damien

Nessuno è mai al sicuro
Ciao ragazzi, è da tempo che vi seguo .... rubandovi i TS, ma adesso la mia creatura è pronta e voglio condividerla con voi, magari accettando interessanti modifiche....

attendo con ansia !!!!

{******************************************************************************
* Il sistema è stato testato sul FIB
* Compressione grafico 5 minuti
*Il sistema vuole catturare i cambi di volatilità
*******************************************************************************}
Var: mediarange, macdf, macds, miomax, miomin, ora, mediavol;
Input: percrange (20), barre (12);
mediarange = mov (R,barre,s);
mediavol = mov (V,barre,s);
macdf = macd (C,12,26);
macds = macdsign (C,12,26,9);
installstoploss (inperc, 1);
installtrailingprofit (inperc,1,0.9);
// opera solo dalle 9.30 alle 17.00 con pausa pranzo
if (t > 930 and t<1100) or (t>1530 and t<1700) then
if R > mediarange*(1+percrange/100) and positiondir <> 1 and macdf>macds and V>mediavol
and H>=H[1] and H>=H[2] and H>=H[3] and H>=H[4] and H>=H[5] and H>=H[6] and H>=H[7] and H>=H[8]
and H>=H[9] and H>=H[10] and H>=H[11] and H>=H[12] then
enterlong (nextbar, atopen);
colorbar (green);
ora = gethour;
endif;
if R > mediarange*(1+percrange/100) and positiondir <>-1 and macdf<macds and V>mediavol
and L<= L[1] and L<= L[2] and L<= L[3] and L<= L[4] and L<= L[5] and L<= L[6] and L<= L[7] and L<= L[8]
and L<= L[9] and L<= L[10] and L<= L[11] and L<= L[12] then
entershort (nextbar, atopen);
colorbar (red);
ora = gethour;
endif;

// engulfing bullish and engulfing bearish
if positiondir = 1 then
if H>=H[1] and H>=H[2] and H>=H[3] and H>=H[4] and H>=H[5] and H>=H[6] and H>=H[7] and H>=H[8]
and H>=H[9] and H>=H[10] and H>=H[11] and H>=H[12] and C[1]> O[1] and O>= C and O>=C[1] and C<=O[1]
and V> mediavol then
exitlong (nextbar, addtick (L,-1),stop,5);
entershort (nextbar, addtick(L,-1),stop,5);
colorbar (red);
endif;
endif;
if positiondir = -1 then
if L<= L[1] and L<= L[2] and L<= L[3] and L<= L[4] and L<= L[5] and L<= L[6] and L<= L[7] and L<= L[8]
and L<= L[9] and L<= L[10] and L<= L[11] and L<= L[12]
and C > O and O<= C[1] and C>=O[1] and O[1]>=C[1] and V> mediavol then
exitshort (nextbar, addtick(H,1),stop,5);
enterlong (nextbar, addtick(H,1),stop,5);
colorbar (green);
endif;
endif;
//posizione non short : massimo relativo ed inverted hammer nero
if positiondir <>-1 then
if H>=H[1] and H>=H[2] and H>=H[3] and H>=H[4] and H>=H[5] and H>=H[6] and H>=H[7] and H>=H[8]
and H>=H[9] and H>=H[10] and H>=H[11] and H>=H[12]
and (C-L)<=(H-L)*0.1 and (O-C)<=(H-L)*0.33 and V> mediavol then
exitlong (nextbar, addtick (L,-1),stop,5);
entershort (nextbar, addtick(L,-1),stop,5);
colorbar (red);
endif;
endif;
// posizione non long: minimo relativo ed hammer bianco
if positiondir <> 1 then
if L<= L[1] and L<= L[2] and L<= L[3] and L<= L[4] and L<= L[5] and L<= L[6] and L<= L[7] and L<= L[8]
and L<= L[9] and L<= L[10] and L<= L[11] and L<= L[12]
and (H-C)<=(O-L)*0.1 and (C-O)<=(H-L)*0.33 and V> mediavol then
exitshort (nextbar, addtick(H,1),stop,5);
enterlong (nextbar, addtick(H,1),stop,5);
colorbar (green);
endif;
endif;
//posizione nonshort : massimo relativo ed inverted hammer bianco
if positiondir <>-1 then
if H>=H[1] and H>=H[2] and H>=H[3] and H>=H[4] and H>=H[5] and H>=H[6] and H>=H[7] and H>=H[8]
and H>=H[9] and H>=H[10] and H>=H[11] and H>=H[12]
and (O-L)<=(H-L)*0.1 and (C-O)<=(H-L)*0.33 and V> mediavol then
exitlong (nextbar, addtick (L,-1),stop,5);
entershort (nextbar, addtick(L,-1),stop,5);
colorbar (red);
endif;
endif;
// posizione non long: minimo relativo ed hammer nero
if positiondir <> 1 then
if L<= L[1] and L<= L[2] and L<= L[3] and L<= L[4] and L<= L[5] and L<= L[6] and L<= L[7] and L<= L[8]
and L<= L[9] and L<= L[10] and L<= L[11] and L<= L[12]
and (H-O)<=(C-L)*0.1 and (O-C)<=(H-L)*0.33 and V> mediavol then
exitshort (nextbar, addtick(H,1),stop,5);
enterlong (nextbar, addtick(H,1),stop,5);
colorbar (green);
endif;
endif;
// il tempo passa
if gethour > ora + 3 then
modifytrailingprofit (inperc, 0.2, 1);
endif;
endif;
if t > 1720 then
if positiondir = 1 then exitlong (bar, atclose);
endif;
if positiondir = -1 then exitshort (bar, atclose);
endif;
endif;


L<= L[1] and L<= L[2] and L<= L[3] and L<= L[4] and L<= L[5] and L<= L[6] and L<= L[7] and L<= L[8]
and L<= L[9] and L<= L[10] and L<= L[11] and L<= L[12]

questo lo puoi altrimenti e piu velocemente esprimere in questo modo
L<=llv(l,12)

cosi come questo
H>=H[1] and H>=H[2] and H>=H[3] and H>=H[4] and H>=H[5] and H>=H[6] and H>=H[7] and H>=H[8]
and H>=H[9] and H>=H[10] and H>=H[11] and H>=H[12]

in questo modo h>=hhv(h,12)


Complimenti per le 4 ore di pausa pranzo :party:
 
grazie per il suggerimento... la pausa pranzo, oltre che per ragioni di "obblighi lavorativi" , è dettata dal fatto che tra le 11.00 e le 15.30 la giornata diventa swing (attende Wally) e sembra funzionare questo sistema un po' arrangiato....

TIME FRAME 30 minuti ....

Var: MML, MMH, MM4;
MMH = Mov(H,4,S);
MML = Mov(L,4,S);
MM4 = Mov(C,4,S);

SECTION_ENTERLONG:
if C < MML and t>1100 and t<1500 then
EnterLong(Bar, AtClose);
endif;
END_SECTION
SECTION_EXITLONG:
if t>=1700 then
ExitLong(Bar, atclose);
endif;
ExitLong(Bar, MM4);

END_SECTION
SECTION_ENTERSHORT:
if C > MMH and t>1100 and t<1500 then
EnterShort(Bar, AtClose);
endif;
END_SECTION
SECTION_EXITSHORT:
if t>=1700 then
exitshort (bar,atclose);
endif;
ExitShort(Bar, MM4);
END_SECTION
PlotChart (MMH, 0, Green, Solid, 2);
PlotChart (MML, 0, Red, Solid, 2);
PlotChart (MM4, 0, Blue, Solid, 2);
 

Damien

Nessuno è mai al sicuro
grazie per il suggerimento... la pausa pranzo, oltre che per ragioni di "obblighi lavorativi" , è dettata dal fatto che tra le 11.00 e le 15.30 la giornata diventa swing (attende Wally) e sembra funzionare questo sistema un po' arrangiato....

TIME FRAME 30 minuti ....

Var: MML, MMH, MM4;
MMH = Mov(H,4,S);
MML = Mov(L,4,S);
MM4 = Mov(C,4,S);

SECTION_ENTERLONG:
if C < MML and t>1100 and t<1500 then
EnterLong(Bar, AtClose);
endif;
END_SECTION
SECTION_EXITLONG:
if t>=1700 then
ExitLong(Bar, atclose);
endif;
ExitLong(Bar, MM4);

END_SECTION
SECTION_ENTERSHORT:
if C > MMH and t>1100 and t<1500 then
EnterShort(Bar, AtClose);
endif;
END_SECTION
SECTION_EXITSHORT:
if t>=1700 then
exitshort (bar,atclose);
endif;
ExitShort(Bar, MM4);
END_SECTION
PlotChart (MMH, 0, Green, Solid, 2);
PlotChart (MML, 0, Red, Solid, 2);
PlotChart (MM4, 0, Blue, Solid, 2);

Quella del pranzo è solo una battuta :)

Questo ts controllalo in tempo reale ... non mi convincono tanto le istruzioni basate sull exit al valore della media.
Il valore della media a 4 barre cambia di continuo anche nel corso dell ultima candela stessa, quindi è facile che guardi al futuro e non sia veritiero.

Ciao.
 

solospread

Forumer storico
Ciao ORB1974, inanzitutto un caloroso benvenuto in questo 3d. Volevo solo aggiungere a quanto riportato da Damien che anche nel primo TS da te postato le istruzioni per le entrate ed uscite danno delle notevoli discordanze tra il backtest ed il realtime. Mi riferisco a queste:
exitlong (nextbar, addtick (L,-1),stop,5);
entershort (nextbar, addtick(L,-1),stop,5);
Le uniche entrate effettivamente reali sono (NextBar,AtOpen) o (Bar,AtClose).
 

ender85

Forumer attivo
Questo ts controllalo in tempo reale ... non mi convincono tanto le istruzioni basate sull exit al valore della media.
L'idea mi pare molto simile ad un ts presentato a milano :D, ma ovviamente l'uscita sulla media mobile guarda al futuro, quindi inficia il risultato del backtest. Però l'idea è davvero fenomenale :prr:
 

BOVARO

Nuovo forumer
Problemino

IF MM1 > MM2 THEN ENTERLONG(BAR,L, 0, 0,"ENTER LONG");ENDIF;

FUTURES SPMIB. Poniamo un time frame 1 MIN.

Facendo back test con VT quasta istruzione viene eseguita correttamente entrando sul minimo della barra che ha permesso ANCHE l’entrata long.

In real time questo non è possibile perché quando la condizione è vera la barra è gia chiusa pertanto non si può entrare sul suo minimo che è gia chiusa !

Pertanto modificando l’entrata in questo modo in real time è fattibile ?

IF MM1 > MM2 THEN ENTERLONG(NEXTBAR, L, LIMIT, 5,"ENTER LONG");ENDIF;


Grazie
 

Users who are viewing this thread

Alto