Optimised Triple EMA cross strategy which checks for bullish or bearish trend for buying or shorting.
I am also using the RSI criteria to sell or buy contracts when oversold or overbought.
Replace x,y,z values with EMA values which work best for your instrument.
This is a winner on FTSE 100 stocks with over 70% winnings with only £500 account balance
This is a simple but effective program written by me as a newbie. Feel free to use it and feedback with any improvements.
Code is not available, probably you protected it during the export from the platform.
Please write it here throguh the “Insert PRT Code” option, and tell us on which timeframe should it work on.
// Triple EMA RSI Optimised
//Naveen Reddy Ala
//Optimised Triple MA Crossing
//Trend Following
//FTSE 100(UKX) 15M Recommended Values of x,y,z -
//Gainers - (7,49,55)
//Winners (7,50,55)
//Gainer & Winner - (9,39,55)
//Favourites - 7,48,55
// Spread 2
amount=1
//x=9
//y=39
//z=55
//BUY LONG
indicator1 = exponentialAverage[x](close)
indicator2 = exponentialAverage[y](close)
trendEMA =exponentialAverage[z](close)
bullish = indicator1 crosses over trendEMA
bearish = indicator1 crosses under trendEMA
myRSI = RSI[14](close)
SmoothRSI = Average[10](myRSI)
myRSI = RSI[14](close)
SmoothRSI = Average[10](myRSI)
overbought = SmoothRSI >= 90
oversold = SmoothRSI <= 15
//
c1 = (indicator1 crosses over indicator2)
IF c1 THEN
IF bullish then
BUY amount shares AT MARKET nextbaropen
ENDIF
ENDIF
If LONGONMARKET and overbought then
SELL AT MARKET nextbaropen
ENDIF
//SELL LONG
indicator3 = exponentialAverage[x](close)
indicator4 = exponentialAverage[y](close)
trendEMA =exponentialAverage[z](close)
bullish = indicator1 crosses over trendEMA
bearish = indicator1 crosses under trendEMA
c2 = (indicator3 CROSSES UNDER indicator4)
IF c2 THEN
IF bearish then
SELL AT MARKET nextbaropen
ENDIF
ENDIF
//SELL SHORT
indicator5 = exponentialAverage[x](close)
indicator6 = exponentialAverage[y](close)
trendEMA =exponentialAverage[z](close)
bullish = indicator1 crosses over trendEMA
bearish = indicator1 crosses under trendEMA
c3 = (indicator5 CROSSES UNDER indicator6)
IF c3 THEN
IF bearish then
SELLSHORT amount shares AT MARKET nextbaropen
ENDIF
ENDIF
//Exit SHORT
indicator7 = exponentialAverage[x](close)
indicator8 = exponentialAverage[y](close)
trendEMA =exponentialAverage[z](close)
bullish = indicator1 crosses over trendEMA
bearish = indicator1 crosses under trendEMA
c4 = (indicator7 CROSSES OVER indicator8)
IF c4 THEN
IF bullish then
EXITSHORT AT MARKET nextbaropen
ENDIF
ENDIF
IF SHORTONMARKET and oversold then
EXITSHORT AT MARKET
ENDIF
//SET STOP %LOSS 20
//SET TARGET pPROFIT 200
Thank you boonet for your contribution. It’ s a good start
A couple of suggestions:
- performance looks extremely high due to an insufficient initial Capital, €500 is not enough for a drawdown of €800 (+ margin requirements), 5K€ would be a better choice (and balance performance will be ten times less)
- backtest period is so small, try using 100K units
Moreover, did you select the tick-by-tick mode?
Very bad on 200k; you overoptimized the system on a very short backtest time range and an highly ruinous strategy results
Use Out Of Sample validation by using the walk forward analysis tool available in the optimization window, it will surely be an eye opener for you about what is overfitting.
Yes, I ran the test using the tick-by-tick mode.