简体   繁体   中英

Pine script - plot only once after buy condition is met

I have a pine script that plots flag shape when a target is met after a buy condition. The problem is it plots every subsequent target for the same buy condition. Does anyone have a script that would plot a target only once for that particular buy condition?

You need to store condition for plotting in some var variable:

var plot_condition = 0
plot_condition := 0

if buy_condition
    ....
    plot_condition := 1

plot(plot_condition? data : na, style = shape.xcross)

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM