Dax 5 minute RSI extreme Strategy Feedback Please
Forums › ProRealTime English forum › ProOrder support › Dax 5 minute RSI extreme Strategy Feedback Please
- This topic has 14 replies, 7 voices, and was last updated 3 years ago by VinzentVega.
-
-
01/25/2020 at 6:57 PM #117824
Hi all,
Newbie here with creating PRT strategies and would really welcome feedback on my first effort.
I am developing a strategy for 5 minute candles on DAX.
The concept is such:
- Price makes an extreme RSI reading (Less than 20; Greater than 80)
- Price subsequently closes beyond 21ma (Above for long; below for short)
- Order is placed 2 pips beyond high/low of candle which closed beyond 21ma
- Stop is at the entry candle high/low
- Target = 2*stop distance
Code below and screenshots of results attached. Results use a risk of 1% with compounding.
Would really appreciate a critical review to determine if this is worth pursuing?
Many thanks
Chip
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677//Defining variablesma21 = average [21] (close)Shortentryprice = low - 2 //Entries taken when low of prior candle is surpassedLongentryprice = high + 2 //Entries taken when high of prior candle is surpassedmyrsi = RSI [14] (close)lowestrsi = lowest [20] (myrsi) //Sets to lowest RSI reading for past 20 candleshighestrsi = highest [20] (myrsi) //Sets to highest RSI reading for past 20 candlesMylongsetup= 1 //This variable is used to determine if a long trade is entered; if set to 0 an entry will not occurMyshortsetup = 1 //As for above for short setups//Setting stops and targetsstoplongpoints = longentryprice - lowstopshortpoints = high - shortentrypricetargetlongpoints = stoplongpoints*2 //RR for long trades can be set heretargetshortpoints = stopshortpoints*2 //RR for short trades can be set here//Detecting RSI extremeIf lowestRSI > 20 then //Cancels long entry by setting mylongsetup to 0 if lowest RSI reading for past 20 candles > 20. I.e. there has been no extrememylongsetup = 0endifIf highestrsi < 80 then //As above but for an extreme of above 80 on RSImyshortsetup = 0endif//Detecting close beyond 21If close < ma21 then //Cancels long entry if close beyond 21 hasn't occured.mylongsetup = 0endifIf close < ma21 then //As above for shortmylongsetup = 0endif//Don't take at end of the weekIf currentdayofweek = 5 AND currenttime = 215500 thenmylongsetup = 0myshortsetup = 0endif// Money ManagementCapital = 10000Risk = 0.01If mylongsetup = 1 thenstoploss = stoplongpointsendifIf myshortsetup = 1 thenstoploss = stopshortpointsendif//Calculate contractsequity = Capital + StrategyProfitmaxrisk = round(equity*Risk)PositionSize = abs(round((maxrisk/StopLoss)/PointValue)*pipsize)//Entry conditionsIF NOT LongOnMarket AND mylongsetup = 1 THENBUY positionsize lot AT longentryprice stopset stop ploss stoplongpointsset target pprofit targetlongpointsendifIF NOT shortOnMarket AND myshortsetup = 1 THENsellshort positionsize lot AT Shortentryprice stopset stop ploss stopshortpointsset target pprofit targetshortpointsendif01/25/2020 at 7:35 PM #11783001/25/2020 at 7:58 PM #117836Hey looks good esp for a first attempt and doesn’t blow the Account on OOS Test (over the 1st 100k bars provided by Francesco).
Looks like it has a bias towards a rising market, but even so it holds up (no big losses) in that downtrend end June 19 to late Aug 19. Might just need re-optimising as / when the market turns down?
I’m going to try it on my Platform
Thank You for sharing
01/25/2020 at 9:34 PM #117840Mmm … attached is what I get Lot size = 1 … and I didn’t get same as you anyway even with Lot Size same as you had it?
I can’t think why my results are different than yours? I’ve only had 2 stubby bottles of beer! 🙂
It’s always best to get a System running as best you can with Lot Size = 1 as compounding can hides problems
01/26/2020 at 12:14 AM #117844Hi @DR Chips
My initial thought is that the numbers of contracts traded are scary and looking at IG.com if you had the stomach for 100+ contracts you system would not have the margin based on the starting capital
Based on my own RSI systems I would suggest trading the EU session only as the spreads are closer along with more volume
I am currently having a play with your code but I would suggest looking at the code here: https://www.prorealcode.com/prorealtime-trading-strategies/grinder-eurusd-5-min-intraday-trading-strategy/ it is similar to yours but adds in a trend filter and is a solid basis across multiple time frames and products
Systems are always worth pursuing as producing them is always a learning experience and any system should be run on a demo account so that you can have an indication as to how it will perform in real life as opposed to a back test and have a feel for it before risking any actual cash
01/26/2020 at 1:40 AM #117846Dr Chips RSI RB Editv11234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283//UK CodeFIN 1 candle delayDEFPARAM FLATBEFORE = 080000DEFPARAM FLATAFTER = 163000//Defining variablesma21 = average [21] (close)Shortentryprice = low - 2 //Entries taken when low of prior candle is surpassedLongentryprice = high + 2 //Entries taken when high of prior candle is surpassedmyrsi = RSI [14] (close)lowestrsi = lowest [20] (myrsi) //Sets to lowest RSI reading for past 20 candleshighestrsi = highest [20] (myrsi) //Sets to highest RSI reading for past 20 candlesMylongsetup= 1 //This variable is used to determine if a long trade is entered; if set to 0 an entry will not occurMyshortsetup = 1 //As for above for short setups//Setting stops and targetsstoplongpoints = 20stopshortpoints = 10targetlongpoints = 80targetshortpoints = 20//Detecting RSI extremeIf lowestRSI > 20 then //Cancels long entry by setting mylongsetup to 0 if lowest RSI reading for past 20 candles > 20. I.e. there has been no extrememylongsetup = 0endifIf highestrsi < 80 then //As above but for an extreme of above 80 on RSImyshortsetup = 0endif//Detecting close beyond 21If close < ma21 then //Cancels long entry if close beyond 21 hasn't occured.mylongsetup = 0endifIf close [1] < ma21 then //As above for shortmyshortsetup = 0endif//Don't take at end of the weekIf currentdayofweek = 5 AND currenttime = 215500 thenmylongsetup = 0myshortsetup = 0endif// Money Management//Capital = 10000//Risk = 0.01////If mylongsetup = 1 then//stoploss = stoplongpoints//endif////If myshortsetup = 1 then//stoploss = stopshortpoints//endif//Calculate contracts//equity = Capital + StrategyProfit//maxrisk = round(equity*Risk)//PositionSize = abs(round((maxrisk/StopLoss)/PointValue)*pipsize)//Entry conditionsIF NOT LongOnMarket AND mylongsetup = 1 THENBUY 1 lot AT longentryprice stopset stop ploss stoplongpointsset target pprofit targetlongpointsendifIF NOT shortOnMarket AND myshortsetup = 1 THENsellshort 1 lot AT Shortentryprice stopset stop ploss stopshortpointsset target pprofit targetshortpointsendifHi @Dr Chips
In your original code line 38 appears to have mylongsetup repeated rather than myshortsetup
The code above is a bit over optimised but it’s nearly midnight so please forgive me
Looking at your results I have changed the system to only trade in the EU session (Lines 1+2) and worked on the stops and take profits (lines 18-21), the attachments compare the original code to the code inserted above
Besides the EU session change one thing I noticed but haven’t got into yet is the timings of the trades, if you look at the opening and closing times of the trades it appears that trade 1 will open and close either with profit or loss then the system waits 5-10 minutes and then trade 2 is placed and so on. This happens with codes that have a prevailing condition in this system the RSI property and can cause several consecutive losses
I also added a delay on line 40 of the above code to short positions
One of the things that I need to do is to put together a video of taking some code and working on it and fully testing it, if it is okay with you then I could do that for this code?
1 user thanked author for this post.
01/26/2020 at 10:59 AM #117863Morning all,
Really appreciate your comments and responses here.
Grahal – I wouldn’t know either why your results are different I’m afraid… as I said, I’m very much a newbie! So even without the beers I’m still struggling to get my head around things!!
Robo Futures Trader – thanks very much for your input on things. I’m going to take some time later to properly read through what you have done here (and do a fair amount of googling to explore further) but yes do please feel free to use as an example for a video – that would be really helpful, thank you!
Many thanks all
Chip
01/26/2020 at 11:07 AM #117864Just had a quick look re your point about the duplication on line 38 @Robo Futures Trade
Yup, this is an error! Have changed this and reposting my (now correct) original code and results below for reference.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677//Defining variablesma21 = average [21] (close)Shortentryprice = low - 2 //Entries taken when low of prior candle is surpassedLongentryprice = high + 2 //Entries taken when high of prior candle is surpassedmyrsi = RSI [14] (close)lowestrsi = lowest [20] (myrsi) //Sets to lowest RSI reading for past 20 candleshighestrsi = highest [20] (myrsi) //Sets to highest RSI reading for past 20 candlesMylongsetup= 1 //This variable is used to determine if a long trade is entered; if set to 0 an entry will not occurMyshortsetup = 1 //As for above for short setups//Setting stops and targetsstoplongpoints = longentryprice - lowstopshortpoints = high - shortentrypricetargetlongpoints = stoplongpoints*2 //RR for long trades can be set heretargetshortpoints = stopshortpoints*2 //RR for short trades can be set here//Detecting RSI extremeIf lowestRSI > 20 then //Cancels long entry by setting mylongsetup to 0 if lowest RSI reading for past 20 candles > 20. I.e. there has been no extrememylongsetup = 0endifIf highestrsi < 80 then //As above but for an extreme of above 80 on RSImyshortsetup = 0endif//Detecting close beyond 21If close < ma21 then //Cancels long entry if close beyond 21 hasn't occured.mylongsetup = 0endifIf close > ma21 then //As above for shortmyshortsetup = 0endif//Don't take at end of the weekIf currentdayofweek = 5 AND currenttime = 215500 thenmylongsetup = 0myshortsetup = 0endif// Money ManagementCapital = 10000Risk = 0.01If mylongsetup = 1 thenstoploss = stoplongpointsendifIf myshortsetup = 1 thenstoploss = stopshortpointsendif//Calculate contractsequity = Capital + StrategyProfitmaxrisk = round(equity*Risk)PositionSize = abs(round((maxrisk/StopLoss)/PointValue)*pipsize)//Entry conditionsIF NOT LongOnMarket AND mylongsetup = 1 THENBUY positionsize lot AT longentryprice stopset stop ploss stoplongpointsset target pprofit targetlongpointsendifIF NOT shortOnMarket AND myshortsetup = 1 THENsellshort positionsize lot AT Shortentryprice stopset stop ploss stopshortpointsset target pprofit targetshortpointsendif01/26/2020 at 11:55 AM #117870Why are you not showing Lot size under your equity curves?
Position size is needed else it is only half a story.
It be sooo much better if you delete the RSI Chart and add back in the positions Chart.
An average gain of £22.45 does not mean much unless we know how many open positions we need to lose sleep over!? 🙂
01/26/2020 at 3:02 PM #11789501/26/2020 at 3:52 PM #11790801/26/2020 at 10:58 PM #117962It seems like a simple strategy but in reality there are fourteen possible variables that can be optimised that cover the following areas:
- Time
- Periods for indicators
- Levels
- Order levels
- Stop loss and take profit distances
As it is on a five minute time frame that leaves us with a not very big data sample and a big possibility of curve fitting due to so many variables. I would try optimising each variable independently to see how quickly the strategy falls apart with different values for each of them and then when you spot which variables have the biggest effect then test combinations of them.
2 users thanked author for this post.
02/01/2020 at 1:19 PM #11842208/03/2020 at 10:15 AM #140713hello Dr Chips, hope you are in a good shape, how does the strategy work now? do you have any improvement for eur / usd use? cordially
08/03/2020 at 8:12 PM #140790hello Dr Chips, hope you are in a good shape, how does the strategy work now? do you have any improvement for eur / usd use? cordially
The code from the first postig doesn´t work on my desk. The result from my backtest.
-
AuthorPosts
Find exclusive trading pro-tools on