Dax 5 minute RSI extreme Strategy Feedback Please

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #117824 quote
    DrChips
    Participant
    New

    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:

    1. Price makes an extreme RSI reading (Less than 20; Greater than 80)
    2. Price subsequently closes beyond 21ma (Above for long; below for short)
    3. Order is placed 2 pips beyond high/low of candle which closed beyond 21ma
    4. Stop is at the entry candle high/low
    5. 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

    //Defining variables
    ma21 = average [21] (close)
    Shortentryprice = low - 2 //Entries taken when low of prior candle is surpassed
    Longentryprice = high + 2 //Entries taken when high of prior candle is surpassed
    myrsi = RSI [14] (close)
    lowestrsi = lowest [20] (myrsi) //Sets to lowest RSI reading for past 20 candles
    highestrsi = highest [20] (myrsi) //Sets to highest RSI reading for past 20 candles
    
    
    Mylongsetup= 1 //This variable is used to determine if a long trade is entered; if set to 0 an entry will not occur
    Myshortsetup = 1 //As for above for short setups
    
    //Setting stops and targets
    stoplongpoints = longentryprice - low
    stopshortpoints = high - shortentryprice
    targetlongpoints = stoplongpoints*2 //RR for long trades can be set here
    targetshortpoints = stopshortpoints*2 //RR for short trades can be set here
    
    
    //Detecting RSI extreme
    
    If 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 extreme
    mylongsetup = 0
    endif
    
    If highestrsi < 80 then //As above but for an extreme of above 80 on RSI
    myshortsetup = 0
    endif
    
    //Detecting close beyond 21
    
    If close < ma21 then //Cancels long entry if close beyond 21 hasn't occured.
    mylongsetup = 0
    endif
    
    If close < ma21 then //As above for short
    mylongsetup = 0
    endif
    
    //Don't take at end of the week
    If currentdayofweek = 5 AND currenttime = 215500 then
    mylongsetup = 0
    myshortsetup = 0
    endif
    
    
    // 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 conditions
    
    IF NOT LongOnMarket AND mylongsetup = 1 THEN
    BUY positionsize lot AT longentryprice stop
    set stop ploss stoplongpoints
    set target pprofit targetlongpoints
    endif
    
    IF NOT shortOnMarket AND myshortsetup = 1 THEN
    sellshort positionsize lot AT Shortentryprice stop
    set stop ploss stopshortpoints
    set target pprofit targetshortpoints
    endif
    
     
    
    Screenshot-2020-01-25-at-17.53.41.png Screenshot-2020-01-25-at-17.53.41.png Screenshot-2020-01-25-at-17.53.58.png Screenshot-2020-01-25-at-17.53.58.png Screenshot-2020-01-25-at-17.54.06.png Screenshot-2020-01-25-at-17.54.06.png
    #117830 quote
    Francesco
    Participant
    Veteran

    200k backtest, take a look.

    1-4.jpg 1-4.jpg 2-4.jpg 2-4.jpg
    #117836 quote
    GraHal
    Participant
    Master

    Hey 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

    #117840 quote
    GraHal
    Participant
    Master

    Mmm … 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

    Dr.jpg Dr.jpg Dr-2.jpg Dr-2.jpg
    #117844 quote
    deletedaccount100622
    Participant
    New

    Hi @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

    #117846 quote
    deletedaccount100622
    Participant
    New
    //UK CodeFIN 1 candle delay
    DEFPARAM FLATBEFORE = 080000
    DEFPARAM FLATAFTER = 163000
    
    
    //Defining variables
    ma21 = average [21] (close)
    Shortentryprice = low - 2 //Entries taken when low of prior candle is surpassed
    Longentryprice = high + 2 //Entries taken when high of prior candle is surpassed
    myrsi = RSI [14] (close)
    lowestrsi = lowest [20] (myrsi) //Sets to lowest RSI reading for past 20 candles
    highestrsi = highest [20] (myrsi) //Sets to highest RSI reading for past 20 candles
    
    
     
    Mylongsetup= 1 //This variable is used to determine if a long trade is entered; if set to 0 an entry will not occur
    Myshortsetup = 1 //As for above for short setups
     
    //Setting stops and targets
    stoplongpoints = 20
    stopshortpoints = 10
    targetlongpoints = 80
    targetshortpoints = 20
     
     
    //Detecting RSI extreme
     
    If 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 extreme
    mylongsetup = 0
    endif
     
    If highestrsi < 80 then //As above but for an extreme of above 80 on RSI
    myshortsetup = 0
    endif
     
    //Detecting close beyond 21
     
    If close < ma21 then //Cancels long entry if close beyond 21 hasn't occured.
    mylongsetup = 0
    endif
     
    If close [1] < ma21 then //As above for short
    myshortsetup = 0
    endif
     
    //Don't take at end of the week
    If currentdayofweek = 5 AND currenttime = 215500 then
    mylongsetup = 0
    myshortsetup = 0
    endif
     
     
    // 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 conditions
     
    IF NOT LongOnMarket AND mylongsetup = 1 THEN
    BUY 1 lot AT longentryprice stop
    set stop ploss stoplongpoints
    set target pprofit targetlongpoints
    endif
     
    IF NOT shortOnMarket AND myshortsetup = 1 THEN
    sellshort 1 lot AT Shortentryprice stop
    set stop ploss stopshortpoints
    set target pprofit targetshortpoints
    endif

     

    Hi @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?

    GraHal thanked this post
    Systems.png Systems.png Graphs.png Graphs.png Closed-Trades.png Closed-Trades.png
    #117863 quote
    DrChips
    Participant
    New

    Morning 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

    #117864 quote
    DrChips
    Participant
    New

    Just 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.

    //Defining variables
    ma21 = average [21] (close)
    Shortentryprice = low - 2 //Entries taken when low of prior candle is surpassed
    Longentryprice = high + 2 //Entries taken when high of prior candle is surpassed
    myrsi = RSI [14] (close)
    lowestrsi = lowest [20] (myrsi) //Sets to lowest RSI reading for past 20 candles
    highestrsi = highest [20] (myrsi) //Sets to highest RSI reading for past 20 candles
    
    
    Mylongsetup= 1 //This variable is used to determine if a long trade is entered; if set to 0 an entry will not occur
    Myshortsetup = 1 //As for above for short setups
    
    //Setting stops and targets
    stoplongpoints = longentryprice - low
    stopshortpoints = high - shortentryprice
    targetlongpoints = stoplongpoints*2 //RR for long trades can be set here
    targetshortpoints = stopshortpoints*2 //RR for short trades can be set here
    
    
    //Detecting RSI extreme
    
    If 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 extreme
    mylongsetup = 0
    endif
    
    If highestrsi < 80 then //As above but for an extreme of above 80 on RSI
    myshortsetup = 0
    endif
    
    //Detecting close beyond 21
    
    If close < ma21 then //Cancels long entry if close beyond 21 hasn't occured.
    mylongsetup = 0
    endif
    
    If close > ma21 then //As above for short
    myshortsetup = 0
    endif
    
    //Don't take at end of the week
    If currentdayofweek = 5 AND currenttime = 215500 then
    mylongsetup = 0
    myshortsetup = 0
    endif
    
    
    // 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 conditions
    
    IF NOT LongOnMarket AND mylongsetup = 1 THEN
    BUY positionsize lot AT longentryprice stop
    set stop ploss stoplongpoints
    set target pprofit targetlongpoints
    endif
    
    IF NOT shortOnMarket AND myshortsetup = 1 THEN
    sellshort positionsize lot AT Shortentryprice stop
    set stop ploss stopshortpoints
    set target pprofit targetshortpoints
    endif
    
     
    
    Screenshot-2020-01-26-at-10.03.47.png Screenshot-2020-01-26-at-10.03.47.png Screenshot-2020-01-26-at-10.03.58.png Screenshot-2020-01-26-at-10.03.58.png Screenshot-2020-01-26-at-10.04.05.png Screenshot-2020-01-26-at-10.04.05.png
    #117870 quote
    GraHal
    Participant
    Master

    Why 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!? 🙂

    #117895 quote
    DrChips
    Participant
    New
    #117908 quote
    GraHal
    Participant
    Master

    Yeah that’s it thank you.

    We can now see how much stress there would be to make £10K ish profit (£7.6k to date) over 18 months.

    #117962 quote
    Vonasi
    Moderator
    Master

    It 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.

    DrChips and thanked this post
    #118422 quote
    DrChips
    Participant
    New

    Thanks for the advice @vonasi

    #140713 quote
    bertrandpinoy
    Participant
    Veteran

    hello 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

    #140790 quote
    VinzentVega
    Participant
    Veteran

    hello 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.

    müll.png müll.png
Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.

Dax 5 minute RSI extreme Strategy Feedback Please


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
DrChips @drchips Participant
Summary

This topic contains 14 replies,
has 7 voices, and was last updated by VinzentVega
5 years, 6 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 01/25/2020
Status: Active
Attachments: 17 files
Logo Logo
Loading...