Pine Script策略在处理成交量时无法正常工作。

huangapple go评论51阅读模式
英文:

Pine Script Strategy doesn't work with volume

问题

//@version=5
strategy("成交量测试脚本", overlay=true)

conditionForBuy = volume > volume[1]*2
if(conditionForBuy)
    strategy.entry("买入", strategy.long)
英文:
//@version=5
strategy("Volume Test Script", overlay=true)

conditionForBuy = volume > volume[1]*2
if(conditionForBuy)
    strategy.entry("buy", strategy.long)

I am testing a strategy with pine script on tradingview, but the strategy never buys when the volume condition fulfills, but when I change this to a study, it's able to plot where the volume doubles from previous bar.

答案1

得分: 1

噢,它可以买。只是从不卖,因为你没有相关的代码。你持有的是长仓。 使用 strategy.exit()strategy.close() 来平仓。

英文:

Oh, it buys alright. It just never sells as you don't have any piece of code for that. You are stuck in a long position.

Pine Script策略在处理成交量时无法正常工作。

Use strategy.exit() or strategy.close() to close your position.

huangapple
  • 本文由 发表于 2023年5月29日 11:27:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/76354516.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定