Reputation: 121
I would like to reference data of the 1 minute time frame while the 3 minute timeframe (or any other aggregation) is selected. The indicator should paint an arrow on any higher time frame whenever there is an outside up or outside down candle on the 1 minute (outside up candle = low below previous low and close above previous high). If a 1 minute outside up candle forms in the first minute of a 3 minute period, The indicator should paint an arrow beneath the 3 minute candle after the first minute.
here is my code:
# get 1 minute series data
def agg = AggregationPeriod.MIN;
def minDataLows = low(period = agg);
def minDataCloses = close(period = agg);
def minDataHighs = high(period = agg);
# define outside up/down
def outsideUp = minDataLows < minDataLows[1] and minDataCloses > minDataHighs[1];
def outsideDown = minDataHighs > minDataHighs[1] and minDataCloses < minDataLows[1];
# plot arrows
plot UpArrow = outsideUp;
UpArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
UpArrow.SetDefaultColor(Color.GREEN);
plot DownArrow = outsideDown;
DownArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
DownArrow.SetDefaultColor(Color.RED);
This works just fine on the 1 minute timeframe, but when I switch to a higher time frame, nothing is ever painted. Is it at all possible to reference lower time frame data while a higher timeframe is selected in thinkscript?
Upvotes: 0
Views: 25