CapnOscar

MyTrend

Choose timeframe for pivots ...Play with it you can find this useful
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?
//Coded by CapnOscar on 16.04.2015 - Say Thanks?
study(title="MyTrend", shorttitle="MyTrend", overlay=true)

picktf = input(title="Pick TimeFrame", type=resolution, defval="30")


previous_close = security(tickerid, picktf,close[1])
previous_open = security(tickerid, picktf,open[1])
cur_open = security(tickerid, picktf,open)
previous_high = security(tickerid, picktf,high[1])
previous_low = security(tickerid, picktf,low[1])
cur_high = security(tickerid, picktf,high)
cur_low = security(tickerid, picktf,low)




D = (cur_high - cur_low)
Q = (previous_high - previous_low)
P = (previous_high + previous_low + previous_close) / 3
R1 = (2*P)-previous_low
S1 = (2*P)-previous_high
R2 = P+(previous_high - previous_low)
S2 = P-(previous_high - previous_low)


rsic = close > P ? green : close < P ? red : orange

pv = plot(P, color=rsic, linewidth=3)
plr1 = plot(R1, color=silver)
plr2 = plot(R2, color=gray)
pls1 = plot(S1, color=silver)
pls2 = plot(S2, color=gray)