Corrected generalized DEMA

Corrected generalized DEMA

DEMA average is a double Exponential Moving Average. It was created to reduce the amount of lag time found in traditional moving averages.  It was first released in the February 1994 TASC magazine.

This version embed the corrected function, it measures deviations of the DEMA values, if the changes are not significant, then the value is “flattened”.

It also includes the floating levels functionality (2 levels based on recent highest high and lowest low of the corrected curve).

The DEMA and corrected DEMA change color following these criteria:

  • color change on slope change
  • color change on outer (floating) levels cross
  • color change on middle (floating) level cross
  • color change on average (DEMA) value cross



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. Jan Wind • 11/20/2018 #


    could you explain why you have used 4 numbers to draw the candle ? First 3 defines the color ? true ?, what does the fourth mean ?

    drawcandle(flup,fldn,flup,fldn) coloured(169,169,169,40) bordercolor(169,169,169,0)

    Thanks in advance, Jan

    • Nicolas • 11/20/2018 #

      Alpha transparency from 0 to 255.

  2. Jan Wind • 11/20/2018 #

    I like the principles behind this indicator.
    I prefer to use the TEMA instead of the DEMA. So therefore I adjust the word “DEMA”, used only once at line 20, for “TEMA”. This works only if you also adjust line 18 in the code “if barindex>Period*2 then” to ” if barindex>Period*3 then”, as the TEMA uses a triple moving average instead of double moving average with DEMA.

  3. ehtsham • 11/20/2018 #

    Hi, Sir can you tell me how to put this code in indicator plz

  4. Jan Wind • 11/20/2018 #


    all you need to do is change the code in line 18 and line 20 (see the code above from Nicolas)
    18. if barindex>Period*2 then
    20 avg = DEMA[Period](Series)

    ADJUSTED CODE (change 2 to 3 in line 18 and change DEMA to TEMA in line 20)
    18. if barindex>Period*3 then
    20 avg = TEMA[Period](Series)

    KR Jan

  5. DimKar • 11/20/2018 #

    Dear sir , thank you very much for sharing !!!! it is awesome …!!!
    Please can you tell me what i have to do ( add/change) in order to coloured and make more visible that grey histogram in the indicator ?
    Many thanks !!!!
    Best Regards

    • Nicolas • 11/20/2018 #

      Change line 62 with: drawcandle(flup,fldn,flup,fldn) coloured(169,169,169,80) bordercolor(169,169,169,0)

  6. DimKar • 11/20/2018 #

    Thank you very much from Greece sir , have a nice day ….!!!!
    Really i do not have words to thank you enough !!!
    Best Regards

Register or


avatar avatar avatar avatar avatar avatar avatar avatar avatar
Related users ' posts
magnus59 Hi Nicolas, thaks for your great work here, I need a scanner for the swedish OMX when ma...
Nicolas Yes, sure please open a new topic in the ProScreener forum section, thank you.
paullyons Hello! Thanks for post your indicators. I'd like you to let me know how to draw lines for ...
Rafa Hi Nicolas! I can´t install this indicator. it installs in a separate window not as an av...
Nicolas Add it on the price, see how:
Frankyslo1 No consigo instalarlo en el precio en PRL-version 10
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... "style(line,2)" C'è una guida ai parametri che si possono modificare ? Tipo stile della lin...
IV Mcm
volanirina Bonjour Je souhaite l'avoir sur l'indicateur MT4 si possible s'il vous plait. car je l'ai fa...
Nicolas ProRealCode est un site dédié à l'utilisation de la plateforme de trading ProRealTime: https...
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...
Nicolas c'est exactement ce que je fais entre les lignes 58 et 64 pour pouvoir tracer la ligne complète
Italo Fabian Nicolas, Ces matrices sont-elles des vecteurs unidimensionnels ou multidimensionnels? Depu...
Denis Bonjour Nicolas et RicLg, Merci Nicolas pour cet indicateur intéressant et merci RicLg pour...
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
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?
Ciccarelli Franco Per lasciare che la strategia venga eseguita (dopo aver importato il file): Basta eliminare...
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....
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...
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:
JMat45 Thank you, Vonasi.
3 years ago
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
Alberto Aguilera Hi! Thanks for your strategy Anyone can check it with 200 bars?
TempusFugit Hi, this simple system for DOW and only shorts has worked quite well, maybe because of its q...
phoentzs Unfortunately, I never pursued this strategy further. Maybe I should take a look with what ...
robertogozzi It surely CHANGES even when currently outside time range, as the lookback periods change as ...
SkippyTrader Thanks Roberto, but shouldnt the values in the outside time range not be different? As it sh...
robertogozzi Actually it is a constant (I tested them on a 1-hour TF, 9am to 5pm) and outside that time r...
funkystuff Salut Balmora, Ton indicateur est plutôt intéressant :) Penses-tu qu'il soit possible de l'...