Hi,
I want to backtest a strategy were I buy at RSI>30 and sell (not going short) after 1 week. I’m having trouble finding out how to define the sell contidion. Is it possible to set this condition in “simplified creation” tab? Or do i have to code it?
WingParticipant
Veteran
Try this on for example the 30m timeframe:
MyRSI=RSI[14]
once DayToSell=10
once TimeToSell=000000
if MyRSI>30 and MyRSI[1]<30 and onmarket=0 then
buy 1 lot at market
DayToSell=dayofweek
TimeToSell=time
endif
if dayofweek=DayToSell and time<TimeToSell and time>TimeToSell-10000
sell 1 lot at market
endif
Does something like that work?
Thank you for your help. Unfortunately, the code has an error in line 11.
Add the word THEN in the end of the line 11.