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
Byggtrader Hi Nicolas! How do I get the indicator in the price chart? It only stays under i new chart.
Nicolas Just add it on the price chart by using the wrench on the left upper side of the chart (pric...
Dom Hello, hello....je commence le trading et découvre par la même occasion le codage....et ce n...
Nicolas Merci, ça fait plaisir !
Be-n Bonjour tout le monde ! Dans l'indicateur de tendance, j'ai du mal à saisir la nuance entre ...
manchokcity can we have it in mql4 platform? or how or which platform do we use it?
camporan I don't use MetaTrader so I won't be able to do the translation myself. Sorry!
Alexander9 This can for amibroker ? . Thanks
ggolfet Thanks Nicolas, I imported the itf file and solved the problem.
Hasardeur Hallo Nicolas, i tried to code the multi period heat map in combination with the Ehler’s ...
Nicolas Please open a new topic with the code in forum.
winnie37 yes. "No ground breaking math here, but I am finding very useful and some algo based on it i...
Jan Wind Also interesting to know what does not work, which set up you use, saves me investigating ! ...
winnie37 i just set the proorder like this: buy when 50/100/200 phase >0 and sell when under 0, go...
Vinks_o_7
5 years ago
IV Mcm I've always wondered how to make the ADX faster, thank you!
Vinks_o_7 You welcome !
Vinks_o_7 Another variation that may be more accurate : we calculate the average of normalized DI's in...
Vinks_o_7 Great, thanks a lot Nicolas !
Teddy Coronak Top Nicolas ! Merci
Andyswede Thank's! Great indicator:)
avatar
unkown ;-) sfido chiunque a riuscirci!
avatar
unkown infatti basta leggere i post degli altri....
nicola papangelo ciao Francesco vorrei contattarti su facebook o in privato. Grazie
Janfi Hello, I'm new to ProRealCode and I do not understand the following summation[n](indicator...
Kaci It seems he's just checking that the previous MACD is < 0 for maximum one period ? I'...
Daniel Martin Hi do you know how have and entry after the second cross? There is crosses below 0 and cross...
XXXXVII Excellent indicateur ! Déterminer une tendance est devenu un jeu d'enfants ! Félicitation......
gregoire bonjour nicolas j ai cherché partout sur le net et impossible de trouvé ce que je recherch...
Nicolas Merci de poster une demande dans le forum des indicateurs, ainsi on pourra le coder dans ce ...
joobeng Sorry, I solved the problem. I have add the CBL indicator using the spanner icon on the pric...
Nicolas Adjust the price settings for the Y Axis to use the price only.
XXXXVII Hello Your indicator is interesting. However, I can't see the orange line. Do you have ...
ALE Hi the color is given by a numerical value derived from the oscillator in use. If you comp...
efahmy Thanks mate
Jo-01-R Hello, it is possible to have this indicator but instead of colors rather have numbers rangi...
bharatjai Script 'Adaptive ATR' has been saved line 24: no viable alternative at input 'lr' Gettin...
Nicolas download the itf file and import it into your platform.
Francis3332 Bonjour à tous, J'aime beaucoup cet indicateur et j'aimerais pouvoir l'utiliser sur la dern...
Nicolas Definition of CustomClose: https://www.prorealcode.com/documentation/customclose/ [2] means...
Bard Just wondered Nicolas, say you had set DEFPARAM CumulateOrders = True, is there anyway for t...
Bard Sorry pls ignore last image, try this - it actually has the Dev Stop indicator! https://www...
Vonasi Discussion on this indicator/filter can be found here: https://www.prorealcode.com/topic/121...
Vonasi Forum discussion on these indicators can be found here: https://www.prorealcode.com/topic/av...
jennr29 Hi. Is it possible to convert this code to an mq4 file?
Nicolas Sorry but our website is dedicated to prorealtime programming. However, you can ask for priv...
snow_onar Very interesting indicator. Thanks for contributing it. What volume node or volume profile i...
Leo Does it opens pending orders?... maybe they were not trigger.
Mattzi Dont know, all i can see is that it opened an order yesterday in backtest but not live. Th...
Jean-Christophe Hello Leo, when running the strategy from 29/12/2015 to 31/08/2018 on ProRealTime Premium, I...

Top