Hodrick-Prescott filter (HP)

Hodrick-Prescott filter (HP)

The Hodrick–Prescott filter (also known as Hodrick–Prescott decomposition) is a mathematical tool used in macroeconomics, especially in real business cycle theory, to remove the cyclical component of a time series from raw data. It is used to obtain a smoothed-curve representation of a time series, one that is more sensitive to long-term than to short-term fluctuations. (source Wikipedia: https://en.wikipedia.org/wiki/Hodrick%E2%80%93Prescott_filter)

Be aware that this indicator is continuously rechecking the complete history to redraw the curve to be perfectly in line with the data serie. So it is repainting the past and should not be used “as is” for live trading.

Compatible only with PRT v11 and onwards.


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 • 09/28/2020 #

    Could be useful in identifying Elliott Waves

  2. willi • 09/28/2020 #

    Guten Morgen,

    ich habe den Indikator importiert, bekomme aber leider nichts angezeigt. Liegt es vielleicht daran, das ich nur die Demoversion 11.1 benutze?

    Danke Willi

    • Nicolas • 09/28/2020 #

      Nein, es sollte genauso funktionieren mit Demo oder Real Account. Haben Sie es auf die Preisliste angewendet?

  3. willi • 09/28/2020 #

    Ich habe meinen Fehler gefunden: Das lambda war für meine eingestellte Zeiteinheit zu groß gewählt, mit einem kleineren Wert bekomme ich eine Anzeige.

    Danke Willi

  4. Fabian • 09/28/2020 #

    Hi Nicolas,

    do you plan to release this indicator in version 10.3 as well or is this not practicable due to the usage of arrays?

    • Nicolas • 09/28/2020 #

      No because it needs arrays! 🙂

  5. RicLg • 09/28/2020 #

    Hi Nicolas,
    Can we get the Value of this drawsegment?
    i do not understand how this code works
    Thank you .

    • Nicolas • 09/28/2020 #

      The last value is $output[i], so return $output[i]
      Be aware that the indicator is repainting continuously.

  6. RicLg • 09/28/2020 #

    Merci Nicolas pour le retour.
    En effet on récupère “the Last value” du dernier Point de traçage, après la création d’une variable, AllValuPoint=$output[i] entre les ligne 63 et 64
    Est il possible de récupérer Toutes les valeurs du traçage de ce drawsegment?
    Merci Nicolas

    • Nicolas • 09/28/2020 #

      c’est exactement ce que je fais entre les lignes 58 et 64 pour pouvoir tracer la ligne complète

  7. Italo Fabian • 09/28/2020 #


    Ces matrices sont-elles des vecteurs unidimensionnels ou multidimensionnels?

    Depuis maintenant,

Register or


avatar avatar avatar
Related users ' posts
5 months ago
zilliq Thanks @Nicolas. I tried to use it as Trend in a proorder system, but don't know why, it doe...
Suzu Yuk He is right. MT and mavgMT are not defined and causing errors.....
Roland57800 Bonjour Noobywan, si je comprends bien l'utilisation de ce code que je trouve particulièr...
Noobywan Bonjour, quand la question a été posée dans le forum à celui qui avait fait la requête en am...
Emperor.it "style(line,2)" C'è una guida ai parametri che si possono modificare ? Tipo stile della lin...
IV Mcm https://www.prorealcode.com/programming-with-prorealtime/
fazel53 How do i attach this indicator to my mt5 platform?
Nicolas You can't! All indicators here are for ProRealTime trading platform: https://www.prorealtime...
2 years ago
Nicolas La définition des couleurs se situent entre les lignes 94 et 118. Selon le type de bougie (h...
Manu35250 Bonjour Nicolas, Est il possible de convertir cet indicateur en screener ? J'essaie depui...
Nicolas Bien sûr, merci de formuler la demande dans le forum approprié en respectant les règles de p...
Nicolas Il faut l'ajouter sur le prix avec l'icône de la clé situé en haut à gauche du graphique du ...
jerome777 merci de ta réponse
jerome777 bonjour c est bon il fonctionne parfaitement merci beaucoup
kbrooks323 Hello would someone be willing to release a scan code for this? that would be helpful as I s...
Nicolas You can do easily this screener by using the assisted creation tool. It would take you about...
kbrooks323 I just figured it out thanks!
Nicolas Check your custom trading hours and use the default market ones.
fj_pastor Hello Nicolas, Thanks again for all your support. Finally I debugged the problem. The sim...
kallistos Hi Nicolas, Thank you very much indeed for this indicator (and all the others you are provi...
tibo002 Bonjour Filoutube, je suis également bloqué comme vous mais votre dernier lien de photo avec...
Jiankyr82 It is a very nice idea, I have taken so many ideas
frenqle Hi There.. It seems the TSL stop loss is not working.. it does not respond is that correct?
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....
Morrissey38 Muchísimas gracias Nicolás , muy amable.
Bruno Carnazzi extrèmement pertinent
Bruno Carnazzi Is that beatable ?
Alps007 Hi Nicolas. Happy New Year. Can you please program me several MACD divergence screeners ...
Arlei Zanin Hello Nicolas, would it be possible to convert the Cloud to Pascal language? Thank you.
ashee i want it in MT4
Marie-Eve Vergoz Bonsoir - Voici l'erreur qui est signalée lorsque je souhaite utiliser cet indicateur : il...
Sapo Thank you for your indicators. As always it's perfect, I thank you for your help it's preci...
Vonasi Sure that is possible. I will code it and make a post in the English ProBuilder forum and pu...
Vonasi Vama v2 with Hull moving average included can be found here: https://www.prorealcode.com/top...
JMat45 Thank you, Vonasi.
3 years ago