Discussione: TS: BreakOut Dinamico in Easy Language
Visualizzazione Ibrida
-
21-10-13, 00:33 #1
- Data Registrazione
- Sep 2013
- Località
- Monza
- Messaggi
- 186
Ciao Apo,
no il codice postato da Thalos fa una cosa completamente differente.
Ti commento le istruzioni di EasyLanguage, così forse qualcuno può riuscire a
tradurlo in EasyScript.
-
Codice EasyLanguage:
#
# Inputs
Inputs: MaxLB(60), MinLB(20);
#
# Inizializzazione variabili con valore iniziale zero
Vars: HistVol(0), YestHistVol(0), DeltaHistVol(0),
EntryLB(0),
ExitLB(0), YestEntryLB(0);
#
# Viene passato a YestHistVol il valore di HistVol barra precedente
# prima di modificarlo in questa barra
YestHistVol = HistVol;
HistVol = StdDev(C, 30);
#
# e viene calcolato il DeltaHistVol che verrà utilizzato per determinare
# il periodo dinamico del nostro canale di massimi e minimi
DeltaHistVol = (HistVol - YestHistVol) / Histvol;
#
# viene inizializzato alla prima barra EntryLB a valore 20
if CurrentBar = 1 Then EntryLB = 20;
#
# Viene passato a YestEntryLB il valore di EntryLB barra precedente
# prima di modificarlo nelle barre successive
YestEntryLB = EntryLB;
#
# viene calcolato per l'attuale barra il nuovo valore di EntryLB
# che deve essere compreso tra MinLB e MaxLB
EntryLB = YestEntryLB * (1 + DeltaHistVol);
EntryLB = MaxList(EntryLB, MinLB);
EntryLB = MinList(EntryLB, MaxLB);
#
#
ExitLB = EntryLB * 0.5;
#
# filtro orario
If time > 1000 and Time < 1700 Then begin
#
# il segnale scatta quando close supera il massimo High
# o il minimo Low di EntryLB periodi
Buy Tomorrow at Highest(High, EntryLB) Stop;
Sell Tomorrow at Lowest(Low, EntryLB) Stop;
End;
Saluti
Massimo
-
21-10-13, 01:40 #2
Ciao Max, poresti postare un grafico di un back test in Easylanguage con alcuni ingressi e uscite in modo da comprendere meglio come funziona il TS ?
grazie
Apo....non si desidera ciò che è facile ottenere (Ovidio)....
-
22-10-13, 13:28 #3
- Data Registrazione
- Sep 2013
- Località
- Monza
- Messaggi
- 186
Salve a tutti,
grazie alla nuova funzione di beeTrader e all'idea di Apo
ecco tradotto il codice postato da Thalos.
L'ho tradotto sia come indicatore per dare l'immagine
del canale dinamico utilizzato per il signal, sia come segnale per la strategia.
Manca da inserire Stoploss e TrailingStop.
Si potrebbe inoltre snellire la parte di codice
relativo alle porzioni Sell, ExitLong e ExitShort
eliminando le linee inutili,
ma io per comodità mi sono limitato ad un copia-incolla.
Scusate la forma ma non ho ancora imparato a delimitare il codice.
Come si fa ?
Saluti
Massimo
#
# Indicatore Volatilità suggerito da Thalos
#
INPUTS: @MaxLB(60), @MinLB(20)
SET HistVol=SDV(CLOSE, 30, 1, SIMPLE)+0.000001
SET YestHistVol = REF(HistVol, 1)
SET DeltaHistVol = (HistVol - REF(HistVol, 1))/HistVol
SET EntryLB = BARLOOP (20 , 1, MULTIPLY , (1 + DeltaHistVol),@MinLB, @MaxLB)
SET ExitLB = EntryLB *0.5
SET EntryHigh = MAX(HIGH, EntryLB)
SET EntryLow = MIN(LOW, EntryLB)
SET ExitHigh = MAX(HIGH, ExitLB)
SET ExitLow = MIN(LOW, ExitLB)
SET PLOT1 = EntryHigh
SET PLOT2 = EntryLow
SET PLOT3 = ExitHigh
SET PLOT4 = ExitLow
#
# Signal Volatilità suggerito da Thalos BuyScript
#
INPUTS: @MaxLB(60), @MinLB(20)
SET HistVol=SDV(CLOSE, 30, 1, SIMPLE)+0.000001
SET YestHistVol = REF(HistVol, 1)
SET DeltaHistVol = (HistVol - REF(HistVol, 1))/HistVol
SET EntryLB = BARLOOP (20 , 1, MULTIPLY , (1 + DeltaHistVol),@MinLB, @MaxLB)
SET ExitLB = EntryLB *0.5
SET EntryHigh = MAX(HIGH, EntryLB)
SET EntryLow = MIN(LOW, EntryLB)
SET ExitHigh = MAX(HIGH, ExitLB)
SET ExitLow = MIN(LOW, ExitLB)
SET Cond1= TIME >1000 AND TIME <1700
COND1 AND CLOSE > REF(EntryHigh, 1)
#
# Signal Volatilità suggerito da Thalos SellScript
#
SET HistVol=SDV(CLOSE, 30, 1, SIMPLE)+0.000001
SET YestHistVol = REF(HistVol, 1)
SET DeltaHistVol = (HistVol - REF(HistVol, 1))/HistVol
SET EntryLB = BARLOOP (20 , 1, MULTIPLY , (1 + DeltaHistVol),@MinLB, @MaxLB)
SET ExitLB = EntryLB *0.5
SET EntryHigh = MAX(HIGH, EntryLB)
SET EntryLow = MIN(LOW, EntryLB)
SET ExitHigh = MAX(HIGH, ExitLB)
SET ExitLow = MIN(LOW, ExitLB)
SET Cond1= TIME >1000 AND TIME <1700
COND1 AND CLOSE < REF(EntryLow, 1)
#
# Signal Volatilità suggerito da Thalos LongExitScript
#
SET HistVol=SDV(CLOSE, 30, 1, SIMPLE)+0.000001
SET YestHistVol = REF(HistVol, 1)
SET DeltaHistVol = (HistVol - REF(HistVol, 1))/HistVol
SET EntryLB = BARLOOP (20 , 1, MULTIPLY , (1 + DeltaHistVol),@MinLB, @MaxLB)
SET ExitLB = EntryLB *0.5
SET EntryHigh = MAX(HIGH, EntryLB)
SET EntryLow = MIN(LOW, EntryLB)
SET ExitHigh = MAX(HIGH, ExitLB)
SET ExitLow = MIN(LOW, ExitLB)
SET Cond1= TIME >1000 AND TIME <1700
CLOSE < REF(ExitLow, 1)
#
# Signal Volatilità suggerito da Thalos ShortExitScript
#
SET HistVol=SDV(CLOSE, 30, 1, SIMPLE)+0.000001
SET YestHistVol = REF(HistVol, 1)
SET DeltaHistVol = (HistVol - REF(HistVol, 1))/HistVol
SET EntryLB = BARLOOP (20 , 1, MULTIPLY , (1 + DeltaHistVol),@MinLB, @MaxLB)
SET ExitLB = EntryLB *0.5
SET EntryHigh = MAX(HIGH, EntryLB)
SET EntryLow = MIN(LOW, EntryLB)
SET ExitHigh = MAX(HIGH, ExitLB)
SET ExitLow = MIN(LOW, ExitLB)
SET Cond1= TIME >1000 AND TIME <1700
CLOSE > REF(ExitHigh, 1)
-
22-10-13, 13:53 #4
- Data Registrazione
- Apr 2010
- Messaggi
- 800
Ottimo, mi hai preceduto sul tempo....
Volevo fare una precisazione, i valori (60) e (20) sono stati calcolati per semplicita' su grafico con Time Frame a 1 Ora, per cui volendo aumentare o diminuire il Time Frame bisogna necessariamente variare in piu' o in meno i due valori sopra descritti...
Ovviamente il TS e' anche modificabile rendendolo piu' performante mettendo un filtro che dia un segnale piu' chiaro sull' Ingresso e sull' uscita, per esempio un indicatore di Trend tipo il SuperTrend, oppure anche una Media mobile esponenziale potrebbe andare bene...--- Trend my Friend ---
-
22-10-13, 14:20 #5I computer sono incredibilmente veloci, accurati e stupidi. Gli uomini sono incredibilmente lenti, inaccurati e intelligenti. L’insieme dei due costituisce una forza incalcolabile. (Albert Einstein)
-
22-10-13, 14:39 #6
- Data Registrazione
- Sep 2013
- Località
- Monza
- Messaggi
- 186
Ciao Marco,
la parte difficile l'ha fatta Max Francario !!!
Grazie per l'info.
Saluti
Massimo
-
22-10-13, 15:36 #7
-
24-10-13, 00:45 #8
- Data Registrazione
- Jul 2012
- Messaggi
- 674
maxmax68;65923]Salve a tutti,
grazie alla nuova funzione di beeTrader e all'idea di Apo
ecco tradotto il codice postato da Thalos.
L'ho tradotto sia come indicatore per dare l'immagine
del canale dinamico utilizzato per il signal, sia come segnale per la strategia.
Manca da inserire Stoploss e TrailingStop.
Si potrebbe inoltre snellire la parte di codice
relativo alle porzioni Sell, ExitLong e ExitShort
eliminando le linee inutili,
ma io per comodità mi sono limitato ad un copia-incolla.
Scusate la forma ma non ho ancora imparato a delimitare il codice.
Come si fa ?
Saluti
Massimo
Fab
-
01-10-14, 14:45 #9
- Data Registrazione
- Dec 2009
- Messaggi
- 813
Errore in Strategy?
Ultima modifica di CIVT; 01-10-14 alle 14:55
-
01-10-14, 17:23 #10