info Backtest Supertrend
Forums › ProRealTime forum Italiano › Supporto ProOrder › info Backtest Supertrend
- This topic has 4 replies, 2 voices, and was last updated 3 years ago by
xcirolix85.
-
-
10/16/2022 at 1:02 PM #202617
Ciao ragazzi, premetto che non sono molto pratico con le programmazioni perchè il mio stile è discrezionale.
Detto ciò vorrei chiedere se qualche buon anima mi può dare una mano a modificare la scrittura della strategia supertrend di default per fare dei backtest
Quello che vorrei è:
- Sul settimanale se il Supertrend è verde cerca solo posizioni LONG
- Sul settimanale se il Supertrend è rosso cerca solo posizioni SHORT
TF OPERATIVO
- Giornaliero: Entra long quando c’è il cambio da rosso a verde / esci quando diventa rosso
- Giornaliero: Entra short quando c’è il cambio da verde a rosso / esci quando diventa verde
10/17/2022 at 9:03 AM #202661Ecco il codice che stai cercando. Prendiamo ordini su intervalli di tempo giornalieri Supertend che cambiano colore e con un filtro Supertrend dello stesso colore su base settimanale.
1234567891011121314timeframe(weekly, updateonclose)wst = Supertrend[3,10]wlong = close>wstwshort = close<wsttimeframe(daily,updateonclose)dst = Supertrend[3,10]if not longonmarket and close crosses over dst and wlong thenbuy 1 contract at marketendifif not shortonmarket and close crosses under dst and wshort thensellshort 1 contract at marketendif10/17/2022 at 11:41 AM #202676Grazie della risposta intanto..
L’ho appena provato ma noto che nel tf operativo, cioè il giornaliero, non chiude le operazioni quando c’è il cambio colore..
10/17/2022 at 12:45 PM #202681Sì, penso che sia correlato al modo in cui apro l'ordine solo in base al filtro settimanale. Nella versione modificata di seguito, gli ordini vengono chiusi solo in base al cambio colore giornaliero Supertrend, anche se una nuova condizione di ordine contrarian non è ancora soddisfatta:
12345678910111213141516171819202122timeframe(weekly, updateonclose)wst = Supertrend[3,10]wlong = close>wstwshort = close<wsttimeframe(daily,updateonclose)dst = Supertrend[3,10]if longonmarket and close crosses under dst thensell at marketendifif shortonmarket and close crosses over dst thenexitshort at marketendifif not longonmarket and close crosses over dst and wlong thenbuy 1 contract at marketendifif not shortonmarket and close crosses under dst and wshort thensellshort 1 contract at marketendif10/17/2022 at 2:15 PM #202699Ottimo così va benissimo.. grazie mille
-
AuthorPosts
Find exclusive trading pro-tools on 