I would love Fib pivot points

I have written the code for you please feel free to use it.

//@author: Kgeorge

study(title="Fibonacci Pivots Enhanced Levels (daily)", shorttitle="Fib Pivot Daily", overlay=true)

sd = input(true, title="Show Daily Pivots?")

sal = input(true, title="Show Additional Levels?")


//Equations

pivot = (high + low + close ) / 3.0

R1 = pivot + 0.382 * (high - low)

S1 = pivot - 0.382 * (high - low)

R2 = pivot + 0.618 * (high - low)

S2 = pivot - 0.618 * (high - low)

R3 = pivot + (high - low)

S3 = pivot - (high - low)

R4 = pivot + 1.272 * (high - low) //not 1.382 as mistakenly used (1.382 is not a valid Fibonacci ratio)

S4 = pivot - 1.272 * (high - low) //not 1.382 as mistakenly used (1.382 is not a valid Fibonacci ratio)

R5 = pivot + 1.618 * (high - low)

S5 = pivot - 1.618 * (high - low)

R6= pivot + 2.058 * (high - low) //not 2.000 as often mistakenly used

S6 = pivot - 2.058 * (high - low) //not 2.000 as often mistakenly used

R7= pivot + 2.618 * (high - low)

S7 = pivot - 2.618 * (high - low)


// Daily line breaks

dopen = security(tickerid, "D", open)


// Color

dcolor= dopen != dopen[1] ? na : orange

dcolor1= dopen != dopen[1] ? na : blue

dcolor2= dopen != dopen[1] ? na : red


//Daily Pivots

dtime_pivot = security(tickerid, "D", pivot[1])

dtime_r7 = security(tickerid, "D", R7[1])

dtime_r6 = security(tickerid, "D", R6[1])

dtime_r5 = security(tickerid, "D", R5[1])

dtime_r4 = security(tickerid, "D", R4[1])

dtime_r3 = security(tickerid, "D", R3[1])

dtime_r2 = security(tickerid, "D", R2[1])

dtime_r1 = security(tickerid, "D", R1[1])

dtime_s1 = security(tickerid, "D", S1[1])

dtime_s2 = security(tickerid, "D", S2[1])

dtime_s3 = security(tickerid, "D", S3[1])

dtime_s4 = security(tickerid, "D", S4[1])

dtime_s5 = security(tickerid, "D", S5[1])

dtime_s6 = security(tickerid, "D", S6[1])

dtime_s7 = security(tickerid, "D", S7[1])



//PLotting

offs_daily = 0

plot(sd and dtime_pivot ? dtime_pivot : na, title="Daily Pivot Point", color=dcolor, linewidth=2,offset=offs_daily)

plot(sd and dtime_r7 and sal? dtime_r7 : na, title="Daily R7",color=dcolor1, linewidth=2,offset=offs_daily)

plot(sd and dtime_r6 and sal? dtime_r6 : na, title="Daily R6",color=dcolor1, linewidth=2,offset=offs_daily)

plot(sd and dtime_r5 and sal? dtime_r5 : na, title="Daily R5",color=dcolor1, linewidth=2,offset=offs_daily)

plot(sd and dtime_r4 and sal? dtime_r4 : na, title="Daily R4",color=dcolor1, linewidth=2,offset=offs_daily)

plot(sd and dtime_r3 ? dtime_r3 : na, title="Daily R3",color=dcolor1, linewidth=2,offset=offs_daily)

plot(sd and dtime_r2 ? dtime_r2 : na, title="Daily R2",color=dcolor1, linewidth=2,offset=offs_daily)

plot(sd and dtime_r1 ? dtime_r1 : na, title="Daily R1",color=dcolor1, linewidth=2,offset=offs_daily)

plot(sd and dtime_s1 ? dtime_s1 : na, title="Daily S1",color=dcolor2, linewidth=2,offset=offs_daily)

plot(sd and dtime_s2 ? dtime_s2 : na, title="Daily S2",color=dcolor2, linewidth=2,offset=offs_daily)

plot(sd and dtime_s3 ? dtime_s3 : na, title="Daily S3",color=dcolor2, linewidth=2,offset=offs_daily)

plot(sd and dtime_s4 and sal? dtime_s4 : na, title="Daily S4",color=dcolor2, linewidth=2,offset=offs_daily)

plot(sd and dtime_s5 and sal? dtime_s5 : na, title="Daily S5",color=dcolor2, linewidth=2,offset=offs_daily)

plot(sd and dtime_s6 and sal? dtime_s6 : na, title="Daily S6",color=dcolor2, linewidth=2,offset=offs_daily)

plot(sd and dtime_s7 and sal? dtime_s7 : na, title="Daily S7",color=dcolor2, linewidth=2,offset=offs_daily)

Please authenticate to join the conversation.

Upvoters
Status

In Review

Board

πŸ’‘ Feature Request

Tags

Indicators

Date

Almost 2 years ago

Author

keithgeorge

Subscribe to post

Get notified by email when there are changes.