Advanced Trend Trader

Advanced Trend Trader

About 6 months ago I had some time to look into some of the more advanced technical indicators created by John F. Ehlers. For those of you who do not know who he is, he worked as an electrical engineer at one of the largest aerospace companies in the industry before retiring as a senior engineering fellow. He specializes in technical analysis and is also the founder of Maximum Entropy Spectrum Analysis. You can read more about him here: http://www.mesasoftware.com/about_mesa_ehlers.htm

Using the vast code base of MetaTrader I started experimenting with some of his indicators trying to create a robust trend trading strategy that aims to get us onboard new trends as early as possible but at the same time keeping us out of potentially weak or flat trends that will end up going nowhere. In the end, I combined 3 of Ehlers’s indicators with one of Dr Alexander Elder. Then to top it off I combined it with the Ichimoku Cloud with which I have become very accustomed to.

In order to automate this strategy, we first had to translate these indicators to ProRealCode. With the assistance of Nicolas, we managed to do so. See the forum topic here: https://www.prorealcode.com/topic/need-help-to-automate-these-mql5-indicators/page/2/

The strategy rules are as follow:

  1. Only take trades in the direction of the color of the Elder Ribbon

  2. Validate the strength of the Elder Ribbon using the Ehlers Inverse Fisher Transform. Color must match the direction of the trade. i.e. green for long. Additionally, a sell signal above the zero line will be stronger than one below it and vice versa.

  3. Check trend momentum using Ehlers Inverse Fisher Transform of RSI. We do not want to take longs if the indicator is overbought (i.e. green). The opposite would apply for short positions

  4. Check trend strength using Ehlers Fractal Dimension. Used in borderline cases to help make a decision (i.e. rule 6) on whether to wait for Tenkan-Sen pullback and/or if price breaks through the 200MA and we have to make a call on whether the re-test will hold or not.

  5. If we are below the cloud (and also above Tenkan-Sen and Kijun-Sen) and conditions 1-4 are validated take a long position and use a close below Tenkan-Sen as a stop (up until rule 6 becomes valid). The opposite would apply for short positions. The exception to this rule would be if we are below the 200MA and below or in the cloud (and also above Tenkan-Sen and Kijun-Sen) and condition 1-2 is validated but we have a strong close above the Bollinger Band with a Bollinger W-Bottom structure taken out, take a long position and use the 200MA as target. Use a close below Tenkan-Sen as a stop. The opposite would apply for short positions

  6. If we are above the cloud (and also above Tenkan-Sen and Kijun-Sen) and conditions 1-4 are validated take a long position if we are above the 200MA and the Ichimoku leading cloud points up. If not look to rule 7.

  7. If we are in or above the cloud (and also above Tenkan-Sen and Kijun-Sen) and conditions 1-4 are validated take a long position as soon as we have a close below Tenkan-Sen (if rule 1-3 is still valid and Kijun-Sen is at least a couple of points below us). After a pullback to below Tenkan-Sen, rule 2 can be overruled by a strong rejection from either the Elder Ribbon or Kijun-Sen if the close are above the cloud. The opposite would apply for short positions

  8. If we are in a long position and we have close below Kijun-Sen and Ehlers Inverse Fisher Transform is red, exit the trade and wait for re-confirmation of rule 7. The opposite would apply for short positions

  9. If in a long position, remain in the position as long as the Elder ribbon remains blue and the Ehlers Inverse Fisher Transform of RSI is not green. If the Ehlers Inverse Fisher Transform of RSI turns green and the Ehlers Inverse Fisher Transform turns red, then exit at the first close below Tenkan-Sen. The opposite would apply for short positions

  10. Only make one trade per trend i.e per Elder Ribbon color change

Keep in mind that this is a trend trading strategy so the aim is to catch big trends and stay on board for as long as possible, and larger time-frames better afford us this opportunity.

The below code is adapted for USDJPY, but rather download and import the attached ITF file because you would need to have the three indicators installed to use this strategy:

P.S. I have also had success with the strategy on the following markets:

  • 4H US Crude with a spread of 5 and DigitFactor (Line 20) set to 4
  • 2H EURUSD with a spread of 0.6 and DigitFactor (Line 20) set to 8

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. juanj • 01/15/2019 #

    For those with a sharp eye, you will notice that I opted to use 3 different Ehlers indicators in the code than those mentioned in the description. The indicators used can be found in lines 46-53 and to switch them out simply comment out the active one and replace with the commented out one i.e. uncomment line 46 and comment line 47 etc.

  2. Stenozar • 01/15/2019 #

    Hi Juanj,
    is it possibile for you to attach here the indicators that you raccomend for this strategy? thanks!

  3. juanj • 01/15/2019 #

    If you import the attached ITF file the indicators used in the strategy will automatically also be imported. The ones currently commented out can be found by looking here: https://www.prorealcode.com/topic/need-help-to-automate-these-mql5-indicators/page/2/#post-88741

  4. auvergnat • 01/15/2019 #

    Hi,
    Can you attach also your usdjpy picture because it is not clear on screen and I can’t try you code at this moment ?
    Thks.

  5. juanj • 01/15/2019 #

    Just click on the zoom icon next to the title to enlarge the picture, it will then display clear

  6. Vicari0us • 01/15/2019 #

    Hey Juan,

    This is an awesome piece of code. A little over my head but I am learning fast thanks to people like you.

    Have you tried this out on the SA40?

    I am playing around with it to see if it can work in that market as the SA40 is my primary market.
    I have a pretty decent strategy that I have written for the SA40 and I am currently trying to fine tune it with bits of code I find interesting.

    It’s getting a bit daunting I must admit, but I love testing new strategies and indicators. Hoping to find a long term winner.

    Once again, thanks for sharing.

    Regards

    • juanj • 01/15/2019 #

      Hi Vacario0s, I actually have not tried this on the ZAF40 as I have other dedicated strategies that I trade for our local market. I obviously don’t post everything here, but if you are interested in personalized help regarding your ZAF40 ProRealTime strategy you are most welcome to have a look at my profile for my details https://www.prorealcode.com/user/juanj/

  7. Vicari0us • 01/15/2019 #

    Thanks, Juan I appreciate it.

    Do you mind sharing which strategy you use for our local market?

    I understand if you don’t feel like sharing, I know how much time and effort goes into it.
    I have been working non stop lately to make my current strategy work over a longer period of time

    • juanj • 01/15/2019 #

      See my website (available on my profile), I can then better assist local traders like yourself with personalized ProRealTime queries. Including discussing some of my local ZAf40 strategies.

  8. Juanjo • 01/15/2019 #

    Hola¡¡
    Enhorabuena por la estrategia, y gracias por compartirla.
    Tu estrategia podria aplicarse a acciones ?..cual es tu opinion?

    Gracias

  9. juanj • 01/15/2019 #

    For those perhaps looking to trade this manually, I have added a step-by-step guide here: https://www.fxautomate.com/forum/strategies-and-ideas/new-advanced-trend-trading-strategy

  10. juliogabrielcaballero • 01/15/2019 #

    Hey, when I download the itf file and import it into prorealtime, everything goes well however the indicator is just a horizontal blue line when I hit apply. Any idea as to why this is?

  11. Zebra • 01/15/2019 #

    Thanks for sharing. It’s probably a good idea to add a stop loss when currencies seem to flash crash at least once a year.

  12. juanj • 01/15/2019 #

    Clearly, the PRT Backtest engine no longer works the same (either that or the data changed slightly) because I cannot get the same results as my previous recorded tests.

    • Zebra • 01/15/2019 #

      What kind of results do you get now ? Looks still pretty fine to me concerning USD/JPY 4h

    • juanj • 01/15/2019 #

      @zebra would you be so kind as to post your latest 4H USD/JPY results here: https://www.prorealcode.com/topic/need-help-to-automate-these-mql5-indicators/

  13. Holy Grail • 01/15/2019 #

    Thank you juanj for sharing this code, Backtests looks great in USDJPY and Crude Oil

    Is anyone already LIVE with this strategy?? If yes .. how are results and experiences?

    • juanj • 01/15/2019 #

      @Holy Grail, glad you like it. Would you perhaps mind sharing your results here: https://www.prorealcode.com/topic/need-help-to-automate-these-mql5-indicators/

  14. CaptainCaveman • 01/15/2019 #

    I am reluctant to say this buy I was a member of Dr Elder trading group for a while . The fact is his group consistency underperform the S&P 500 and his Gold star traders barely out perform it. I don’t have a it of faith in his works.

  15. micquan • 01/15/2019 #

    The design is too complex and the performance is low.

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar

+10 more likes

Related users ' posts
Rafa
7 years ago
Eusebio Garcia Nuez tambien con que indicador se puede compaginar el ichimoku
Rafa El chivato es el propio SCREENER, aparece cuando las condiciones se cumplen. Y se pueden com...
Rafa El chivato es el propio SCREENER, aparece cuando las condiciones se cumplen. Y se pueden com...
nwesterhuijs Thanks, only saw it just now.
juanj For the latest version and discussions see the Ichimoku thread here: https://www.prorealcod...
Louwrens Hi Juanj. Thanks for this. I am tying it as we speak. It does not trade that often, which is...
Rafa Hay una actualización de esta estrategia. Si miras mis posts es más robusta el screener. Un ...
javier.puig.rovira@gmail.com Cruce te refieres a: Tenkan Sen, con Kijun Sen?
Rafa Hola Javier, Perdona pero no entiendo tu pregunta, no veo ninguna variable que sea solo "cru...
Francesco78 Hi Pepmartorell, please let's continue the discussion on the forum thread so that we can sha...
Francesco78 Hi Pepmartorell, please let's continue the discussion on the forum thread so that we can sha...
Jusmih1 Hi there, i am looking at your Strategy however when you put in automatic trading mode its ...
Iber0 Asi quedaria con el spread de IG [IMG]http://i65.tinypic.com/2418ism.jpg[/IMG]
avatar
bjoern Seems to work nice on BUND - M15 with SL 70 and TP 120
hvluthy@sunrise.ch I tried to backtest this code but don't get any restults. Can any body help me?
corzaroja
7 years ago
Rohan
7 years ago
gabri Great job!! I love everything that involve Ichimoku. Did you think about changing the line t...
Rohan Thanx gabri. Yes I did play around with the offset. It works but I like the "earlier" warnin...
Dom Dominics Hi, Is this code can be used for MT4 ?
gabri Ichimoku is one of the best trend indicator ever together with the Guppy EMA's. I agree with...
primo1 thanks
traderkarnik Rohan, Have you tried encorporating momentum indicator? if waiting for future cross in your...
pascal3431 Salut Doc , Je ne vois pas ce qui fait office de stop dans ce code .. un retour dans le nua...
Doctrading Bonjour, Il s'agit juste d'une stratégie où on est toujours en position : soit à l'achat / ...
pascal3431 Bonjour, après quelques essais sur EUR/USD au M15 en rajoutant(car sinon on est en perte) u...
Doctrading Nice Job ! Here is my version of the code :  KBO = 0 Tenkansen = (highest[9](high)+lowe...
gefinance Thanks for this code. The only thing left missing is the time lapse, otherwise, lots of old...
Nicolas Thanks for contributing to the "ichimoku section" of the prorealtime code library Don't he...
sourberry Thank you , this is a great indicator works beautifully. Could you kindly modify to scr...
pp_playaflamenca Excuse me,... reading your code about spanB: [ SenkouSpanBFutureW = (Highest[SenkouSpanPerio...
Nicolas
8 years ago
Kuskus Starlight
Kuskus Starlight
5
Indicators
luigiR sara ovviamente mia premura condividerla nn appena sara pronta
Nicolas Why are posting your question here?! Its not related to this indicator...Please use the foru...
luigiR Hi Nicholas, excuse me, but I don't know about this opportunity, I try, sorry again
Dymjohn Thanks for the comment grizzly, I like the look of your position sizing coding but won't use...
Elsborgtrading Hi John, and nice to see you took the Ichimoku a step further:-) One thing though, I think t...
swede_trader It doesn't generate anything for me. And I can't debug it, any tips?
GraHal Hi Pascal There's lots not clear to me! :) Are you referring to C1 = PARABOLIC>HIGH //R...
volpiemanuele hi, can I have the latest full code of this strategy ? Thansk
Steve Hey Grizzly, I know this probably doesn't belong to this post, however, don't know how else ...
mcha bonjour, merci pour cet échange mais il me semble que ce twist des SSA  et SSB serait plus ...
Pasq Concernant la remarque précédente, il est possible de remplacer les 2 lignes de code de cett...
Nicolas Merci Pasq. On peut retrouver ce code corrigé sur le forum, je viens d'en retrouver un exemp...
Doctrading Defparam cumulateorders = false n=1 // Plus le "ratio" monte, moins il y a de positions ...
Malloc Bonjour :) Je sais que cette stratégie a été partagée il y a de ça plusieurs années mais ...
lilo789 Hi guys! Do you know if it is possible to set the buy size to a relative % of the available...
Bard Hello Nicolas, thanks for posting this Fisher Transform code. I was reading John Ehler's MES...
Ronny Should C5 = Chikou > SSpanA[26] and Chikou > SSpanB[26] be C5 = Chikou > SSpanA and...
Emperor.it Chikou = close[26] it's a mistake. Chikou Span is today's closing moved back 26 periods. It...
Nicolas Indeed, there is a mistake in that code. It is often the case when using Ichimoku and its tr...

Top