Script for automatic trading with Alerts (Use Backtest to customize your own settings) All timeframes but good results on 2H.
LG --> Long ST --> Short TS --> Trailing Stop xL --> Close Long Position xS --> Close Short Position SL --> Stop Loss
The trailing stop closes the trade if the price changes direction by a specified percentage or offset. There is no ideal distance because markets and price are always changing and we know that is impossible to exit on the top or bottom. This script interpolate the trailing Stop Offset with profit, higher profit -- > higher Trailing Stop Offset. Despite this, it's difficult to catch the price. If someone comes up with a good idea, comment, I'm happy to learn. No security() function so no repaint but has time() and can appear a warning for it.
Alerts:
'Once per bar' More profit but not confirmed alerts (10-20% fake alerts)... I like risk 'Once per bar close' Confirmed alerts (0% fake alerts)... You will sleep better
Some settings:
XBTUSD (BITMEX)
Timeframe = 2H Position Side = BOTH Source = hlc3 T3 Length = 5 T3 Volume Factor = 0.9 Sampling Period = 16 Range Multiplier = 1.3 ADX lenght = 10 ADX Threshold = 20 SAR start = 0.07 SAR inc = 0.02 SAR max = 0.15 Pyramiding = 10 Trailing Stop Activation % = 0.5 Trailing Stop Offset % (when profit=0.5 %) = 0.35 Trailing Stop Offset % (when profit=10 %) = 1.5 Stop Loss = 3.5 Tics/Pips Correction = 10 Initial Capital = 1000 Quantity = 100 % Commission value = 0.075 %
ETHUSD (BITMEX)
Timeframe = 2H Position Side = BOTH Source = hlc3 T3 Length = 5 T3 Volume Factor = 0.7 Sampling Period = 13 Range Multiplier = 0.9 ADX lenght = 11 ADX Threshold = 19 SAR start = 0.06 SAR inc = 0.03 SAR max = 0.15 Pyramiding = 10 Trailing Stop Activation % = 0.5 Trailing Stop Offset % (when profit=0.5 %) = 0.35 Trailing Stop Offset % (when profit=10 %) = 1.5 Stop Loss = 4 Tics/Pips Correction = 100 Initial Capital = 1000 Quantity = 100 % Commission value = 0.075 %
BNBUSDT (BINANCE)
Timeframe = 2H Position Side = LONG Source = hlc3 T3 Length = 3 T3 Volume Factor = 1.6 Sampling Period = 17 Range Multiplier = 1.3 ADX lenght = 5 ADX Threshold = 18 SAR start = 0.04 SAR inc = 0.03 SAR max = 0.25 Pyramiding = 10 Trailing Stop Activation % = 0.5 Trailing Stop Offset % (when profit=0.5 %) = 0.4 Trailing Stop Offset % (when profit=10 %) = 1.5 Stop Loss == false Tics/Pips Correction = 10000 Initial Capital = 1000 Quantity = 100 % Commission value = 0.075 %
LTCUSDT (BINANCE)
Timeframe = 2H Position Side = LONG Source = hlc3 T3 Length = 3 T3 Volume Factor = 1.6 Sampling Period = 11 Range Multiplier = 1.1 ADX lenght = 6 ADX Threshold = 22 SAR start = 0.07 SAR inc = 0.04 SAR max = 0.15 Pyramiding = 10 Trailing Stop Activation % = 0.5 Trailing Stop Offset % (when profit=0.5 %) = 0.4 Trailing Stop Offset % (when profit=10 %) = 1.5 Stop Loss == false Tics/Pips Correction = 100 Initial Capital = 1000 Quantity = 100 % Commission value = 0.075 %
TRXUSDT (BINANCE)
Timeframe = 2H Position Side = LONG Source = hlc3 T3 Length = 3 T3 Volume Factor = 0.9 Sampling Period = 8 Range Multiplier = 1.2 ADX lenght = 4 ADX Threshold = 22 SAR start = 0.07 SAR inc = 0.04 SAR max = 0.15 Pyramiding = 10 Trailing Stop Activation % = 0.5 Trailing Stop Offset % (when profit=0.5 %) = 0.4 Trailing Stop Offset % (when profit=10 %) = 1.5 Stop Loss == false Tics/Pips Correction = 100000 Initial Capital = 1000 Quantity = 100 % Commission value = 0.075 %
NAS100 (OANDA)
Timeframe = 2H Position Side = BOTH Source = hlc3 T3 Length = 3 T3 Volume Factor = 1 Sampling Period = 12 Range Multiplier = 1.3 ADX lenght = 18 ADX Threshold = 21 SAR start = 0.08 SAR inc = 0.06 SAR max = 0.25 Pyramiding = 10 Trailing Stop Activation % = 0.2 Trailing Stop Offset % (when profit=0.5 %) = 0.15 Trailing Stop Offset % (when profit=10 %) = 1 Stop Loss = 1.8 Tics/Pips Correction = 10 Initial Capital = 1000 Quantity = 3 contracts Commission value = 0.2 USD per contract
NATGAS(OANDA)
Timeframe = 2H Position Side = BOTH Source = hlc3 T3 Length = 3 T3 Volume Factor = 1 Sampling Period = 18 Range Multiplier = 1.1 ADX lenght = 10 ADX Threshold = 17 SAR start = 0.1 SAR inc = 0.04 SAR max = 0.35 Pyramiding = 10 Trailing Stop Activation % = 0.2 Trailing Stop Offset % (when profit=0.5 %) = 0.15 Trailing Stop Offset % (when profit=10 %) = 1 Stop Loss = 1.6 Tics/Pips Correction = 1000 Initial Capital = 1000 Quantity = 4500 contracts Commission value = 0.002 USD per contract
SPX500 (OANDA)
Timeframe = 2H Position Side = BOTH Source = hlc3 T3 Length = 3 T3 Volume Factor = 0.6 Sampling Period = 14 Range Multiplier = 1.3 ADX lenght = 12 ADX Threshold = 17 SAR start = 0.23 SAR inc = 0.05 SAR max = 0.2 Pyramiding = 10 Trailing Stop Activation % = 0.15 Trailing Stop Offset % (when profit=0.5 %) = 0.1 Trailing Stop Offset % (when profit=10 %) = 0.75 Stop Loss = 1.5 Tics/Pips Correction = 10 Initial Capital = 1000 Quantity = 8 contracts Commission value = 0.2 USD per contract
US30 (OANDA)
Timeframe = 2H Position Side = BOTH Source = hlc3 T3 Length = 4 T3 Volume Factor = 0.9 Sampling Period = 11 Range Multiplier = 1.1 ADX lenght = 16 ADX Threshold = 24 SAR start = 0.08 SAR inc = 0.03 SAR max = 0.05 Pyramiding = 10 Trailing Stop Activation % = 0.15 Trailing Stop Offset % (when profit=0.5 %) = 0.1 Trailing Stop Offset % (when profit=10 %) = 0.75 Stop Loss = 1.5 Tics/Pips Correction = 10 Initial Capital = 1000 Quantity = 1 contracts Commission value = 1.5 USD per contract
WHEAT (OANDA)
Timeframe = 2H Position Side = BOTH Source = hlc3 T3 Length = 3 T3 Volume Factor = 1.1 Sampling Period = 12 Range Multiplier = 1 ADX lenght = 13 ADX Threshold = 21 SAR start = 0.07 SAR inc = 0.05 SAR max = 0.15 Pyramiding = 10 Trailing Stop Activation % = 0.2 Trailing Stop Offset % (when profit=0.5 %) = 0.15 Trailing Stop Offset % (when profit=10 %) = 1 Stop Loss = 2.5 Tics/Pips Correction = 1000 Initial Capital = 1000 Quantity = 2500 contracts Commission value = 0.003 USD per contract
Release Notes
⋅
Now the script is 75% shorter and the Pyramiding is infinite. Added a time delay for Trailing Stop alerts to try to catch the price at top/bottom...
I been pressing F5 for the past few days :) thanks again bro
chiyu98107
⋅
can you share the script? I really like it
biswad
⋅
In there any way you could be kind enough to share the script so that we can use for study purpose please ...
dilace
⋅
muy prometedor, lo mezclare con mi actual estrategia, te comentare, gracias por compartir :)
UnknownUnicorn2151907
⋅
@dilace, Hola, no hay de que, gracias a ti... Ahora el script es un bebe, ya lo iremos mejorando poco a poco.
Aprovecho y comparto un ejemplo de settings para un timeframe de 15 m:
ETHUSD (BITMEX)
Timeframe = 15 m
Position Side = BOTH
Source = hlc3
T3 Length = 35
T3 Volume Factor = 0.7
Sampling Period = 25
Range Multiplier = 3
ADX lenght = 11
ADX Threshold = 20
SAR start = 0.07
SAR inc = 0.08
SAR max = 0.15
Pyramiding = 10
Trailing Stop Activation % = 0.5
Trailing Stop Offset % (when profit=0.5 %) = 0.3
Trailing Stop Offset % (when profit=10 %) = 1.5
Stop Loss = 3.6
Tics/Pips Correction = 100
Initial Capital = 1000
Quantity = 100 %
Commission value = 0.075 % Con ordenes limit en BITMEX solo para las entradas sería --> Commission value = 0.025 %