My backtest looks different. You have some attitude different.
Did you change the time setting?
I don´t get how to change the time setting unfortunately…
IF Time >= h1 AND Time <= h2 THEN
Shouldn´t there be h1 = 010000 somewhere for example?
Did you look in the variables settings in the Optimiser?
You need None’s time settings (for UK ) to read as the equivalent / same time in your country.
Aah didn´t Think about that it was variables in the optimizer…
Why is nobody telling me that this strategy might work well in some indices as well? 😉
there’s an error in the code that i posted, this should work slightly better
Do u find this values good?
Attached backtest with some modifications. Test period from 1/1018 – 3/2021
Thank you for your interest. But I’m not sure if this version is over-optimized. Tonight I will test over all 200000bars. The good thing about the original version is that it has consistently won over the years.
Possibility of over-optimizitaion is always omnipresent. I always finish my backtests 3 or 4 months before the current date. And then I check if the algo works under non-optimized conditions.
From the performance data and the small drawdown, I would prefer my V2 from post # 173131. Over 200000bars great, but over 1000000bars not so good. In terms of durability, the original version and the version by Yet are arguably the best.
With a few modifications this potentially works quite well on the US Crude market also. My PRT/IG only has price data as far back as February 2020 however so not sure how well it does in a longer backtest.
(Edit – Times in the code are London time)
//-------------------------------------------------------------------------
// Hauptcode : #KISS RSI5 US Crude M15
//Spread = 2.8
//-------------------------------------------------------------------------
DEFPARAM CumulateOrders = false
defparam preloadbars = 2000
Nlong = 1
Nshort = 1
MAXSHARES = abs(COUNTOFPOSITION) <= 1
//EMA-Trend
EMA1 = ExponentialAverage[60](close)
EMA3 = ExponentialAverage[60](close)
EMAlong = close > EMA3
EMAshort = close < EMA3
steigunglong = EMA1 > EMA1[1]
steigungshort = EMA1 < EMA1[1]
myATR = AverageTrueRange[50](close)
//RSI5-Eingang
myRSI = RSI[5](close)
rsilong = (myRSI[1] > 35) and (myRSI < 35)
rsishort = (myRSI[1] < 70) and (myRSI > 70)
rsilongraus = myRSI > 80
rsishortraus = myRSI < 15
IF Time >= 000000 AND Time <= 210000 THEN
IF rsilong and EMAlong and steigunglong and MAXSHARES THEN
BUY Nlong shares at market
SET STOP LOSS myATR*7
Set target profit myATR*7
ENDIF
IF rsishort and EMAshort and steigungshort and MAXSHARES THEN
sellshort Nshort shares at market
SET STOP LOSS myATR*8
Set target profit myATR*8
ENDIF
endif
if longonmarket and rsilongraus then
sell at market
endif
if shortonmarket and rsishortraus then
exitshort at market
endif
if time = 210000 and dayofweek = 5 then
sell at market
EXITSHORT at market
endif
//************************************************************************
//trailing stop function
trailingstartL = 30 // trailing will start @trailinstart points profit
trailingstartS = 35 // trailing will start @trailinstart points profit
trailingstepL = 5 // trailing step to move the "stoploss"
trailingstepS = 5 // trailing step to move the "stoploss"
//reset the stoploss value
IF NOT ONMARKET THEN
newSL=0
ENDIF
//manage long positions
IF LONGONMARKET THEN
//first move (breakeven)
IF newSL=0 AND close-tradeprice(1)>=trailingstartL*pipsize THEN
newSL = tradeprice(1)+trailingstepL*pipsize
ENDIF
//next moves
IF newSL>0 AND close-newSL>=trailingstepL*pipsize THEN
newSL = newSL+trailingstepL*pipsize
ENDIF
ENDIF
//manage short positions
IF SHORTONMARKET THEN
//first move (breakeven)
IF newSL=0 AND tradeprice(1)-close>=trailingstartS*pipsize THEN
newSL = tradeprice(1)-trailingstepS*pipsize
ENDIF
//next moves
IF newSL>0 AND newSL-close>=trailingstepS*pipsize THEN
newSL = newSL-trailingstepS*pipsize
ENDIF
ENDIF
//stop order to exit the positions
IF newSL>0 THEN
SELL AT newSL STOP
EXITSHORT AT newSL STOP
ENDIF
Do you have a picture of the backtest? I don’t have a laptop here to look at your strategy.
Backtest with £1/point on UK spread bet demo account.
Feb 2020 is as far as PRT will let me go on US Crude 15m unfortunately.
That doesn’t look bad. Start in demo and see if it works that well.