You can code an indicator that only updates at the start of each new 4 hour candle. This gives a stepped result.
Here is an example for a 4 hour 20MA. If you increase the stored variables to 200 and then divide the sum of them by 200 you will have a 200MA. I got bored with the typing after 20 so I’ll leave the rest up to you!
Obviously you will need to make sure that your chart has at least 200 4 hour closes on it. A 10k 15 minute chart has over 3200 on it so you should be good to go. Happy typing and share the result here when you finish it please!
Making it update every fifteen minutes would be a coding nightmare and probably very slow to draw so I think this stepped MA is about as good as it gets. If it is just an indicator on a chart rather than a value from an indicator that you want then Nicolas’ MTF idea will probably suit you better.
The original question came to be because I have a strategy on the 15 min chart and I want to add a condition to check if the 200 SMA on the 4hr chart is slightly above the current price.
And if so, then not to place an order as the trade against resistance would result in a loss.
I thought drawing the 200 SMA of the 4hr chart on the 15 min chart would be the easiest solution to create that condition.
But maybe there is a solution with the Timeframe function?
If you are talking about an automated trading strategy, that’s right the solution is to use the TIMEFRAME instruction like in the example of that pages:
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