Intraday S/R (Capriole Investments)

capriole_charles · study · 42 行 · 点赞 1,070 · TradingView 原页

本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。

Pine Script

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © capriole_charles
 
//@version=4
study("Intraday S/R",overlay=true)
 
// INPUTS
 
h = input(true,"Plot Yesterdays High")
l = input(true,"Plot Yesterdays Low")
o = input(true,"Plot Todays Open")
hist = input(true,"Plot Historic Levels")
 
// DAILY TF MGMT
 
is_newbar(res) =>
    t = time(res) 
    change(t) != 0 ? true : false
 
since_new_bar = barssince(is_newbar("D")) 
D_total_bars = 1
D_total_bars := since_new_bar == 0 ? since_new_bar[1] : D_total_bars[1]
 
// CALCS
 
otf_yest_high = security(syminfo.ticker,"D",high)
otf_yest_low = security(syminfo.ticker,"D",low)
otf_today_open = security(syminfo.ticker,"D",close )
 
yest_high = float(na)
yest_low = float(na)
today_open = float(na)
 
yest_high := barstate.isrealtime ? (since_new_bar == D_total_bars ? otf_yest_high : yest_high[1]) : otf_yest_high
yest_low := barstate.isrealtime ? (since_new_bar == D_total_bars ? otf_yest_low : yest_low[1]) : otf_yest_low
today_open := barstate.isrealtime ? (since_new_bar == D_total_bars ? otf_today_open : today_open[1]) : otf_today_open
 
// PLOT
 
plot(h? yest_high : na,color=color.red,transp=70,title=" Yesterdays High",show_last=(hist? na :1),trackprice=(hist? na: true))
plot(l? yest_low : na,color=color.green,transp=70,title=" Yesterdays Low",show_last=(hist? na :1),trackprice=(hist? na: true))
plot(o? today_open : na,color=color.gray,transp=70,title=" Todays Open",show_last=(hist? na :1),trackprice=(hist? na: true))

← 返回列表