Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Study Swing Trend Trailing Riot Period 1 10-09-2025 ETHUSDT.P BYBIT 4H LONG E SHORT //
- // Datafeed Cambiato / Periodi Backtest Cambiati / Inputs Cambiati / Stop Loss Limit Tolto //
- // Condizione Long Tolta: and ((close[1] < (media_ema_1 + apertura_minima)) or (low[1] < (media_ema_1 + apertura_minima))) and close > open
- // Condizione Short Tolta: and ((close[1] > (media_ema_1 - apertura_minima)) or (high[1] > (media_ema_1 - apertura_minima))) and close < open
- // *** Attezione aclune operazioni potrebbero essere diverse da tradestation perchè tradingview
- // se esce in trailng stop e allo stesso tempo c'è la condizione di ingresso sulla stessa candela
- // non effettua uscite ed entrate nella stessa candela in questo caso specifico mentre tradestation si *** !!!
- // RIOTTIMIZZAZIONE PERIODICA 1 DELLA ORIGINALE SWING TREND TRAILING
- // IL DATAFEED COMPLETO = (18/08/2017 10/08/2025)
- // NUOVI DATI DI SVILUPPO DATAFEED ETH/USDT BINANCE + ETH/USDT.P BYBIT 4H STORICO INIZIALE BINANCE PER POI PROSEGUIRE CON BYBIT
- // (Sviluppo Dati Exchange = BINANCE + BYBIT) (BINANCE Dal=18/08/2017 Al 10/10/2020) (BYBIT Dal=21/10/2020 Al 10/08/2025)
- // SU TRADINGVIEW ORARIO BORSA GMT
- // BARSBACK TRADESTATION: 500
- // NUOVE DATE IN SAMPLE E OUT OF SAMPLE
- //Il data feed completo: 18/08/2017 10/08/2025
- //In Sample: Inizio 18/08/2017 Fine 12/06/2023
- //Out Of Sample: Inizio 13/06/2023 Fine 10/08/2025
- // Il trading system completo - Bot Swing Trend Trailing Riot Period 1 10-09-2025 ETHUSDT.P BYBIT 4H LONG E SHORT
- // (Exchange= BYBIT) (Sottostante ETH-USDT.P) (Timeframe= 4H) (Direzione= LONG E SHORT) (Swing Posizione= SI) (Esclusione Ore=NO) (Esclusione Giorni=NO) (Esclusione Mesi=NO)
- // (Take Profit Long/Short Market = Trailing) (Take Profit Limit Long/Short= NO)
- // (Stop Loss Limit Long/Short= NO) (Stop Loss Market=SI) (Trailing Stop=SI) (Stop Emergenza: NO)
- // (Max DD Concesso = 15% Media Max Drawdown 2°nda Deviazione Standard Simulazione Montecalo Python
- // (Money Management = 25% Del Capitale Tradestation)
- // (Money Management = 12,00% Del Capitale Tradingview) Preso Dal 15% Media Max Drawdown 2°nda Deviazione Standard Simulazione Montecarlo Python
- // (In Sample Dal=17/08/2017 12/06/2023) (Out Of Sample Dal13/06/2023 Al 10-08-2025)
- // (Progettatta Il=10/09/25)
- Inputs:
- input_stop_loss_percent(10),
- lunghezza_ema(130), //130 va anche bene ma è meno adatta a questo periodo attuale
- lunghezza_ema_prova(90), // Questa è quella originale prima dell'ottimizzazione Riot P1 // cancellare
- perc_apertura_minima(2),
- perc_apertura_massima(3.7),
- perc_chiusura_minima(0),
- input_trailing_stop_trigger_long(10),
- input_trailing_stop_close_long(6),
- input_trailing_stop_trigger_short(10),
- input_trailing_stop_close_short(6);
- vars:
- media_ema(0),
- media_ema_prova(0), // cancellare
- apertura_minima_long(0),
- apertura_massima_long(0),
- apertura_minima_short(0),
- apertura_massima_short(0),
- chiusura_minima(0),
- stop_loss(0),
- trailing_stop_trigger_long(0),
- trailing_stop_close_long(0),
- trailing_stop_trigger_short(0),
- trailing_stop_close_short(0);
- // Calcololo degli indicatori
- media_ema = XAverage(Close, lunghezza_ema);
- media_ema_prova = XAverage(Close, lunghezza_ema_prova); // cancellare
- apertura_minima_long = media_ema +(media_ema / 100) * perc_apertura_minima;
- apertura_massima_long = media_ema +(media_ema / 100) * perc_apertura_massima;
- apertura_minima_short = media_ema -(media_ema / 100) * perc_apertura_minima;
- apertura_massima_short = media_ema -(media_ema / 100) * perc_apertura_massima;
- chiusura_minima = media_ema -(media_ema / 100) * perc_chiusura_minima;
- stop_loss= close - ((close /100) * input_stop_loss_percent);
- trailing_stop_trigger_long = close + (close * input_trailing_stop_trigger_long)/100;
- trailing_stop_close_long = close + (close * input_trailing_stop_close_long)/100;
- trailing_stop_trigger_short = close - (close * input_trailing_stop_trigger_short)/100;
- trailing_stop_close_short = close - (close * input_trailing_stop_close_short)/100;
- // Plot
- //plot1(stop_loss, "stop_loss_long");
- plot2(apertura_minima_long, "apertura_minima_long", green);
- plot3(apertura_massima_long, "apertura_massima_long", green);
- //plot4(chiusura_minima, "chiusura_minima");
- plot5(trailing_stop_trigger_long, "trailing_stop_trigger_long", yellow);
- plot6(trailing_stop_close_long, "trailing_stop_close_long", Cyan);
- plot7(trailing_stop_trigger_short, "trailing_stop_trigger_short", yellow);
- plot8(trailing_stop_close_short, "trailing_stop_close_short",Cyan );
- plot9(media_ema, "media_ema", yellow);
- Plot10(apertura_minima_short, "apertura_minima_short", red);
- plot11(apertura_massima_short, "apertura_minima_short", red);
- //plot12(media_ema_prova, "media_ema_prova"); // cancellare
Advertisement
Add Comment
Please, Sign In to add comment