[英]How to plot a shape once and stop plotting while another condition is met?
這是相關的腳本。
lucidSARbullish=L_SAR < close
lucidSARbearish=L_SAR > close
bullishcondition=twohrRSI > 50 and price > lwma[1] and diplus > diminus and macd > signal and hist > 0 and oc == 1 and ruleState == 1
and adx > 20 and sqzmombull == true
bearishcondition=twohrRSI < 50 and price < lwma[1] and diplus < diminus and macd < signal and hist < 0 and oc != 1 and ruleState == -1
and adx > 20 and sqzmombear == true
按照目前的情況,默認情況下, plot()
函數會檢查每個柱/周期,如果條件為真,則繪制圖表。 我想將lucidSARbearish
和lucidSARbullish
分別繪制為一個黃色三角形(下方為看漲,上方為看跌),但它最終與bullishcondition
和bearishcondition
繪制的形狀重疊。
我怎樣才能做到當lucidSARbearish
和lucidSARbullish
為真時,它只繪制一次黃色三角形,並且在bullishcondition
和/或bearishcondition
為真時不再繪制?
提前致謝。
我很笨,但我仍然不完全知道如何讓它只繪制一次,然后等待看漲/看跌條件變為真到假再繪制。 雖然不是必需的,但我認為這樣會更有用。
lucidSARbullish=L_SAR < close and bullishcondition==false
lucidSARbearish=L_SAR > close and bearishconditon==false
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.