This is the relevant script.
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
As it stands, by default, the plot()
function checks every single bar/period and plots if the condition is true. I want to plot lucidSARbearish
and lucidSARbullish
separately as a yellow triangle (below for bullish, above for bearish), but it ends up overlapping with the shapes plotted by bullishcondition
and bearishcondition
.
How can I make it so that when lucidSARbearish
and lucidSARbullish
are true, it plots the yellow triangle just once, and doesn't plot again while bullishcondition
and/or bearishcondition
are true?
Thanks in advance.
I'm dumb, but I still don't exactly know how to have it only plot once then wait for the bullish/bearish conditions to go true to false to plot again. While not necessary, I think it'll be more useful that way.
lucidSARbullish=L_SAR < close and bullishcondition==false
lucidSARbearish=L_SAR > close and bearishconditon==false
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.