Hi guys
Please can someone help with this bit of coding I’ve used something similar for breakeven but wanted to try something that would exit long position if the price started to retrace after so many bars but whilst still being in profit.
Thanks in advance.
Hi!
with this code you can control the number of bars inside the trade:
once n=0
if not onmarket and close crosses over average[20](close) then
buy 1 contract at market
endif
if onmarket then
n=n+1
if n>=30 then
sell at market
n=0
endif
endif
If you want also be in profit>0 you can add this:
if n>=30 and positionperf>0 then
sell at market
n=0
endif