Higher timeframe MACD values are incorrect and missing

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #183782 quote
    vsPRT
    Participant
    New

    Hello,

    I have attached some simple code that grabs the previously closed MACD values from a 2-hour timeframe. After running this on 30 seconds, I noticed that a significant portion of time does not display any returned values whatsoever. On top of that, when opening a 2-hour chart and manually checking the values that are returned, they do not match up.

    This problem doesn’t occur when running the code on 1 minute.

    I was hoping someone could shed some light on this because I don’t understand what could be causing this problem.

     

    Cheers,

    timeframe(2 hours)
    hist2H = MACD[12, 26, 9](Close)[1]
    line2H = MACDLine[12, 26, 9](Close)[1]
    
    timeframe(default)
    
    return hist2H, line2H
    Capture.png Capture.png
    #183787 quote
    robertogozzi
    Moderator
    Master

    Did you have enough units on your chart?

    Bear in mind that to calculate MACD, 26 (+ some extra ones for calculations + an extra one due to using [1] with CLOSE) 2-hour periods are required, each one of them requiring 7200 seconds (3600 each hour) for a number of seconds which totals roughly 200K seconds.

    I think that using 30 seconds, instead of a mere 1-second TF won’t earn you 30 times the periods, but almost the same ones.

    #183788 quote
    robertogozzi
    Moderator
    Master

    Do not embed files of any type in your post, as this slows down loading the pages.

    Attach them using the SELECT FILE button only.

    Thank you 🙂

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Higher timeframe MACD values are incorrect and missing


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
vsPRT @versus Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by robertogozzi
4 years, 1 month ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 12/23/2021
Status: Active
Attachments: 1 files
Logo Logo
Loading...