Pivot Target (5m Futures)
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © kb0iaa
//@version=4
study("Pivot Target (5m Futures)", overlay=true)
SR = input(title="Show Support & Resistance Levels", type=input.bool, defval=true)
TFP=timeframe.period=='5'
HI=security(syminfo.tickerid, '120', high[1], lookahead=barmerge.lookahead_on)
LO=security(syminfo.tickerid, '120', low[1], lookahead=barmerge.lookahead_on)
CL=security(syminfo.tickerid, '120', close[1], lookahead=barmerge.lookahead_on)
P=(HI+LO+CL)/3
S1=2*P-HI
R1=2*P-LO
S2=P-(R1-S1)
R2=P+(R1-S1)
S3=LO-2*(HI-P)
R3=HI+2*(P-LO)
plot(TFP and SR and R3 ? R3 : na, "R3", style=plot.style_circles, linewidth=1, color=#ff0000)
plot(TFP and SR and R2 ? R2 : na, "R2", style=plot.style_circles, linewidth=1, color=#ff0000)
plot(TFP and SR and R1 ? R1 : na, "R1", style=plot.style_circles, linewidth=1, color=#ff0000)
plot(TFP and P ? P : na, "Pivot", style=plot.style_circles, linewidth=3, color=#ac59ac)
plot(TFP and SR and S1 ? S1 : na, "S1", style=plot.style_circles, linewidth=1, color=#7cfc00)
plot(TFP and SR and S2 ? S2 : na, "S2", style=plot.style_circles, linewidth=1, color=#7cfc00)
plot(TFP and SR and S3 ? S3 : na, "S3", style=plot.style_circles, linewidth=1, color=#7cfc00)