如何根据先前的绘图Pine Script有条件地绘图

问题描述 投票:0回答:1

我正在制作简单的Swing High和Swing Low查找器/警报,并且一切正常,除了在很多情况下Swing High接连出现而又是Swing高。

逻辑很简单-如果前两根蜡烛低于此蜡烛,而后两根蜡烛也低于该蜡烛,则定义为摆动高

我要实现的是仅在前一个图没有一直高摆高时才将高摆高。

这里是代码

//@version=4
study("Swing Point Finder")

hhCondition = high[4] < high[2] and high[3] < high[2] and high[1] < high[2] and high < high[2]
llCondition = low[4] > low[2] and low[3] > low[2] and low[1] > low[2] and low > low[2]


plot(hhCondition ? 1 : 0, "Swing High found", color.green, offset = -2)
plot(llCondition ? 1 : 0, "Swing Low found", color.red, offset = -2)
    

我正在制作简单的Swing High和Swing Low查找器/警报,并且一切正常,除了在许多情况下Swing High接连出现而又是Swing高。逻辑很简单-高摆幅是...

pine-script trading tradingview-api
1个回答
0
投票

也许您可以尝试这样的事情:

© www.soinside.com 2019 - 2024. All rights reserved.