pine-script - 从自定义输入设置策略佣金类型
问题描述
我想从我的脚本的输入中设置佣金类型(即使仍然可以在属性选项卡上更改它)。使用我当前的代码,我收到此错误:
无法使用“commission_type”=字符串调用“策略”。参数的类型应该是:const string
我尝试了不同的方法,但如果我想根据输入选项分配值,我会不断收到相同的错误。
input_commission_type =input(title = "", defval = '%', options=['%', 'per contract', 'per order'])
txt_input_commission_type := if input_commission_type == "%"
strategy.commission.percent
else if input_commission_type == "per contract"
strategy.commission.cash_per_contract
else if input_commission_type == "per order"
strategy.commission.cash_per_order
strategy(commission_type=txt_input_commission_type, ......
解决方案
推荐阅读
- java - Java中的打印列表
- javascript - PWA 与 Web 共享本地存储
- c# - 如何获取文本字体文件的标题(不是名称)?(TTF 和 OTF)
- java - 为 RecyclerView 创建适配器后未选中的分配警告
- r - 在可编辑的 renderDT 对象中更改值后更新 Shiny DT 和 SQLite
- r - R 是否包括有效的集合实现?
- python - 有没有办法在 linux 应用程序中注入一个字符串,所以我以后可以以某种方式读取它?
- javascript - 不进行react路由返回App组件
- java - java或jvm如何处理/渲染图形
- docker - Docker 正在运行,但收到错误消息说恶魔没有运行