Is it possible to draw a line into the future?

蹲街弑〆低调 提交于 2021-01-28 17:53:42

问题


For intraday timeframes.
Is it possible to draw a horizontal line on the first bar of the session, that has a length until the end of that session?
So, essentially drawing a line into the 'future'.

Something like this:


回答1:


It seems to be possible.
Code below is based on the answer of PineCoders-LucF to one of my previous questions line.new draws 2 lines instead of 1

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

start = timestamp(2020,03,13,10,30,0)
stop = timestamp(2020,03,16,16,00,0)
level = 2575

var line ln = line.new(start, level, stop, level, xloc=xloc.bar_time)

if barstate.islast
    line.set_x1(ln, start)
    line.set_x2(ln, stop)

Which results in



来源:https://stackoverflow.com/questions/60659820/is-it-possible-to-draw-a-line-into-the-future

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!