Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Normalize HMA indicator (0 to 1)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Normalize HMA indicator (0 to 1)

    In the UI, when I place an HMA indicator on an existing panel that happens to have StochRSI (already normalized between 0 and 1) then it graphs the HMA between 0 and 1 where I can look at levels of oversold/undersold with reference to the HMA which I find useful. How can I replicate this in code? I've been unable to figure this out. I simply want to see when HMA(10) is above .8.

    Thanks,

    Brian

    #2
    Hello btwaugh06,

    The HMA and RSI produce very different values. When you have this on a chart, are the indicators using the same Scale justification?
    Are using the RSI as the input series to the HMA?

    You can have a condition that checks the HMA(10) is above .8.

    if (HMA(10[0] > .8)
    {
    // trigger action
    }

    However, likely the HMA is always going to be above .8 as this is an average of the close price.

    I recommend you print the HMA value to confirm it is what you expect.

    Print(HMA(10)[0]);
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea,

      After researching it all day, I ended up doing the following to mostly achieve what I was looking for. I normalized it to a particular range of the past 150 values in the data series like so to get the 0-1 values. Hopefully others may find this helpful.

      double valueMax = MAX(HMA(50),150)[0];
      double valueMin = MIN(HMA(50),150)[0];
      double valueRange = valueMax - valueMin;

      normalizedHMA[0] = Math.Round(((HMA(50)[0] - valueMin) / valueRange),2);
      Log("Normalized HMA(50): " + normalizedHMA[0], LogLevel.Information);

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      151 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      304 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      244 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      345 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      175 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X