检查线路状况 - 已触及/未触及
我需要检查一条线的状况(触及、未触及、交易)以有条件地设置它们的样式。
我擅长“交易”条件(蜡烛收于线之上/之下),但不知道如何识别“触及/未触及”条件。 (例如,只是将一根灯芯插入该线)
有人能指点一下吗?
I need to examine the condition of a line (touched, untouched, traded) to conditionally style them.
I am good with "traded" condition (candle closes above/below line) but got no idea how to identify the "touched/untouched" condition. (e.g. just a wick into that line)
Someone please got a pointer?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该查看高值和低值以查看是否触及线条。
例如,假设该线位于 120 处,最高价为 130,收盘价为 110。
通过查看这些值,您可以看到价格突破该线并回落到该线下方。于是,底线就被触动了。
要检查该线是否未被触及,只需检查是否
high < 120
。对于低于价格的线,执行相反的过程。
You should look at the high and low values to see if a line is touched.
For example, say the line is at 120, high price is 130 and close price is 110.
By looking at those values, you can see that the price pushed through the line and pulled back below it. So, the line was touched.
To check if the line is untouched, simply check if
high < 120
.Reverse the process for a line below the the price.
现在您可以使用
line.get_price(LineA, bar_index+1)
。我已经使用了 ta.cross(close, line.get_price(LineA, bar_index) 并让它对我很有用。
Now you can use
line.get_price(LineA, bar_index+1)
.I have used
ta.cross(close, line.get_price(LineA, bar_index)
and had it work good for me.