简体   繁体   English

Pine 脚本 - 满足购买条件后仅绘制一次

[英]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变量中存储绘图条件:

var plot_condition = 0
plot_condition := 0

if buy_condition
    ....
    plot_condition := 1

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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