Ehlers – Adaptive Cyber Cycle

Ehlers – Adaptive Cyber Cycle


this is my first sharing in ProRealCode.

I’ve converted the Adaptive Cycle Indicator from TradingView, that was coded by LazyBear:

Feel free to contact me if you find bug or share the corrections.

Happy Trading.

This is the code for the indicator Adaptive Cyber Cycle:

You need also to code the function “[FN] MED” called in the script.

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?

New! PRC is also now on YouTube, subscribe to our channel for exclusive content and tutorials

  1. ALE • 06/01/2017 #

    Hello Pietro
    thanks for your code, could you suggest to use it?

  2. Pietro Fontana • 06/01/2017 #

    Hi Ale,
    the use is similar to other oscillator, mainly divergence.
    In this link you will find some graphical example from lazybear that explain pretty well the use:

  3. Pietro Fontana • 06/01/2017 #

    Hello people,
    i’ve made a little modification in the code for eliminate the function call. Now the indicator should work much faster.
    // @author Pietro Fontana
    // Kudos to LazyBear to made it in TradingView

    s = (src + 2*src[1] + 2*src[2] + src[3])/6.0
    if barindex < 7 then
    c = (src - 2*src[1] + src[2])/4
    ac = (src-2*src[1]+src[2])/4
    if barindex > 7 then
    c = ((1 - 0.5*a)*(1 - 0.5*a)*(s - 2*s[1] + s[2]) + 2*(1-a)*c[1] - (1 - a)*(1-a)*c[2])
    q1 = (.0962*c + 0.5769*c[2] - 0.5769*c[4] - .0962*c[6])*(0.5+.08*ip[1])
    I1 = c[3]
    if q1 <> 0 and q1[1] <> 0 then
    dp1 = (I1/q1 - I1[1]/q1[1]) / (1 + I1*I1[1]/(q1*q1[1]))
    dp1 = 0
    if dp1 < 0.1 then
    dp2 = 0.1
    if dp1 > 1.1 then
    dp2 = 1.1
    dp2 = dp1
    myFNMED1 = (dp2[2] + dp2[3] + dp2[4]) - min(dp2[2],min(dp2[3], dp2[4])) - max(dp2[2],min(dp2[3], dp2[4]))
    md = (dp2 + dp2[1] + myFNMED1) - min(dp2,min(dp2[1], myFNMED1)) - max(dp2,min(dp2[1], myFNMED1))
    if md = 0 then
    dc = 15
    dc = 6.28318 / md + 0.5
    ip = .33*dc + .67*ip[1]
    p = .15*ip + .85*p[1]
    a1 = 2/(p+1)
    ac = ((1-0.5*a1)*(1-0.5*a)*(s-2*s[1]+s[2])+2*(1-a1)*ac[1]-(1-a1)*(1-a1)*ac[2])
    t = ac[1]

    return ac as \"Adaptive Cyber Cycle\", t as \"ACC[1]\", 0 as \"0\"

    • Nicolas • 06/01/2017 #

      Very cool! Thanks a lot for the update! much appreciated 🙂

  4. johnb9999 • 06/01/2017 #

    Just a suggestion, not an expert, what happens if the barindex = 7

  5. Alai-n • 06/01/2017 #

    Hello … What does FN-MED mean exactly in the code complement? It is a mess to load the indicator!

    • Pietro Fontana • 06/01/2017 #

      Hi Alain,
      in the comment there’s a version that does not require the call function, and is more fast, but don’t expect good performance, prorealcode was not built with performance in mind.

  6. Alai-n • 06/01/2017 #

    Ok thank you Pietro…

  7. Halan • 06/01/2017 #

    thank you for the code.

    coded as per above, I encounter an error “unexpected character” (i.e. “ip” in line q1 = (.0962*c + 0.5769*c[2] – 0.5769*c[4] – .0962*c[6])*(0.5+.08*ip[1])

    i suspect that may be because it ( ip) has not been previously defined. can you help please??

    thank you

  8. Gianluca • 174 days ago #

    Hello there is a new version, is it possible to translate it?

Register or


avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar
Related users ' posts
Bard Hi Nicolas, thanks a lot for coding this interesting looking indicator. I read: https://...
Bard I've also just noticed that changing the "Bands Deviation" setting from 1.25 to eg 3 doesn't...
Nicolas I don't know, that code is a 1:1 translation from another platform.
jm1111enator Hello Nicolas, Is this a conversion from Tradestation Easy Language? If so, do you have a ...
Nicolas Sorry I do not provide assistance for Tradestation code.
ALE :-) thanks
Santi Hola amigos. El indicador con la nueva versión de PRT funciona muy mal, no dibuja igual que ...
Santi Salut, les amis. L'indicateur avec la nouvelle version de PRT 11 fonctionne très mal, ne fon...
luxrun Ok, thank you
robertogozzi I just discovered that ProOrder (for automated strategies) does not evaluate the expression ...
robertogozzi //Ti = ((close > Cy) * Tt) OR (((close Cy) THEN Ti = Tt ELSE Ti = -Tt ENDIF
PastaPesto Hello Roberto! Thank you for this indicator. I thought I would try it out in a strategy, bu...
robertogozzi I just realized that there's a line that shouldn't be there. It's line 5, please remove it,...
robertogozzi I just discovered that ProOrder (for automated strategies) does not evaluate the expression ...
luxrun bellissimo lavoro, Roberto, grazie!
robertogozzi I just discovered that ProOrder (for automated strategies) does not evaluate the expression ...
Akram Hi Roberto the WPZO is the bounded oscillator by percentage like the SHO Here is the artic...
skysoldier hello, thank you for this code, I was wondering if it is compatible with thinkorswim at all?
Nicolas No, but you can ask for private coding job at our programming services.
Nicolas Thanks again for all your valuable posts... and well formatted code! :)
Abdelkrim Maksour hi sir is this indicator for mt4 and how i can get one .
Nicolas Thanks a lot for this new valuable addition to our library. I changed line 76 with "barindex...
Horance Thanks. I've noticed this leftover after submission, but it was too late for editing. BTW, I...
Etienne Thanks Horance for porting this code to PRT. I would like to bring some speedup to your cod...
Horance This is a good question. John Ehlers explains it in Rocket Science for Traders. You have to ...
cbeukes Much appreciated, I will give that a try. Also, is there any criteria that one could use to ...
firemyst Thanks for the code! I'm trying to understand how it works, and have a few questions... line...
Bebbo Grazie del prezioso contributo Nicolas, scusa la mia inesperienza, sono alle prime armi e s...
Nicolas To avoid recalculation, you should use the one from this post.
Bebbo Ok Grazie Nicolas.
supertiti Hola Ale Can we have this same code from Nicolas's code in smoothed heikin Ashi? Sorry...
ALE Ok, We can discuss in the topic "3D Candlesticks TOPIC" Write me more details
Appsoluxions Hi Nicolas, do you have the MT4 version of the indicator? I am not sure if these kind of que...
Nicolas Hi, don't have one sorry. But you can still ask for private coding through our programming s...
Appsoluxions Cool. Thanks for the response.
Etienne Hi, thanks for proving this code. I would like to contribute by adding a computation speed...
Etienne //Compute Super Smoother coefficients once if barindex = 1 then a1 = exp( -1.414 * 3.14159...
Nicolas Thanks a lot!
Bard From the url link #post-65420 above but without the chart image: Stocks & Commodities...
Bard Note: lter = filter
Bard Apologies, there's been an issue with copying "f" and "I" from the article and pasting.. whi...
2 years ago
macbartin merci, possible de l'utiliser seul pour le faire fonctionner en tant que stratégie ? de même...
Nicolas Oui. Pour changer la période, il faudra ajuster la variable MMperiod
macbartin plus la période est grande (en occurrence 20) plus l'indicateur est précis dans les changeme...