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 FrancisMorro, Today, 03:24 AM
      0 responses
      1 view
      0 likes
      Last Post FrancisMorro  
      Started by Segwin, 05-07-2018, 02:15 PM
      10 responses
      1,770 views
      0 likes
      Last Post Leafcutter  
      Started by Rapine Heihei, 04-23-2024, 07:51 PM
      2 responses
      31 views
      0 likes
      Last Post Max238
      by Max238
       
      Started by Shansen, 08-30-2019, 10:18 PM
      24 responses
      944 views
      0 likes
      Last Post spwizard  
      Started by Max238, Today, 01:28 AM
      0 responses
      11 views
      0 likes
      Last Post Max238
      by Max238
       
      Working...
      X