Pulling information from multiple aggregation periods


New member
Hi, Everyone.

Here is some background on what I am trying to achieve:
I trade using the slow stochastic across multiple timeframes. I am currently making a thinkscript that combines the information from the stochastics oscillator from multiple timeframes and assigns the bar color based on the different combinations. For Example, if the 4 hour and the 30 minute fast line is above the slow line (indicating an uptrend) and the 2 minute stochastics is oversold (pull back) then I want the candlesticks to change to Green indicating a potential buying opportunity.

Here is the Problem:
This function seems to be working fairly well in real time. The problem occurs after the fact: If the 4 hour stochastic changes From up to down all the instances where bars were painted green over the last 4 hours go away. Is there a way to capture the values of the higher timeframe at each 2 minute bar and keep the bar color what it was when it was originally printed?

This is my first post I hope that was a specific enough question and not too confusing if you guys want any more info let me know.

Last edited by a moderator:

Similar threads