Trying to learn how to reference data from other aggregation periods. Getting the previous month with [1] seems to only get the month from the previous candle. This very simple code and screenshot are maybe showing a clearer explanation. I would expect that MH[1] would have returned a value of 140.18 because that was last month's high. Instead, MH and MH[1] are both returning this month's high. Is there a reliable way to get last month's high? I did try searching the forums and the ThinkScript manual but both places seem to suggest MH[1] is the correct way and should have worked.
Code:
def MONTH = AggregationPeriod.MONTH;
def monthHigh = high(period = MONTH);
AddLabel(yes, "MH0: " + monthHigh + ", MH1: " + monthHigh[1], Color.WHITE);
SOLVED:
(thanks @generic)
Code:
def MH = high (period = MONTH);
def MH1 = high (period = MONTH)[1];
# MH[1] is NOT equal to MH1
Last edited: