【发布时间】:2021-08-11 11:51:55
【问题描述】:
我有一个 pinescript 指标,我想在最后 14 根蜡烛满足指标条件并且满足特定 tsi 和随机 rsi 条件时绘制线条。
指标条件
if buy_goodf or buy_greatf or buy_incrediblef
line.new(bar_index[0], low-lineheightbottom*LineLength, bar_index[0], high+lineheighttop*LineLength, color=color.new(color.lime, 50), width=linewidth)
if sell_goodf or sell_greatf or sell_incrediblef
line.new(bar_index[0], low-lineheightbottom*LineLength, bar_index[0], high+lineheighttop*LineLength, color=color.new(color.red, 50), width=linewidth)
所以这部分效果很好,我测试了线条是否正确显示。
但现在我想在每根蜡烛上画一条蓝线:-
-
在最近 14 根蜡烛中,有一条买入线(即
buy_goodf or buy_greatf or buy_incrediblef已满足。 -
有 tsi 和 stochrsi 是某种方式。
我遇到的唯一问题是第一点 - 如何检查每根蜡烛是否在最后 13 根蜡烛中存在买入条件。
我尝试使用这样的 for 循环对其进行编码,但这并没有给我信号。
for i = 0 to 13
if (buy_goodf or buy_greatf or buy_incrediblef) and tsi_value>tsi_ema and tsi_value[1]<tsi_ema[1] and k[1]<d[1] and k>d
line.new(bar_index[0], low-lineheightbottom*LineLength, bar_index[0], high+lineheighttop*LineLength, color=color.new(color.blue, 50), width=linewidth)
这是正确的做法吗?
【问题讨论】:
标签: pine-script