HighLow Adaptive Momentum Cycle

HighLow Adaptive Momentum Cycle

Here is a new oscillator made of a cycle calculation of the median price calculated from the highest high and lowest low of the last x periods.

An adaptive period formula can be activated to calculate the “best” period of the hi/lo channel because of market noises.

I added 4 different returned buffers to identify when the oscillator is increasing or declining above of below the 0 level which represent the bull/bear side of the market.

 

 

 

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. winnie37 • 08/28/2016 #

    bonsoir Nicolas,
    je réagis tardivement à cet indicateur 🙂 Ne serait-il pas particulièrement adapté dans le cadre de stratégies binaires, dans le sens de la tendance? A tester….

    • Nicolas • 08/28/2016 #

      Comme un nombre incalculable d’autres indicateurs codés deci delà, je compte sur d’autres pour les tester et en profiter. Si j’ai eu l’idée de faire cet indicateur à l’époque et de le poster ici, c’est qu’il m’a semblé assez signicatif pour être utilisé. Si tu as des exemples de sa bonne utilisation selon ta propre interprétation,  ça m’intéresse d’en discuter 🙂  

  2. NeraVeem • 08/28/2016 #

    Dear Nicolas,
    First of all, thank you for all your contributions, I always study them with great pleasure. I assume you are the creator of the prc-fxhilo indicator. As an indicator, this indicator is easy to invoke in other indicators. However, in the screening section this does not seem to be the case. Neither as a call function nor in case you use the code directly in a screen builder. Do I miss something or simply can not? Like to hear from you. Sincerely, Gerard

    • Nicolas • 08/28/2016 #

      It should not be a problem to use it in a stock screener, what is the problem exactly? Be aware that there are 4 different buffers, 2 for ascending and declining above 0 and the 2 others for when the oscillator is below 0.

    • NeraVeem • 08/28/2016 #

      Dear Nicolas, 
      thnx for your reply! In your answer you said: ‘It should not be a problem to use it in a stock screener’. I am afraid that the problem my ‘use direction’ is. In other words: I tried to use the indicator in a forex screener. The second possibility cause of the problem is maybe that I only use the minustwo and the plustwo lines. The other signals are ‘ignored’. Should that possible the problem? Kind regards, Gerard

    • Nicolas • 08/28/2016 #

      What condition are you trying to look for? When the oscillator is crossing the zero line?

  3. NeraVeem • 08/28/2016 #

    Dear Nicolas,
    ‘Reading’ the ‘output’ of the indicator, it seems to me that there are no ‘crossings’.  The plustwo finshed at the zero line in case of bearing direction, the minustwo also in case of bullish direction. That’s why I thought to create a screener where the one (for example: minustwo finished at zero line and the plustwo ‘take it over’. That simulates for me a ‘crossing’. Because in my opinion thre are no real crossings, I thought I would solve it by ‘greater than’ (in bullish case) or ‘less than’  ( in bearish case) operators. The remaining variables I thought would turn off with the ‘REM’ command or use the ‘ignored’ construction. De with the ‘Ignored’ command  fails and the option with the ‘REM’ gives no results in the screener.
    Please, see script below. 
    Adaptive = 1myPeriod = 14
    once f = 0once g = 0
    if barindex>myPeriod then
    //adaptive periodaveragePeriod = myPeriodif adaptive=1 and averagePeriod > 1 thenprice = medianpriceminPeriod = round(averagePeriod/2.0)maxPeriod = minPeriod*5.0endPeriod = round(maxPeriod)signal = Abs((price-stored[endPeriod]))noise = 0.00000000001
    for k=1 to endPeriod donoise=noise+Abs(price-stored[k])averagePeriod = round(((signal/noise)*(maxPeriod-minPeriod))+minPeriod)next
    endifstored=priceaverageperiod=max(averageperiod,2)myHigh = Highest[abs(averagePeriod)](high)myLow = Lowest[abs(averagePeriod)](Low)mean = (High + Low) / 2.0myVAR1 = 0.66 * ((mean – myLow) / (myHigh – myLow) – 0.5) + 0.67 * fmyVAR1 = Min(Max(myVAR1, -0.999), 0.999)fxhilo = Log((myVAR1 + 1.0) / (1 – myVAR1)) / 2.0 + g / 2.0 //main linef = myVAR1g = fxhiloif fxhilo>fxhilo[1] and fxhilo>0 thenREM plusone = fxhiloREM plustwo = 0REM minusone = 0minustwo = 0elsif fxhilo<fxhilo[1] and fxhilo>0 thenREM plusone = 0REM plustwo = fxhiloREM minusone = 0minustwo = 0elsif fxhilo>fxhilo[1] and fxhilo<0 thenREM plusone = 0REM plustwo = 0REM minusone = fxhilominustwo =0elsif fxhilo<fxhilo[1] and fxhilo<0 then REM plusone = 0REM plustwo = 0REM minusone = 0minustwo = fxhiloendifendif
    // Bullish Sign
    If MinusTwo < minusTwo[1] OR MinusTwo[1] < minusTwo[2]ThenCriteria = 110EndIf
    Screener [Criteria] (Criteria AS “MinusLow”)
    I’ve tried to upload a sceenprint as example, but that was refused by this text editor.
    So far my problem.
    Kind regards,
    Gerard

    • Nicolas • 08/28/2016 #

      Sorry, it has needed a lot more customisation of the indicator’s code to get a relevant screener. This code should work (worked for me on a daily timeframe for NASDAQ stocks for instance)
      // parameters
      myPeriod = 21
      Adaptive = 1 //boolean

      once f = 0
      once g = 0

      //adaptive period
      averagePeriod = myPeriod
      if adaptive=1 and averagePeriod > 1 then
      price = medianprice
      minPeriod = round(averagePeriod/2.0)
      maxPeriod = minPeriod*5.0
      endPeriod = round(maxPeriod)
      signal = Abs((price-stored[endPeriod]))
      noise = 0.00000000001
      mymaxbar = 254-maxPeriod
      endif

      if barindex>mymaxbar then

      if adaptive=1 and averagePeriod > 1 then
      for k=1 to endPeriod do
      noise=noise+Abs(price-stored[k])
      averagePeriod = round(((signal/noise)*(maxPeriod-minPeriod))+minPeriod)
      next

      endif
      stored=price
      averageperiod=max(averageperiod,2)
      myHigh = Highest[abs(averagePeriod)](high)
      myLow = Lowest[abs(averagePeriod)](Low)
      mean = (High + Low) / 2.0
      myVAR1 = 0.66 * ((mean - myLow) / (myHigh - myLow) - 0.5) + 0.67 * f
      myVAR1 = Min(Max(myVAR1, -0.999), 0.999)
      fxhilo = Log((myVAR1 + 1.0) / (1 - myVAR1)) / 2.0 + g / 2.0 //main line
      f = myVAR1
      g = fxhilo

      endif

      condition = g crosses over 0 or g crosses under 0

      screener[condition]
       

  4. NeraVeem • 08/28/2016 #

    Dear Nicolas,
    thnx a lot of your screener script. A quick test teaches that it works, also for Forex trading in smaller timeframes. Again, thnx !!!
     
    Gerard

  5. Vinks_o_7 • 08/28/2016 #

    hello
    Pour info, j’ai une erreur sur la version actuelle de PRT: un paramètre de type entier positif est attendu pour highest…

    • Nicolas • 08/28/2016 #

      As-tu bien enlevé les // devant les paramètres “myPeriod” et “Adaptive” ?

    • carlvan • 08/28/2016 #

      J’ai la même erreur. Pourtant ABS donne par définition un nombre positif

    • Nicolas • 08/28/2016 #

      Essayons de remplacer la ligne 27 par:
      averageperiod=max(round(averageperiod),2)

  6. Traste • 08/28/2016 #

    Hi!! this is a great indicador, which I regularly use on PRT. However, I’d love to have it on TradingView too, is there any chance it can be converted? Thanks!

    • Nicolas • 08/28/2016 #

      We don’t provide TV assistance on our website, to get private paid coding translation use the programming services: https://www.prorealcode.com/trading-programming-services/

    • Suzu Yuk • 08/28/2016 #

      Hello, I am still getting the same error even after removing the // in front of the “myPeriod” and “Adaptive” parameters….. Why?

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar
Related users ' posts
kats bONSOIR Est ce normal que les droites se démultiplient en plusieurs droites quelle differe...
kats j ai fait une copie d'ecran mais je ne sais pas comment l'envoyer sur le site
Iván Thanks ;)
kats BONJOUR je lai mis sur du renko , il est complexe car toujours a l'envers??? Peut être ne ...
RTR Great tool again and great job, thank you! So from what I see everytime Z-Score is over 0...
Gaspare Ciao Ivan si puo' inserire una strategia su questo indicatore per ottimizzare le variabil...
P. Marlowe Impressive work. Accurate, interesting, good background. You hit the nail on the head again....
Iván Hi! You should change $rbox, $gbox and $bbox variables. Also r,g,b for last box.
finplus Thanks Ivan.
roccafragius Ivan, I just want to say you.. very very great job!!!! Thank you so much for this indicator!...
Iván
2 weeks ago
groelandes Cuando te descargas el fichero itf, en su código no aparece toda la configuración de alertas...
Iván Si lo descargas e importas en tu PRT verás que se han creado las variables para luego config...
Iván
3 weeks ago
Danger Zones Indicator
Danger Zones Indicator
2
Indicators
P. Marlowe Quite an impressive work, as usual. You share extremely useful tools and show an stunning ba...
Iván Thank you very much!
P. Marlowe Quite an impressive work, Iván. Extremely useful and accurate. Congratulations. Keep it up¡
lkiklkik i love it !!! thanks.
Stenozar Hi Ivan, can you translate from tradingviwe the EMA TREND METER INDICATOR? It couid be inte...
Iván Hi Yes I can. Please, create a new topic for that I will translate it.
Stenozar Hi Ivan, I've created a new topic about the indicator: https://www.prorealcode.com/topic/ema...
Iván sería así //------------------Inputs------------------------------ linreglength = 11//i...
Doddge Muchísimas gracias Iván, está genial.
superfalcio holaaa, have you run some statistics?
Doddge Hola Iván, ¿sería posible crear un screener que indique cuándo las velas coloreadas del indi...
RTR Ivan thank you for the pro-screener. I a trying to understand how to write the signals from ...
Iván Hi, Lines 62 and 63. These lines define buy and sell conditions.
el titi Bonjour, merci beaucoup pour ce partage. Je vais regarder avec attention ce script et analys...
Armand2020 Bonjour , super taf!! serait il possible de faire un poc dynamique en timeframe 5 min en mod...
philippe59139 voici ce qu'il faudrait faire ou ajouter: //poc dynamique defparam calculateonlastbars=1...
Iván
2 months ago
Iván I personally like it in daily timeframe
oliTR Many thanks Ivan, I copy/paste your code to try it but could only get a constant stable unif...
Iván Hi, I've copied the code above and it works... what asset are you trying? $indices array ...
francis59 Hello Ivan, thanks for this very nice and powerfull indicator. Could you have time to create...
Iván Hi We could find stocks with sweep on: //PRC_Sweep Institucional //version = 0 //28.0...
inverse Like the way you think Ivan ... :)
Iván Hi You should delete from the indicator code all drawing functions and all variables not us...
Iván I've created a screener to show [longcondition or shortcondition]
Chrisinobi Hallo Ivan, Danke das ist Perfekt !! Kannst du bitte in der Screener-Bibliothek die itf. hoc...
Gio56 Super idée. j'ai juste un souci. j'ai pas de barre verte mais plusieurs lignes de couleurs.....
DeathMetal change line in histgram, (click on indicator name, click on tool (
Gio56 Super merci.

Top