【问题标题】:How to plot a straight horizontal line based on the highest high of the latest 'n' candles?如何根据最新的“n”根蜡烛的最高点绘制一条水平直线?
【发布时间】:2021-01-08 21:47:50
【问题描述】:

我想在最新的“n”根蜡烛的最高点绘制一条水平直线。不是基于之前最高的 'n' 根蜡烛,而是所有这些 'n' 根蜡烛中最高的。请检查屏幕截图。

我知道情节从过去开始,并在“未来”发生某些事情时发生变化,但由于数据就在那里,我想这个逻辑也可以实现。

下面是通常的“highesthigh”代码,但当然它不适用于此。

n=72
highestHigh = highest(high, n)
plot(highestHigh) 

任何帮助将不胜感激!

【问题讨论】:

    标签: pine-script algorithmic-trading trading


    【解决方案1】:
    //@version=4
    study("Help (line back)", overlay=true)
    
    bars_back=input(5,"Bars back")
    n        =input(10, "High back")
    
    highestHigh = highest(high, n)
    line.new(bar_index-bars_back, highestHigh, bar_index, highestHigh, extend=extend.none) // draws a line to the next high
    

    【讨论】:

    • 通过钥匙孔很难看到房间。所以我不明白你的问题。
    猜你喜欢
    • 1970-01-01
    • 2021-08-17
    • 2022-11-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-07-20
    相关资源
    最近更新 更多