Good day, friends.
Here is the code I'm having difficulty with.
PREVIOUS_YEAR_CLOSE = TimeFrameGetPrice("C", inYearly, -1);
PIVOT_MULTIPLE_IN_MONTHS = Optimize("MONTHS", 12, 1, 12, 1);
PIVOT = PREVIOUS_YEAR_CLOSE;
Plot(PIVOT, "PIVOT", colorCustom8, styleLine | styleNoRescale);
PlotOHLC(PIVOT, PIVOT, C, C, "",
IIF(C >= PIVOT, ColorRGB(0, 50, 50), ColorRGB(50, 0, 50)),
styleCloud | styleNoLabel | styleNoTitle| styleNoRescale);
Buy = Cross(Close, PIVOT); Sell = Cross(PIVOT, Close);
SHAPE = Buy * shapeSmallUpTriangle + Sell * shapeSmallDownTriangle;
PlotShapes(SHAPE, IIF(Buy, colorCustom11, colorCustom12), 0, IIF(Buy, Low, High), -30);
What I expect it to do is plot the closing price for each period of months. It gets "x 1" right. It has the same results as simply using TimeFrameGetPrice("C", inMonthly , -1), without the multiple. But I saw this in the guide, so I tried to experiment.
I am not trying to get TimeFrameGetPrice("C", inMonthly , -2), which gives me the closing price from two months ago.
I was expecting for "x 12" to work like TimeFrameGetPrice("C", InYearly, -1), where it gives me the last year's closing price. I was hoping to do the same with "x 3" for quarterly close, and "x 6" for semi-annual close.
I attached some pictures. Notice that in "x 12", the plot doesn't even begin/end at the date the period changed unlike with inYearly. And it's not even 12 months.
I hope everything is clear. I already searched the forum, but failed to find anything relevant to this.
Thank you in advance.