Loading ...

来botvs半个月了,分享个手动介入策略后,机器人能捕捉到手动操作信息的代码吧

Author: 转角, Created: 2016-04-25 11:28:36, Updated:

手动平仓后,机器人能捕捉到平仓操作然后计算收益切换策略状态等

 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;
}

开仓同理吧


More

Zero 感放分享,替你排版了下.