I have a formula, which calculates Floor Pivot Points based on High, Low and Close of previous week (Week -1). Lines are supposed to be the same for next week (Week 0), but they change within this week while I scroll chart horizontally. What mistake did I make?
I created my formula based on some daily Camarilla Pivot Points AFL code.
I also don't understand what "if ( True )" statement means - what is true actually?
Also would be perfect if I could somehow manipulate zoom of chart, because seeing the most extreme pivot lines makes chart so short, that it is almost invisible, so I would happily see for example only chart + let's say 40% of chart height on top and 40% on the bottom.
Any help is much appreciated!
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();
if ( True )
{
WeekH = TimeFrameGetPrice("H", inWeekly, -1); // high last week
WeekL = TimeFrameGetPrice("L", inWeekly, -1); // low last week
WeekC = TimeFrameGetPrice("C", inWeekly, -1); // close last week
PP = (WeekH + WeekL + WeekC) / 3;
R1 = 2*PP - WeekL;
S1 = 2*PP - WeekH;
R2 = PP + (R1 - S1);
S2 = PP - (R1 - S1);
R3 = WeekH + 2 * (PP - WeekL);
S3 = WeekL - 2 * (WeekH - PP);
PP = Round(PP);
R1 = Round(R1);
S1 = Round(S1);
R2 = Round(R2);
S2 = Round(S2);
R3 = Round(R3);
S3 = Round(S3);
Plot(PP, "PP",colorYellow,styleLine);
Plot(R1, "R1",colorGreen,styleLine);
Plot(S1, "S1",colorRed,styleLine);
Plot(R2, "R2",colorGreen,styleLine);
Plot(S2, "S2",colorRed,styleLine);
Plot(R3, "R3",colorGreen,styleLine);
Plot(S3, "S3",colorRed,styleLine);
}