Pine Script 中的当前价格指标 [英] Indicator for current price in Pine Script
问题描述
有没有办法在 Pine Script 中创建一个反映股票当前价格的指标?我需要这个指标,因为我需要在蜡烛关闭之前输入订单(当存在特定交叉时)并且回测数据是逐条提供的.我认为一个指标可以让我做到这一点,如果没有,还有其他方法可以解决这个问题.
Is there a way to create an indicator which reflects the current price of a stock in Pine Script? I need this indicator because I need to enter an order before the candle closes (when there is a specific crossover) and the data for back testing is provided bar by bar. I think an indicator can allow me to do this and if not is there another way to tackle this.
我不是一个有经验的 pine 脚本编写者,任何帮助将不胜感激:)谢谢,
I am not an experienced pine scripter and any help will be greatly appreciated:) Thanks,
推荐答案
未确认柱状期间的 close
代表资产的当前价格.
The close
during unconfirmed bar represent the current price of the asset.
但是,tradingview 的回测引擎只会在下一个蜡烛图上执行订单.在这里查看原因 - https://www.tradingview.com/pine-script-docs/en/v4/language/Execution_model.html#execution-model
However the tradingview's backtesting engine will execute the order only on next candle. See here why - https://www.tradingview.com/pine-script-docs/en/v4/language/Execution_model.html#execution-model
这篇关于Pine Script 中的当前价格指标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!