Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Two identical MACD Hist indicators plotting differently, what??

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

    Two identical MACD Hist indicators plotting differently, what??

    Hi all,
    Hope someone can help me with this. I have two different versions of the MACD Hist which appear to have the same formula in the script, but are plotting differently. I have marked each discrepancy in the included chart with a blue line. A 'discrepancy' is when a hist bar is not the same between the two indi's, regarding higher or lower than the previous hist bar.

    The OsMA is slightly smoother than the MACDUpDown and you can see that they give different values (right axis values). If I had the OsMA calculation with the same color changing as the MACDUpDown, I would be set. The difference is small, but significant to me. You can see there are seven bars of discrepancy on this screenshot.

    BTW, I have 'transparented' the MACD itself from the MACDUpDown indi, since I only care about the hist.

    I have looked at the indicator formula in the code, and it seems exactly the same. It doesn't make sense to me. I don't program in Ninjascript so I can't figure out what else is causing the difference.

    What I am after is the OsMA code (little smoother) with the same type of red/green color change as the MACDUpDown has. Can anyone help me out with this?

    Thx, Scotty J
    Attached Files

    #2
    Hello turboscottomatic,

    Thank you for your post.

    The difference is that the MACDUpDown uses a different method to set the macdAvg value versus the OsMa:
    MACDUpDown:
    Code:
    double macdAvg	= (2.0 / (1 + Smooth)) * macd + (1 - (2.0 / (1 + Smooth))) * Avg[1];
    OsMa:
    Code:
    double macdAvg	= SMA(diffSeries, Smooth)[0];

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    599 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    344 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    558 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    557 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X