Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Il trading system completo - Study Swing-Trend-Trailing (Strategia Trend Following Con Swing Di Posizione) - parte 2
- // (Exchange= FTX) (Sottostante ETH-PERP) (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= -10%) (Stop Loss Market Long/Short= SI) (Trailing Stop=SI) (Stop Emergenza= NO)
- // (Rischio Operazione 2% Perdita Media)
- // (In Sample Dal=17/08/2017 Al 17/10/2020) (Out Of Sample Dal=18/10/2020 Al 15/03/2021)
- Inputs:
- input_stop_loss_percent(10),
- lunghezza_ema(90),
- perc_apertura_minima(2),
- perc_apertura_massima(4),
- perc_chiusura_minima(0),
- input_trailing_stop_trigger_long(12),
- input_trailing_stop_close_long(6),
- input_trailing_stop_trigger_short(12),
- input_trailing_stop_close_short(6);
- vars:
- media_ema(0),
- apertura_minima(0),
- apertura_massima(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);
- apertura_minima = media_ema +(media_ema / 100) * perc_apertura_minima;
- apertura_massima = 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, "apertura_minima");
- plot3(apertura_massima, "apertura_massima");
- //plot4(chiusura_minima, "chiusura_minima");
- plot5(trailing_stop_trigger_long, "trailing_stop_trigger_long");
- plot6(trailing_stop_close_long, "trailing_stop_close_long");
- plot7(trailing_stop_trigger_short, "trailing_stop_trigger_short");
- plot8(trailing_stop_close_short, "trailing_stop_close_short");
- plot9(media_ema, "media_ema");
Add Comment
Please, Sign In to add comment