OPEN-SOURCE SCRIPT

15min PD Array

241
//version=5
indicator("15min PD Array", overlay=true)

// Timeframe inputs
tf = "15"

// Get previous day's high, low, close
var float pdh = na
var float pdl = na
var float pdc = na

t = request.security(syminfo.tickerid, tf, time)
h = request.security(syminfo.tickerid, tf, high)
l = request.security(syminfo.tickerid, tf, low)
c = request.security(syminfo.tickerid, tf, close)

is_new_day = ta.change(time("D"))
var float temp_high = na
var float temp_low = na
var float temp_close = na

if is_new_day
pdh := temp_high
pdl := temp_low
pdc := temp_close
temp_high := na
temp_low := na
temp_close := na

temp_high := na(temp_high) ? h : math.max(temp_high, h)
temp_low := na(temp_low) ? l : math.min(temp_low, l)
temp_close := c

// Midpoint (EQ)
eq = (pdh + pdl) / 2

// Plotting
plot(pdh, color=color.green, title="PDH", linewidth=1, style=plot.style_linebr)
plot(pdl, color=color.red, title="PDL", linewidth=1, style=plot.style_linebr)
plot(pdc, color=color.gray, title="PDC", linewidth=1, style=plot.style_linebr)
plot(eq, color=color.orange, title="EQ (Mid)", linewidth=1, style=plot.style_linebr)

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.