Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 JoMoon2024, Today, 06:56 AM
      0 responses
      6 views
      0 likes
      Last Post JoMoon2024  
      Started by Haiasi, 04-25-2024, 06:53 PM
      2 responses
      17 views
      0 likes
      Last Post Massinisa  
      Started by Creamers, Today, 05:32 AM
      0 responses
      5 views
      0 likes
      Last Post Creamers  
      Started by Segwin, 05-07-2018, 02:15 PM
      12 responses
      1,786 views
      0 likes
      Last Post Leafcutter  
      Started by poplagelu, Today, 05:00 AM
      0 responses
      3 views
      0 likes
      Last Post poplagelu  
      Working...
      X