Hi,
I have been looking but I can find a trailing stop loss that follows a chosen moving average. Is there such a thing?
thanks in advance
Jack
I don’t know, but this is an example to exit a LONG trade based on a MA:
IF LongOnMarket THEN
SELL AT average[20](close) STOP
ENDIF
If you are LONG you can assume your price is ABOVE that average, so when it’s touched on a retracement or inversion, your trade will be exited.
Roberto – your code needs to also have the sell stop order at the time of entry otherwise the order has to wait one candle before it is placed and your stop loss is not in place for one whole candle.
if (your conditions) then
buy 1 contract at market
SELL AT average[20](close) STOP
endif
IF LongOnMarket THEN
SELL AT average[20](close) STOP
ENDIF
Thank you so much! Both of you, I really appreciate it.