简体   繁体   English

Pine 脚本:从上午 9 点到上午 10 点绘制盘中交易时段的最高最低价格

[英]Pine script : Plot highest lowest price from 9am to 10am intraday session

Can anybody help me how to do script which :任何人都可以帮助我如何编写脚本:

  • Plot the highest price level within 9am-10am绘制上午 9 点至上午 10 点内的最高价格水平
  • plot the lowest price level within 9am-10am绘制上午 9 点至上午 10 点内的最低价格水平

Both line will be my guide for intraday session ( 1min chart ) and will plot until the end of session (5pm)两条线都将作为我的盘中交易指南(1 分钟图),并将绘制到交易时段结束(下午 5 点)

Is this what you're looking for?这是你要找的吗?

//@version=4
study("My Script", overlay=true)

var int trackingStartHour = input(9, "Tracking start hour", minval=0, maxval=23)
var float hi = na
var float lo = na
var line_hi  = line.new(x1=na, y1=na, x2=na, y2=na, xloc=xloc.bar_time, extend=extend.right, color=color.green, style=line.style_dashed)
var line_lo  = line.new(x1=na, y1=na, x2=na, y2=na, xloc=xloc.bar_time, extend=extend.right, color=color.red,   style=line.style_dashed)

f_moveLine(_id, _x, _y) =>
    line.set_xy1(_id, _x,   _y)
    line.set_xy2(_id, _x+1, _y)
    
bool isNewDate = change(time("D"))

if isNewDate
    hi := na
    lo := na
    
if (hour == trackingStartHour)
    hi := max(nz(hi), high)
    lo := min(lo ? lo : 1.0e23, low)

canPlot    = hour >  trackingStartHour
showDashed = hour > trackingStartHour

plot(canPlot ? hi : na, "hi", color.green, style=plot.style_linebr)
plot(canPlot ? lo : na, "lo", color.red, style=plot.style_linebr)

if (showDashed and year(time)==year(timenow) and month(time)==month(timenow) and dayofmonth(time)==dayofmonth(timenow))
    f_moveLine(line_hi, time, hi)
    f_moveLine(line_lo, time, lo)

暂无
暂无

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

相关问题 你如何 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? 从最后一个条件到现在 pine 脚本获取最低价格 - Get the Lowest price from last condition till now pine script 如何在特定时间内; plot Pine 脚本中的最高高和最低低 - How to within a specific time; plot the highest high and the lowest low in Pine script 如何在松脚本交易视图中获得最高价,最低价和收盘价 - How to get highest high, lowest low and close of a session in pine script tradingview 将数组的元素值传递给 pine 脚本中的最低或最高功能 - Passing array's element values to lowest or highest functions in pine script Pine Script 中的偏移地块价格交叉地块价格 - Offset plot price crossing plot price in Pine Script 我想在输入 pine 脚本后找到最高价格 - i wants to make find a highest price after entry in pine script 如何在 Pine 脚本的较低时间范围内绘制上个月的最高价格? - How to draw highest price of the previous month in the lower timeframes in Pine script? Pine Script:绘制最后 10 根柱线中最低点的线 - Pine Script: Draw hline of the lowest low in the last 10 bars Pine Script Tradingview:当plot离价格太远时,如何防止图表被压缩? - Pine Script Tradingview: How to prevent the chart from being compressed when the plot is too far from the price?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM