///////////////////////////////////////////////////////////
// Copyright by Maruti 2025
// Pivot points simply took the high, low, and closing price from the previous period and
// divided by 3 to find the pivot. From this pivot, traders would then base their
// calculations for three support, and three resistance levels. The calculation for the most
// basic flavor of pivot points, known as ‘floor-trader pivots’, along with their support and
// resistance levels.
////////////////////////////////////////////////////////////
//first_candle_timeframe = [Link]( title="First Candle Timeframe", )
study( title="Maruti Pivot Point", shorttitle="Maruti Pivot Point", overlay = true)
width = input(2, minval=1)
High = security(tickerid,"D", high[1] )
Low = security(tickerid,"D", low[1])
//Close = security(tickerid,"D", close[1])
//Open = security(tickerid,"D", open[1])
//Close = security(tickerid,"D", close[1])
//P =(High - Low)
//L = P * 3.14
PP = (High + Low ) / 2
R1 = PP*2-Low
S1 = PP*2-High
R2 = PP + (High - Low)
S2 = PP - (High - Low)
R3 = PP * 2 + (High - 2 * Low) //High + 2 * (vPP - xLow)
S3 = PP * 2 - (2 * High - Low) //Low - 2 * (xHigh - vPP)
plot(PP, color=#080000, title="PP", style = circles, linewidth = width)
plot(S1, color=#ff0000, title="S1", style = circles, linewidth = width)
plot(S2, color=#ff002a, title="S2", style = circles, linewidth = width)
plot(S3, color=#ff014a, title="S3", style = circles, linewidth = width)
plot(R1, color=#009600, title="R1", style = circles, linewidth = width)
plot(R2, color=#006F00, title="R2", style = circles, linewidth = width)
plot(R3, color=#004900, title="R3", style = circles, linewidth = width)