DI TEMA Trendfollowing strategy on DAX 5 min

DI TEMA Trendfollowing strategy on DAX 5 min

Please find below a simple strategy based on a combination of the DI and TEMA indicators.

It performs quite well on the DAX 5 minutes (7:00-22:00 trading), for 100.000 bars, spread 5 pips.

Conditions to OPEN positions (see settings in the code)

1 TEMA trend turn into positive (for long) or turns into negative (for short)

2 the DI increases, but starts from below zero (Long) or decreases, but starts from above zero (short)

The only CLOSE conditions are  a Trailing stop loss, whereby the Trailing stop is reduced after 12 trading bars.

I tried it on several indices in different timeframes, I only got good results for the DAX, 5 minutes bar.

Disadvantage of this strategy is the long TTM, Time in the Market, of at least 65 %, obviously also overnight.

As a spread I have taken into account 5 pips, which should include 3 pips for interest to be paid (estimation 4% x exposure 12.000 Euro for 1 contract x 65% in the market / 120 trades per year)

This strategy requires a bit different settings for 2019 alone (for better results) compared to the settings set in the code for the whole period of 100.000 bars. I am (obviously!) looking for automated setting adjustments during different structures of market movements, any suggestions are more then welcome.

Any suggestions for improvement welcome !

Share this

Risk disclosure:

No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.

ProRealTime ITF files and other attachments : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

  1. fatcat • 05/10/2019 #

    Thanks Jan. But unfortunately I cannot confirm your backtesting results! Much worse!

  2. Jan Wind • 05/10/2019 #

    Hallo Fatcat,

    1. Most important: Did you set the trading hours to 7:00 to 22:00 CET, not including the nightly hours ? (Dutch/German time, UK time one hour earlier)
    Go to Options –> Platform Options –> Time Zones and Trading Hours –> (Adjust) trading hours

    2. The results shown are based on a IS 66% / OOS 34%, you can simulate this with varying the TEMA variable (28/30). The results IS/OOS are better than non IS/OOS testing, with the same variable settings, which is weird (I would expect the same results for running the code for 100.000 bars with or without running an IS/OOS, if the only optimised variable TEMA appears to be 28 in both runs)
    Maybe someone can explain or have experienced the same thing ?

    3. The results from half March till May 2019 are not that good, which negatively influence the performance

    Hope it helps you further
    KR Jan

  3. fatcat • 05/10/2019 #

    Sorry, but not working with trading hours 07:00 – 22:00 CET either. Are you sure it is exactly the code matching the results? Can anybody confirm the trading results? Thx!

    • Jan Wind • 05/10/2019 #

      fatcat,
      sorry to hear. Today I did run the code for 100.000 bars (from 17 dec 2017 till 31 may 2019) with no IS/OOS , just run the code and the results are OK

      1 Euro contract on the DAX, with a spread of 5 (!) points to cover the spread plus interest costs for positions overnight
      Period 13 dec 2017 till 31 may 2019
      Exposure +/- 12.000 Euro (1 Euro Dax contract)
      Total Gain 3.566 Euro
      Winning 63%
      Gain/Loss 1,46
      TTM 64%
      Transactions 167

      The last 5 months are showing negative results, however the last trades are winning again.

      Not sure why it does not work with you

      Again I want to mention that Walk Forward (IS/OOS) result with exactly the same setting give much better result, which is WEIRD (4.302 Euro instead of 3.566 Euro)
      I only vary the TEMA value with a variable tt, which can have the value 28 and 29, and run an IS/OOS with 66% IS 34% OOS (just 1 Walk Forward), with appears an optimal setting of TEMA of 28
      KR Jan

  4. nfulcher • 05/10/2019 #

    Please could someone explain how the following code is calculated:-

    iDI = TEMA[3](DI[DI2](close)) //default TEMA 14

  5. oakenstream • 05/10/2019 #

    Jan, I find sometimes that the priceexit variable is never set. It seems to happen when the price immediately goes the wrong way, in my cases always in a short. I cant figure it out, any ideas?

    if tradeprice(1)-MINPRICE >= Factor * trailingstop*pointsize then //if the MFE is higher than the trailingstop then
    priceexit = MINPRICE + Factor * trailingstop*pointsize //set the exit price at the MFE + trailing stop price level
    endif

    ..I tried to use the add code button but it failed for some reason.

  6. Matt66612 • 05/10/2019 #

    I do not understand the first time I launch the backtest I got the same result as you.
    but after impossible to find the same result on the other backtest

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar
Related users ' posts
Gordon101 Hi when I added your Guppy indicator to my chart it went below the chart beside the oscilla...
Nicolas Add it on the price by using the wrench located on the left upper side of your price chart.
Gordon101 Thanks Nicolas, worked a treat.
Geronima Ortiz I watched the video three times, but I can not put the npips parameter as a variable. I do...
Geronima Ortiz I think the video is for an old version of prorealtime, the images do not correspond at all ...
Nicolas indicator1 = CALL “PRC_StopReversal”[npips, 1] and define npips in the optimization window ...
dertopen HI Wwhy you said avoiding bear market? Don't you think that we can use this code for short...
maurizio dove si trova lo screener?
macdopa Thanks...
Caribeengeek Bonjour j’avais vu que vous proposiez d’écrire des codes pour ceux qui s’y connaisse pas Mai...
Caribeengeek Les devises unité
Nicolas Merci d'utiliser le forum pour les demandes de programmation personnalisée
Actabi Thank you ! Have you realised your "next step" ?
Jessar guten Tag, gibt es bereits die Aktualisierte Datei?
Per Inge Gents - An update - I have been studying various trading approaches, as this one that is bas...
juanj This gets me thinking about creating a strategy on the 5min timeframe that only takes trades...
GraHal I noted above does okay on DAX 10 min with even a reduction to 30 of the Stop Loss. I've s...
Kris75 Hi Grahal, What about making the same great work you did with the snipet on google doc but...
Gianluca thank you very nice screener
jebus89 Big thanks for sharing this :) Seems to work as expected, good stuff.
styrke Hello Nicolas, Nice screener, I appreciate the way you always try to condense at maximum th...
Nicolas There's no particular reason. RSI is widely use with its default period and results seems re...
Vonasi I noticed a couple of typo errors in the code. The list of variables lines 4 to 11 should be...
Genotik Thank you for your important contribution this week which is much appreciated! Happy New Yea...
Vonasi No problem. I hope they are useful to someone. Happy and hopefully prosperous New Year to y...
DarioMazza Hi Vonasi, i have a question for you, the comand "pricetype" where did you found it in the ...
Vonasi PriceType is just a variable that I use. The value decides what type of price is used in the...
Vonasi I noticed a couple of typo errors in the code. The list of variables lines 4 to 11 should be...
GraHal Please forgive the daft question, but why is 3-bars-trailing-stop-williams-3.itf included a...
Kris75 Hi, Seems great but what would be the code for a stock ? Thanks, Chirs
oakenstream Paul, what is the best way in your opinion to know if I have over optimized?
bazilou pouvez expliquer donchian bias merci
edocasa CIAO , SCUSA SE TI CONTATTO,VOLEVO SAPERE SE SEI UN PROGRAMMATORE,NELCASO SE SARESTI DI...
gabri Non sono un genio ma so fare qualcosa. Posso provare ad aiutarti ma se e' troppo complicato ...
WarningTrading Comment peut on la comparer ? comme ceci ? cela ne me donne plus le message d'erreur manque...
sally31120 Bonjour, je n'arrive pas à créer ce screener close > supertrend extended2[1] la réponse...
Nicolas voir ce sujet pour un screener basé sur Supertrend Extended: https://www.prorealcode.com/top...
Nicolas https://www.prorealcode.com/topic/ayuda-screener-indicador-perfect-trend-line/#post-51291
Manu L. Bonjour Nicolas, suite a une de mes precedentes demande dans le forum indicateur, j'ai touv...
AntoGH C'est selon moi le meilleur indicateur, que j'ai vu, si vous trouvez mieux dîtes moi car dif...
rafadonl2 is not taken into account in the procedure. It considers only if it is a doji or when candle...
Guibourse Okay thanks, just a question : how do you plot your two lines in the same window as price ? ...
rafadonl2 sorry, I don't understand your question. Indicator draws Heikin Ashi candle, not price cand...
Nicolas Your PRT version is inferior to 10.3? So the code in its default state is not compatible. A ...
Mbulelo Hi Nicolas Hope all is well your side, do you have a specific strategy for the MFT Swing ...
Nicolas No I don't, try to make it on your own, or ask in forums (follow the posting rules please).
Mr_Balagan Bonjour, j'ai quelques questions concernant cette combinaison d'indicateurs qui à l'air inté...
larouedegann STE : Fonction statistique "erreur standard" de séries temporelles de N périodes pour le pri...
Mr_Balagan Merci pour ces informations précieuses larouedegann. J'y vois plus clair. Encore joli boulot
JR1976 Dear Mike , your screener seem interest and simple... Do you try to envelope an automat...
Player Hi Mike, What is the name of the indicator just under the MMA ? Thanks Regards Marc
Igor Hi Mike, What is the name of the indicator just under the MMA ? Thanks Regards

Top