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.
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.
To help us continually offer you the best experience on ProRealCode, we use cookies. By clicking on "Continue" you are agreeing to our use of them. You can also check our "privacy policy" page for more information.Continue