简体   繁体   English

如何在特定时间内; plot Pine 脚本中的最高高和最低低

[英]How to within a specific time; plot the highest high and the lowest low in Pine script

I'm currently stuck in implementing Specific time while plotting the highest high and the lowest low of candle within a session say 0500 - 0800. I already was successfully with the 24 hour pivotal previous highest high and previous lowest low.我目前坚持实施特定时间,同时在 session 中绘制蜡烛的最高高点和最低低点,例如 0500 - 0800。我已经成功地处理了 24 小时关键的先前最高高点和先前最低低点。

study("Color highest bar", overlay = true)

newSession = change(time('D'))

[lo,hi] = security(syminfo.tickerid, 'D', [low,high], lookahead=barmerge.lookahead_on)

isToday = (year == year(timenow)) and (month == month(timenow)) and (dayofmonth == dayofmonth(timenow))
isHist  = not isToday

lobar   = lo == low
hibar   = hi == high

bgcolor(newSession       ? color.white  : na, transp = 75)
bgcolor(lobar and isHist ? color.red    : na, transp = 75)
bgcolor(hibar and isHist ? color.green  : na, transp = 75)

Use input.session to get the session time and then use the time() function to figure out if you are in that session. Use input.session to get the session time and then use the time() function to figure out if you are in that session.

Compare current high/low price with the ones you store in memory while you are in the session and update them if necessary.当您在 session 中时,将当前高/低价格与您存储在 memory 中的价格进行比较,并在必要时更新它们。

//@version=5
indicator('HHLL', overlay=true)

session_time = input.session("0500-0800", "Session")

is_in_session = time(timeframe.period, session_time)
is_new_session = not is_in_session[1] and is_in_session

var float hh = na
var float ll = na

if (is_new_session)
    hh := high
    ll := low
else if (is_in_session)
    if (high > hh)
        hh := high
    
    if (low < ll)
        ll := low

plot(is_in_session ? hh : na, "HH", color.green, 1, plot.style_circles)
plot(is_in_session ? ll : na, "LL", color.red, 1, plot.style_circles)

在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在松脚本交易视图中获得最高价,最低价和收盘价 - How to get highest high, lowest low and close of a session in pine script tradingview 如何在pinescript中获得特定时间范围的最高点和最低点 - How to get the highest high and the lowest low of specific timeframe in pinescript 我怎样才能 plot 在最后一个最高点和最后一个最低点之间划一条线? - How can I plot a line between last highest high and last lowest low? 你如何 plot 在图表的最后 2 根蜡烛的最高和最低价格的水平线与 pine 脚本? - How do you plot a horizontal line across the chart at the highest and lowest price of the last 2 candles with pine script? 如何 Plot 价格 label 当 Pivot 交叉或前一天高或低交叉发生时松脚本 - How to Plot Price label when Pivot crossover or Previous Day High or Low Crossover Occur-Pine Script Pine 脚本:当它发生时指示所有时间高/低 - Pine script: indicating all time high/low when it occurs 在一个条件下最低,在另一个条件下最高 - lowest low on a condition and highest high on another condition Pine Script - 如何 select 一个带有日期时间选择器的蜡烛条,并在此条的高点和低点绘制水平线 - Pine Script - How to select a candle stick bar with date time picker and draw horizontal lines at the high and low of this bar 如何在松树脚本中找到蜡烛的日高/低 - How to find the candle has day high / low in pine script Pine 脚本:从上午 9 点到上午 10 点绘制盘中交易时段的最高最低价格 - Pine script : Plot highest lowest price from 9am to 10am intraday session
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM