1
关注
0
关注者
pine语言想要实盘可以编写每次下单位账户资金的百分之多少吗
怎么写
相关推荐
评论
全部评论 (2)
pine
//@version=5
strategy("Percent of Equity Order", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// 简单的均线交叉策略
longCondition = ta.crossover(ta.sma(close, 14), ta.sma(close, 28))
shortCondition = ta.crossunder(ta.sma(close, 14), ta.sma(close, 28))
// 如果均线交叉条件满足,则买入或卖出
if (longCondition)
strategy.entry("Long", strategy.long)
if (shortCondition)
strategy.entry("Short", strategy.short)
// 指定default_qty_type=strategy.percent_of_equity后,设置default_qty_value为百分比数量(0~100),1即1%。按照账户中的计价货币数量计算下单量
// 例如当前账户有10000USDT,设置1%下单,即使用100USDT规模的下单量下单(卖出时根据当前价格计算)。
2 年前
- 1
