HLHB Trend Catcher – DAX mtf

HLHB Trend Catcher – DAX mtf

I coded this strategy after reading this website https://www.babypips.com/trading/forex-hlhb-system-explained, where the logic is best described.

Basically it enters LONG when a Fast Ema crosses over a Slow Ema AND Rsi crosses over its mid line. The reverse for SHORT trades.

I used the same settings for Ema’s (5 and 10), while I changed Rsi periods from 10 to 8 because the optimization granted better results. I also optimized TP’s and SL’s.

I coded it on DAX 1-minute default TF and 1-hour TF for signals.

Many inner workings are commented and easy to understand and change.

I will describe what I think deserves a deeper insight:

  • Line 10 sets the default TF (1-minute).
  • Line 12 allows to choose how the Trailing Stop code should behave (0 will use CLOSE to check prices, 1 will use HIGH/LOW).
  • Lines 21-157 allow to choose trading hours, days and months.
  • Lines 160 and 161 are the basic conditions for Long/Short trades.
  • At line 163 TF 1-hour is started, that’s where the signals are returned.
  • Lines 184-190 set data to be used as signals (two Ema’s + Rsi).
  • Lines 192-195 prepare the setup for LONG tradses, while lines 196-200 prepare the seup for SHORT trades.
  • The 1-hour TF has finished its tasks and it’s time to resort again to the default TF (1-minute) at line 202.
  • Lines 203-210 are used to avoid entering again after a signal, if a trade is exited before the next hour begins (the signal is still set, but entering at such a late time may cause SL to be hit).
  • lines 211-230 enter trades and set flag TradeON to 0, to finish what lines 203-210 have started.
  • The last snippet starts at line 233, it’s the TRAILING STOP. Lines 233-343 set the reference to either CLOSE or HIGH/LOW according to one of the first options encountered earlier:
    TRAILSTART         is the number of pips after which trailing starts.
    BASEPERCENT     is the base percentage of profits to be secured when Trailing begins.
    STEPSIZE                is the number of pips needed to increment SL.
    PERCENTINC        is the percentage that BASEPERCENT needs to be incremented each STEPSIZE pips. So that if BASEPERCENT     is 10% initially, after each STEPSIZE chunk will be incremented by this PERCENTINC, if it is 20%, then BASEPERCENT     will rise to 12% the first time, then another 20%, rising to 14.4% the second time and so on… as profits grow.
    PRICEDISTANCE is the minimum distance the broker requires for an instrument when a pending order is entered (I use 7 for DAX, despite it is actually slightly lower).

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. fatlung • 07/23/2019 #

    Hi robertogozzi, may i know the timezone for this stratety.
    Besides, it would be great if somebody could test it for a longer period.

  2. fatlung • 07/23/2019 #

    it also seems the take profit for long vs short side is a bit unbalanced. Do you know why?

  3. robertogozzi • 07/23/2019 #

    TZ is UTC+2 (also called CET)

  4. robertogozzi • 07/23/2019 #

    I think because DAX is mainly in an uptrend recently.
    I added options to trade both LONG and SHORT positions, you may choose not to go SHORT.

  5. winnie37 • 07/23/2019 #

    wonderful, thanks a lot Robertogozzi :-). Yes, if we could backtest on 200k, it would be nice !

  6. Gaspare • 07/23/2019 #

    Ciao Roberto……ottimo
    si potrebbe avere un TS simile per tradare anche i cfd future americani?
    MINI SP 500 NASDAQ WALL STREET
    Grazie

  7. 25sonalgo • 07/23/2019 #

    grateful if anyone could provide 200k backtest results! thx

  8. robertogozzi • 07/23/2019 #

    No GraHal, there’s no topic open. It would be great if you could start one and post that link here. Thank you.

  9. avatar
    Anonymous • 07/23/2019 #

    Hi robertogozzi – thank you very much for sharing this strategy. I have performed various back tests and found that, for my preference, running it on a 5 minute time-frame generates a good number of orders. I also tested the TP for the long and short. For Long I use 75 points and for shorts I use 20, as Governments are manipulating markets to the upside through Quant Easing, the down periods are “bailed out” by central banks now.

    Am now running live on an IG spread betting account, accounting for their DAX spreads and will let you know.

    Thanks once again, super grateful.
    S.

  10. robertogozzi • 07/23/2019 #

    Thank you samsampop.

  11. Dotan • 07/23/2019 #

    Hello guys I really appreciate this coding effort but can I use this code for Mt5 Forex Trading, or does it only apply to Dax and PRC

avatar
Register or

Likes

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

+9 more likes

Related users ' posts
segie Can something similar be done with Supertrends?
Vonasi Not sure I fully understand what you are asking for. Are you asking for MTF Supertrend level...
Kris75 very interesting; thanks !
ribes65 Bonjour Nicolas, Merci pour votre travail. Est-il envisageable de créer un screener pour ...
Nicolas Bien sûr, merci de formuler une demande dans le forum des screeners pour prorealtime. En res...
ipbvba Est il possible de le transformer en indicateur (pour ne plus avoir les lignes mais uniqueme...
supertiti Bonjour Nicolas, Je ne comprend pas bien , le trend change de couleur quand les prix sont a...
Nicolas Oui ce serait possible, cependant l'indicateur est bien prévu pour conserver la couleur de l...
supertiti Quand tu pourras si tu peux nous coder la troisième couleur cela améliorerait les trades cou...
Nicolas How to import file page: in the help section of the website explains howto
kenssa import through the indicator page/window in the Proreal time
chicoteca Buenas, no consigo que se me muestre en el chart de DAX. ¿Cómo procedo? Gracias.-
frenqle Hi There.. It seems the TSL stop loss is not working.. it does not respond is that correct?
Ciccarelli Franco Per lasciare che la strategia venga eseguita (dopo aver importato il file): Basta eliminare...
JADINVEST Hello Jan, hello everyone, Thanks Jan for this strategy! Since 2020, have any of you found a...
Stockastiss Can this code be simply transferred into Backtestingcode so one doesnt need to use call ? (i...
Vonasi Sorry for the late reply. Add the code to your strategy and remove line 5 and line 39. Chang...
viktorthunss Hi! How many averages are there? Can I see the somewhere?
FXmike hey my friends, thank you for this great code. my problem is he make no trade open. backtest...
FXmike Can i put a Action that my start contract is smaller than 1 ? 0.3 or 0.5 ? In wich Position...
phoentzs I wrote the code for M15 back then and also variants in H1 and M1. Everything works so far....
leofi https://www.prorealcode.com/topic/simple-average-with-visual-color/
leofi Go visit www.prorealcode.com/topic/simple-average-with-visual-color/ and watch 2em post
Dritan Hi,I am new on Prorealtime and coding.I downloaded the indi but I have it on a separate wind...
Jan Wind Thanks for sharing ! The Gain/Loss ratio is a bit low, 1,16, hardly offset the risks take...
drive whats the period ?
Lucas0000 Hola. estoy buscando un programador en proorder, para hacer un programa basado en el Q-trend...
Ludwig Bonjour Merci pour le code, je souhaite intégrer un break even et mette en place un réinves...
superfalcio hello, this strategy is pretty interesting, anyway on index after diferent suggestion and im...
Fralex Hello everyone I optimized the original “LongOnly-DAX-4H-TMA-Channel” algorithm over a pe...
Nicolas Just add it on the price series.
yomisadiku Hello Nicolas, Can I use high and low price at lines hh=max(hh,close) and ll=min(ll,close) ...
Nicolas Yes you can do that, the impact will be that the trailing stop line will be much close to th...
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 ...
Globalmarkets79 Thank you Vonasi for the answer. I have an other question. When i tried to run the indicator...
Vonasi Lines is either 0 or 1 to turn on or off the drawing of them. Once again if you download and...
Globalmarkets79 Thank you Vonasi, this indicator is very helpful!!!
Nicolas
5 years ago
Bateson Merci pour la réponse Nicolas. C'est bien ce que j'ai fait mais ça ne fonctionne toujours pa...
Enzo Paliotti Veramente ottimo, era quello che cercavo, si potrebbe modificare inserendo come variazione a...
Nicolas Perché no, chiedetelo con una descrizione dettagliata nel forum degli indicatori, per favore!
jiddan78 how to convert to afl amibroker ?
Nicolas We do not supply free coding assistance for AFL Amibroker on the website. You can ask for pa...
Ngomsi @ Vonasi, how to use timeframe , 13 minutes ,21 minutes, 34 minutes,et 55 minutes with this...
YvesRobert @robertogozzi. It's done. Thank you
YvesRobert Hello Roberto, some questions about your strategy. 1 - Do the 2 lines SET TARGET pPROFIT T...
robertogozzi 1. The 2 lines SET TARGET pPROFIT TP and SET STOP pLOSS SL are always executed, each bar. Bu...
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
riz001 thnk u
geroniman bonjour Nicolas, j ai un indicateur le Tiger . J aiemrai placer des fleches buy et sell dire...
Nicolas Merci de formuler les demandes sur le forum. ça n'est pas le bon endroit et hors sujet ici ! ;)
Gubben So far so good. After a long drawdown it was winning four times in five weeks. Since 24 jul...
pat95162 Salut Pourquoi je n'ai pas les même résultats que vous
UkCoopDownUnder Any hints for us, on which variables we should be optimising ? As of November 2020, the cu...

Top