小编Edu*_*rdo的帖子

如何在PineScript中获取default_qty_value?

我正在编写一个策略,我想根据策略设置中设置的 default_qty_value 执行计算。是的,我知道我可以使用strategy.position_avg_price来获取头寸大小,但这些计算必须在策略打开之前完成。

\n

有没有办法检索这个值,或者用户是否需要进行输入?

\n

这是代码。

\n
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/\n// \xc2\xa9 EduardoMattje\n//@version=4\n\nstrategy("Reversal closing price", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10, initial_capital=10000)\n\n// Settings\n\norder_direction = input("Both", "Order direction", options=["Both", "Long", "Short"])\nreward_risk_ratio = input(2.0, "Reward to risk ratio", minval=1.0, step=0.1)\nstop_lookback = input(3, "Stoploss candle lookback", minval=1)\nallow_retracing = input(true, "Allow price retracing")\ndisregard_trend = input(false, "Allow trades to take place regardless of the trend")\nma_cross_stop = input(false, "Close if MA crosses in oposite direction")\nsrc …
Run Code Online (Sandbox Code Playgroud)

trading pine-script

5
推荐指数
1
解决办法
2280
查看次数

标签 统计

pine-script ×1

trading ×1