手动平仓后,机器人能捕捉到平仓操作然后计算收益切换策略状态等
if (GetPosition(PD_SHORT)[0]===0 && GetPosition(PD_LONG)[0]===0){
if (State!=STATE_IDLE){
var account = exchange.GetAccount();
if (account.Stocks > LastAccount.Stocks) {
Counter.w++;
} else {
Counter.l++;
}
LogProfit(_N(account.Stocks - InitAccount.Stocks), "收益率:", _N((account.Stocks - InitAccount.Stocks) * 100 / InitAccount.Stocks) + '%');
LastAccount = account;
}
State=STATE_IDLE;
}
开仓同理吧
Zero 感放分享,替你排版了下.