止损功能在Pine编辑器中不起作用

stop loss feature isn't working in pine editor

提问人:Zev Ahmir 提问时间:8/31/2023 更新时间:8/31/2023 访问量:8

问:

这些止损都不起作用,一个是固定的美元金额,另一个是基于整体账户价值的百分比,请寻求帮助:

loss_threshold = input(-50, title="Loss Threshold")
percent_loss_threshold = input(0.3, title="Percent Loss Threshold (%)")

// Calculate percent loss
account_balance = strategy.equity
percent_loss = (unrealized_pnl / account_balance) * 100

/ Define auto close condition for percent loss
`if percent_loss <= -percent_loss_threshold
strategy.close("Long")
strategy.close("Short")
交易 tradingview-API quantitative-finance pine-script-v4

评论


答: 暂无答案