Forum on trading, automated trading systems and testing trading strategies
When you post code please use the CODE button (Alt-S)!
Forum on trading, automated trading systems and testing trading strategies
When you post code please use the CODE button (Alt-S)!
EA 设计 考虑 有 仓 位的 情况下 出现 相反信号 ,用 ORDER_TYPE_SELL_STOP 模式 来 平仓 并反向 开仓
发现 标准库 Trade.mqh 中 CTrade 类 平仓 函数PositionClose 全部 是 m_request.action =TRADE_ACTION_DEAL 模式 没有 m_request.action =TRADE_ACTION_PENDING 模式 可以 用来 stop 平仓 , 于是自己 添加 了一个 函数 用来 作 stop 平仓
函数如下
回测时 发现 这个平仓 函数从来 就 没有 成功 执行 过 ,问题在哪里 呢 ,难道 MT5 没办法 用 TRADE_ACTION_PENDING 模式平仓 , TRADE_ACTION_PENDING 模式 只能 开仓 ?