Dear @fxshrat
I got the following code from another post
/// Standard Pivots //
/// @link https://forum.amibroker.com/t/hw-to-plot-pivots-for-the-fresh-day-start-to-end-instead-of-candle-based/21289
GraphXSpace = 5 ;
SetChartOptions(0,chartShowArrows|chartShowDates);
Plot(C,"Close",colorBlack, styleCandle);
ppl = ParamToggle("Plot Pivot Levels","Off|On",1);
fraction= IIf(StrRight(Name(),3) == "", 3.2, 3.2);
dn = DateNum();
newday = dn != Ref( dn, -1);
/* This code calculates the previous days high, low and close */
Hi = TimeFrameGetPrice("H", inDaily, -1);
Lo = TimeFrameGetPrice("L", inDaily, -1);
C1 = TimeFrameGetPrice("C", inDaily, -1);
/* aily pivots calculation*/
rg = (Hi - Lo);
bp = (Hi + Lo + C1)/3; bpI = LastValue (bp,1);
r1 = (bp*2)-Lo; r1I = LastValue (r1,1);
s1 = (bp*2)-Hi; s1I = LastValue (s1,1);
r2 = bp + r1 - s1; r2I = LastValue (r2,1);
s2 = bp - r1 + s1; s2I = LastValue (s2,1);
r3 = bp + r2 - s1; r3I = LastValue (r3,1);
s3 = bp - r2 + s1; s3I = LastValue (s3,1);
r4 = bp + r2 - s2; r4I = LastValue (r4,1);
s4 = bp - r2 + s2; s4I = LastValue (s4,1);
/// @link https://forum.amibroker.com/t/hw-to-plot-pivots-for-the-fresh-day-start-to-end-instead-of-candle-based/21289/2
function SetNull(array, mode) {
global newday;
if ( mode )
result = IIf(! newday, array, Null);
else
result = IIf(newday OR Ref(newday,-1), array, Null);
return result;
}
if(ppl==1) {
y_offset = 2;
Plot(SetNull(bp, 1),"",colorBlue,styleStaircase|styleDots|styleNoRescale);
Plot(SetNull(bp, 0),"",colorBlue,styleStaircase|styleNoRescale);
PlotText(" Pivot = " + WriteVal(bp,fraction), BarCount+2, bpI, colorBlue, -1, y_offset);
for (i = 1; i <= 4; i++) {
s = VarGet("s"+i);
Plot(SetNull(s,1),"",colorRed,styleLine|styleNoRescale);
Plot(SetNull(s,0),"",colorRed,styleStaircase|styleNoRescale);
PlotText(" s"+i+" = " + WriteVal(s,fraction), BarCount+2, LastValue(s), colorRed, -1, y_offset);
r = VarGet("r"+i);
Plot(SetNull(r,1),"",colorGreen,styleLine|styleNoRescale);
Plot(SetNull(r,0),"",colorGreen,styleStaircase|styleNoRescale);
PlotText(" r"+i+" = " + WriteVal(r,fraction), BarCount+2, LastValue(r), colorGreen, -1, y_offset);
}
}
It draws the daily pivots perfectly when the time frame is 15 minutes.
When I change my time frame to hourly (and higher), it seems that something is wrong, you can find some continuous lines there
and also pivot lines are congested on Mondays:
I would appreciate it if you could help me in this regard.
Best regards