堡垒。执法问题 - 页 62 1...555657585960616263646566676869...156 新评论 Сергей 2015.12.23 10:53 #611 大家下午好!我的情况略有不同。经纪人 BCS。市价单不是第一次执行。发送在市场上购买的订单。该函数返回“已下订单”和订单号,但订单并未实际执行!所以机器人做了很多尝试。向市场发送买单,收到成功响应,但没有交易。同时,响应中的订单号每次都是新的。这样一来,仓位迟早会开,但你必须用订单轰炸经纪人,这显然是错误的。请帮忙,我不明白是我的机器人有问题还是经纪人搞砸了?没有关于机器人的投诉,所有验证功能都按预期进行,并且检查了答案。经纪人打来电话,但“顾问”耸了耸肩,好像如果用手打开了一笔交易,那么机器人就会出现错误,但是他们在这里倒闭了。 2015.12 . 23 11 : 02 : 00.053 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 55 ms 2015.12 . 23 11 : 02 : 00.006 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 59.554 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 53 ms 2015.12 . 23 11 : 01 : 59.507 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 59.413 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 116 ms 2015.12 . 23 11 : 01 : 59.304 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 59.117 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 52 ms 2015.12 . 23 11 : 01 : 59.055 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 58.774 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 54 ms 2015.12 . 23 11 : 01 : 58.711 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 58.680 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 53 ms 2015.12 . 23 11 : 01 : 58.633 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 58.259 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 74 ms 2015.12 . 23 11 : 01 : 58.181 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 57.916 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 53 ms 2015.12 . 23 11 : 01 : 57.869 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 57.775 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 52 ms 2015.12 . 23 11 : 01 : 57.729 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 57.682 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 52 ms 2015.12 . 23 11 : 01 : 57.619 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 57.557 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 53 ms 2015.12 . 23 11 : 01 : 57.510 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 57.385 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 53 ms 2015.12 . 23 11 : 01 : 57.323 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 57.292 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 53 ms 2015.12 . 23 11 : 01 : 57.245 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 57.058 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 63 ms 2015.12 . 23 11 : 01 : 56.995 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 56.777 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 52 ms 2015.12 . 23 11 : 01 : 56.730 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 56.481 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 53 ms 2015.12 . 23 11 : 01 : 56.434 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 56.169 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 53 ms 2015.12 . 23 11 : 01 : 56.122 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 56.075 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 52 ms 2015.12 . 23 11 : 01 : 56.028 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 55.451 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 53 ms 2015.12 . 23 11 : 01 : 55.389 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 55.326 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 53 ms 2015.12 . 23 11 : 01 : 55.279 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 55.155 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 52 ms 2015.12 . 23 11 : 01 : 55.092 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 55.045 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 54 ms 2015.12 . 23 11 : 01 : 54.983 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 54.983 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 52 ms 2015.12 . 23 11 : 01 : 54.921 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 54.843 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 53 ms 2015.12 . 23 11 : 01 : 54.796 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 54.655 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 53 ms 2015.12 . 23 11 : 01 : 54.609 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 54.546 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 53 ms 2015.12 . 23 11 : 01 : 54.484 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 54.453 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 151 ms 2015.12 . 23 11 : 01 : 54.297 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 53.844 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 52 ms 2015.12 . 23 11 : 01 : 53.797 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 53.751 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 53 ms 2015.12 . 23 11 : 01 : 53.688 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 53.423 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 52 ms 2015.12 . 23 11 : 01 : 53.376 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 53.361 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 60 ms 2015.12 . 23 11 : 01 : 53.298 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 53.283 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 52 ms 2015.12 . 23 11 : 01 : 53.236 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 53.142 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 53 ms 2015.12 . 23 11 : 01 : 53.080 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 53.033 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 53 ms 2015.12 . 23 11 : 01 : 52.986 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 52.877 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 52 ms 2015.12 . 23 11 : 01 : 52.830 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 52.830 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 69 ms 2015.12 . 23 11 : 01 : 52.752 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 52.643 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 53 ms 2015.12 . 23 11 : 01 : 52.596 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 52.487 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 53 ms 2015.12 . 23 11 : 01 : 52.440 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 52.425 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 53 ms 2015.12 . 23 11 : 01 : 52.378 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 52.081 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 55 ms 2015.12 . 23 11 : 01 : 52.019 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 51.988 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 52 ms 2015.12 . 23 11 : 01 : 51.941 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 51.879 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 51 ms 2015.12 . 23 11 : 01 : 51.832 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 51.364 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 52 ms 2015.12 . 23 11 : 01 : 51.317 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 51.223 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 53 ms 2015.12 . 23 11 : 01 : 51.161 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 51.114 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 53 ms 2015.12 . 23 11 : 01 : 51.052 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 50.989 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 52 ms 2015.12 . 23 11 : 01 : 50.943 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 50.693 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 52 ms 2015.12 . 23 11 : 01 : 50.631 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 50.584 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 52 ms 2015.12 . 23 11 : 01 : 50.521 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 50.475 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 52 ms 2015.12 . 23 11 : 01 : 50.412 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 50.397 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 52 ms 2015.12 . 23 11 : 01 : 50.350 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 50.225 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 53 ms 2015.12 . 23 11 : 01 : 50.178 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 50.147 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 52 ms 2015.12 . 23 11 : 01 : 50.100 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 50.053 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 52 ms 2015.12 . 23 11 : 01 : 49.991 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 49.975 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 52 ms 2015.12 . 23 11 : 01 : 49.913 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 2015.12 . 23 11 : 01 : 49.866 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 placed for execution in 51 ms 2015.12 . 23 11 : 01 : 49.804 Trades 'xxxxxxx' : exchange buy 66.00 Si- 3.16 at market sl: 72487 Mikhail Filimonov 2015.12.23 12:02 #612 Сергей:大家下午好!我的情况有点不同。我的经纪人是BCS。市场订单在第一次尝试时没有被执行。我在市场上发送了一个购买订单。该函数返回 "已下订单 "和订单号,但实际上该订单并没有被执行! 就这样,机器人做了很多尝试。在市场上发出购买指令,得到成功的回应,但没有交易。响应中的订单号每次都是新的。结果是,头寸迟早会打开,但我必须用订单轰击经纪人,这显然是错误的。我不知道是我的外汇机器人出了故障,还是我的经纪人出了故障。我对机器人没有任何要求,所有的检查程序都在正常工作,并且正在检查反应。我打电话给经纪人,但 "顾问 "摇摇手说,如果交易是用手打开的,那就意味着机器人是错误的,与他们无关。Sergiy!在没有看到你的代码之前,很难说什么。但是,从印刷品来看,你并没有适当地控制订单的安排。 Сергей 2015.12.23 12:50 #613 Михаил:谢尔盖!没有看到你的代码,很难说。但从打印结果来看,你没有正确控制订单的设置。米哈伊尔,这是终端日志,即它接受订单,说它是正确的,返回成功代码和订单号,也就是说,它把订单放在执行队列中,但不执行。而且是很多很多次。但我想我已经明白了。 根据算法,允许的风险允许你为整个存款开设交易。交易量=可用资金/GO,也就是说,存款几乎用到了最后一分钱。(当然,这是一个错误,不应该这样做)。从技术上讲,我们有足够的资金在这个量上开仓交易,订单被终端检查并被MT5内核接受(OrderSend函数 返回true和订单号)。 但是,订单在执行队列的某个地方被拒绝了(在经纪人处或在与交易所的网关处),结果没有被执行。这就是MT5在Metacquotes方面的缺陷所在。问题是,我作为一个客户,没有以任何方式被告知此事。机器人一切顺利,但事实上订单被经纪人/网关/交易所拒绝了(我只能在此猜测)。OrderSend函数本应拒绝订单并返回TRADE_RETCODE_NO_MONEY 错误代码给机器人 ,但由于某些原因没有发生。也许,我们需要详细追踪OnTradeTransaction 的执行。 Mikhail Filimonov 2015.12.23 12:55 #614 Сергей:迈克尔,这是终端日志,也就是说,它接受了订单,说它是正确填写的,返回成功代码和订单号,也就是说,它把订单放在执行队列中,但没有执行。而且是很多很多次。但我想我已经明白了。 根据算法,允许的风险允许你为整个存款开设交易。交易量=可用资金/CS,也就是说,存款几乎用到了最后一分钱。(这当然是个错误,你不能这样做)。从技术上讲,我们有足够的资金在这个量上开仓交易,订单被终端检查并被MT5内核接受(OrderSend函数 返回true和订单号)。 但是,订单在执行队列的某个地方被拒绝了(在经纪人处或在与交易所的网关处),结果没有被执行。这就是MT5在Metacquotes方面的缺陷所在。问题是,我作为一个客户,没有以任何方式被告知此事。对机器人来说,它是成功的,但事实上订单被经纪人/网关/交易所拒绝了(我只能在这里猜测)。OrderSend函数本应拒绝订单并返回TRADE_RETCODE_NO_MONEY 错误代码给机器人 ,但由于某些原因它没有这样做。再一次,你没有正确控制订单设置。您收到订单的账单并不意味着该订单已在交易所下达!您可以通过电话或电子邮件联系我们。 Сергей 2015.12.23 13:01 #615 Михаил:我再次重申,你没有正确控制订单的设置。仅仅因为您收到了一份订单的账单,并不意味着订单已经在交易所下达!您可以通过以下方式获得订单。我同意,事实证明,我在这个问题上有一个知识差距在这里。我以前从未遇到过这样的行为,我琐碎地通过市场发送,总是要么打开,要么立即出现错误。 我不需要深入了解队列中订单执行的 低层次细微差别。而在这里... Mikhail Filimonov 2015.12.23 13:11 #616 Сергей:同意,事实证明我在这个问题上有一个知识差距在这里。我以前没有遇到过这种行为,我曾经通过市场发送过琐事,它总是要么打开,要么立即出现错误。 一般来说,我没有必要去研究队列中订单执行 的低层次细节。而在这里...在收到一个订单后,使用OrderRealSelect()函数https://www.mql5.com/ru/forum/67298/page2#comment_2089220 ФОРТС: В помощь начинающим www.mql5.com Установка отложенного ордера командой OrderSend(). - Страница 2 - Категория: биржевой трейдинг Mikhail Filimonov 2015.12.23 13:23 #617 这大致上是你应该做的。//+------------------------------------------------------------------+ //| Test_array.mq5 | //| Copyright 2015, Mikalas | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2015, Mikalas" #property link "https://www.mql5.com" #property version "1.00" // #define ERR_ZERO_TICKET -1 // enum ENUM_ORD_REAL_STATE { ORD_NOT_SPECIFIED = 0, //Состояние ордера не определено ORD_NONE_CANCELED = 1, //Ордера нет, отменён пользователем ORD_NONE_PARTIAL_CANCELED = 2, //Ордера нет, исполнился частично (не был залит вторым объёмом) ORD_NONE_PARTIAL = 3, //Ордера нет, исполнился частично ORD_NONE_EXPIRED = 4, //Ордера нет, удалён по сроку ORD_NONE_FILLED = 5, //Ордера нет, исполнился полностью ORD_NONE_REJECTED = 6, //Ордера нет, отклонён брокером(биржей) ORD_BUSY = 7, //Ордер находится в переходном состоянии ORD_EXIST = 8, //Ордер выставлен на биржу, возможны действия над ним ORD_EXIST_PARTIAL = 9 //Ордер выставлен на биржу, частично исполнился, возможны действия над ним }; enum ENUM_ORD_SELECT { SELECT_ERROR = 0, SELECT_FALSE = 1, SELECT_TRUE = 2, SELECT_BUSY = 3 }; // struct ORDER_DATA { int error_code; datetime time_setup; ENUM_ORDER_TYPE type; ENUM_ORDER_STATE state; ENUM_ORD_REAL_STATE real_state; datetime expiration; datetime time_done; long t_set_msc; long t_done_msc; ENUM_ORDER_TYPE_FILLING type_filling; ENUM_ORDER_TYPE_TIME type_time; long magic; long pos_id; double vol_init; double vol_cur; double price_open; double sl; double tp; double price_cur; double price_stlim; string symbol; string comment; }; // // ulong order_ticket; // //+------------------------------------------------------------------+ // Expert Order Real Select function | //+------------------------------------------------------------------+ ENUM_ORD_SELECT OrderRealSelect( const ulong ticket, ORDER_DATA &ord_data, const bool get_data ) { double init_vol = 0; double cur_vol = 0; ZeroMemory( ord_data ); ord_data.real_state = ORD_NOT_SPECIFIED; ord_data.error_code = ERR_SUCCESS; ResetLastError(); //--- if ( ticket > 0 ) { if ( HistoryOrderSelect( ticket ) ) { if ( get_data ) { ord_data.comment = HistoryOrderGetString( ticket, ORDER_COMMENT ); ord_data.expiration = datetime( HistoryOrderGetInteger( ticket, ORDER_TIME_EXPIRATION ) ); ord_data.magic = HistoryOrderGetInteger( ticket, ORDER_MAGIC ); ord_data.pos_id = HistoryOrderGetInteger( ticket, ORDER_POSITION_ID ); ord_data.price_cur = HistoryOrderGetDouble( ticket, ORDER_PRICE_CURRENT ); ord_data.price_open = HistoryOrderGetDouble( ticket, ORDER_PRICE_OPEN ); ord_data.price_stlim = HistoryOrderGetDouble( ticket, ORDER_PRICE_STOPLIMIT ); ord_data.sl = HistoryOrderGetDouble( ticket, ORDER_SL ); ord_data.state = ENUM_ORDER_STATE( HistoryOrderGetInteger( ticket, ORDER_STATE ) ); ord_data.symbol = HistoryOrderGetString( ticket, ORDER_SYMBOL ); ord_data.t_done_msc = datetime( HistoryOrderGetInteger( ticket, ORDER_TIME_DONE_MSC ) ); ord_data.t_set_msc = datetime( HistoryOrderGetInteger( ticket, ORDER_TIME_SETUP_MSC ) ); ord_data.time_done = datetime( HistoryOrderGetInteger( ticket, ORDER_TIME_DONE ) ); ord_data.time_setup = datetime( HistoryOrderGetInteger( ticket, ORDER_TIME_SETUP ) ); ord_data.tp = HistoryOrderGetDouble( ticket, ORDER_TP ); ord_data.type = ENUM_ORDER_TYPE( HistoryOrderGetInteger( ticket, ORDER_TYPE ) ); ord_data.type_filling = ENUM_ORDER_TYPE_FILLING( HistoryOrderGetInteger( ticket, ORDER_TYPE_FILLING ) ); ord_data.type_time = ENUM_ORDER_TYPE_TIME( HistoryOrderGetInteger( ticket, ORDER_TYPE_TIME ) ); ord_data.vol_cur = HistoryOrderGetDouble( ticket, ORDER_VOLUME_CURRENT ); ord_data.vol_init = HistoryOrderGetDouble( ticket, ORDER_VOLUME_INITIAL ); } else { ord_data.state = ENUM_ORDER_STATE( HistoryOrderGetInteger( ticket, ORDER_STATE ) ); cur_vol = HistoryOrderGetDouble( ticket, ORDER_VOLUME_CURRENT ); init_vol = HistoryOrderGetDouble( ticket, ORDER_VOLUME_INITIAL ); } //--- switch( ord_data.state ) { case ORDER_STATE_CANCELED: if ( get_data ) { if ( ord_data.vol_init == ord_data.vol_cur ) { ord_data.real_state = ORD_NONE_CANCELED; } else { ord_data.real_state = ORD_NONE_PARTIAL_CANCELED; } } else { if ( init_vol == cur_vol ) { ord_data.real_state = ORD_NONE_CANCELED; } else { ord_data.real_state = ORD_NONE_PARTIAL_CANCELED; } } break; case ORDER_STATE_PARTIAL: ord_data.real_state = ORD_NONE_PARTIAL; break; case ORDER_STATE_EXPIRED: ord_data.real_state = ORD_NONE_EXPIRED; break; case ORDER_STATE_FILLED: ord_data.real_state = ORD_NONE_FILLED; break; case ORDER_STATE_REJECTED: ord_data.real_state = ORD_NONE_REJECTED; break; } } else if ( OrderSelect( ticket ) ) { if ( get_data ) { ord_data.comment = OrderGetString( ORDER_COMMENT ); ord_data.expiration = datetime( OrderGetInteger( ORDER_TIME_EXPIRATION ) ); ord_data.magic = OrderGetInteger( ORDER_MAGIC ); ord_data.pos_id = OrderGetInteger( ORDER_POSITION_ID ); ord_data.price_cur = OrderGetDouble( ORDER_PRICE_CURRENT ); ord_data.price_open = OrderGetDouble( ORDER_PRICE_OPEN ); ord_data.price_stlim = OrderGetDouble( ORDER_PRICE_STOPLIMIT ); ord_data.sl = OrderGetDouble( ORDER_SL ); ord_data.state = ENUM_ORDER_STATE( OrderGetInteger( ORDER_STATE ) ); ord_data.symbol = OrderGetString( ORDER_SYMBOL ); ord_data.t_done_msc = datetime( OrderGetInteger( ORDER_TIME_DONE_MSC ) ); ord_data.t_set_msc = datetime( OrderGetInteger( ORDER_TIME_SETUP_MSC ) ); ord_data.time_done = datetime( OrderGetInteger( ORDER_TIME_DONE ) ); ord_data.time_setup = datetime( OrderGetInteger( ORDER_TIME_SETUP ) ); ord_data.tp = OrderGetDouble( ORDER_TP ); ord_data.type = ENUM_ORDER_TYPE( OrderGetInteger( ORDER_TYPE ) ); ord_data.type_filling = ENUM_ORDER_TYPE_FILLING( OrderGetInteger( ORDER_TYPE_FILLING ) ); ord_data.type_time = ENUM_ORDER_TYPE_TIME( OrderGetInteger( ORDER_TYPE_TIME ) ); ord_data.vol_cur = OrderGetDouble( ORDER_VOLUME_CURRENT ); ord_data.vol_init = OrderGetDouble( ORDER_VOLUME_INITIAL ); } else { ord_data.state = ENUM_ORDER_STATE( OrderGetInteger( ORDER_STATE ) ); } //--- switch( ord_data.state ) { case ORDER_STATE_STARTED: case ORDER_STATE_REQUEST_ADD: case ORDER_STATE_REQUEST_MODIFY: case ORDER_STATE_REQUEST_CANCEL: ord_data.real_state = ORD_BUSY; break; case ORDER_STATE_PARTIAL: ord_data.real_state = ORD_EXIST_PARTIAL; break; case ORDER_STATE_PLACED: ord_data.real_state = ORD_EXIST; break; } } else { ord_data.error_code = GetLastError(); } //--- if ( ( ord_data.error_code != ERR_SUCCESS ) || ( ord_data.real_state == ORD_NOT_SPECIFIED ) ) { return( SELECT_ERROR ); } else { switch( ord_data.real_state ) { case ORD_BUSY: return( SELECT_BUSY ); break; case ORD_EXIST: case ORD_EXIST_PARTIAL: return( SELECT_TRUE ); break; default: return( SELECT_FALSE ); break; } } } else { ord_data.error_code = ERR_ZERO_TICKET; return( SELECT_ERROR ); } } //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { return( INIT_SUCCEEDED ); } // void OnTick() { if ( PositionSelect( _Symbol ) ) { //Позиция открыта, ордер исполнился } else { if ( order_ticket > 0 ) { //Проверяем что с ордером ORDER_DATA order_data; ENUM_ORD_SELECT ord_select = OrderRealSelect( order_ticket, order_data, true ); switch( ord_select ) { case SELECT_BUSY: //Ничего не делаем, ордер в переходном состоянии break; case SELECT_FALSE: //Ордера нет .... Проверяем, что с ним произошло break; case SELECT_TRUE: //Ордер есть.... Проверяем почему есть, а не исполнился break; case SELECT_ERROR: //Проверяем что за ошибка break; } } else { //Позиции нет, ордера нет. Устанавливаем ордер } } } Сергей 2015.12.23 14:10 #618 Михаил:这大致上是你应该做的。 米哈伊尔,谢谢你!这是一个非常有用的功能。 Mikhail Filimonov 2015.12.27 21:25 #619 这个话题开始至今已经一年了....:( ALIV 2015.12.28 08:47 #620 <br / translate="no">Aitugan,也许终究会有一些评论?:((我当然理解,非常不想分散你在塞浦路斯度假的注意力,但不知为何,这种沉默已经持续了很长时间。:(( 1...555657585960616263646566676869...156 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
大家下午好!
我的情况略有不同。经纪人 BCS。市价单不是第一次执行。
发送在市场上购买的订单。该函数返回“已下订单”和订单号,但订单并未实际执行!
所以机器人做了很多尝试。向市场发送买单,收到成功响应,但没有交易。同时,响应中的订单号每次都是新的。
这样一来,仓位迟早会开,但你必须用订单轰炸经纪人,这显然是错误的。
请帮忙,我不明白是我的机器人有问题还是经纪人搞砸了?没有关于机器人的投诉,所有验证功能都按预期进行,并且检查了答案。
经纪人打来电话,但“顾问”耸了耸肩,好像如果用手打开了一笔交易,那么机器人就会出现错误,但是他们在这里倒闭了。
大家下午好!
我的情况有点不同。我的经纪人是BCS。市场订单在第一次尝试时没有被执行。
我在市场上发送了一个购买订单。该函数返回 "已下订单 "和订单号,但实际上该订单并没有被执行!
就这样,机器人做了很多尝试。在市场上发出购买指令,得到成功的回应,但没有交易。响应中的订单号每次都是新的。
结果是,头寸迟早会打开,但我必须用订单轰击经纪人,这显然是错误的。
我不知道是我的外汇机器人出了故障,还是我的经纪人出了故障。我对机器人没有任何要求,所有的检查程序都在正常工作,并且正在检查反应。
我打电话给经纪人,但 "顾问 "摇摇手说,如果交易是用手打开的,那就意味着机器人是错误的,与他们无关。
Sergiy!
在没有看到你的代码之前,很难说什么。
但是,从印刷品来看,你并没有适当地控制订单的安排。
谢尔盖!
没有看到你的代码,很难说。
但从打印结果来看,你没有正确控制订单的设置。
米哈伊尔,这是终端日志,即它接受订单,说它是正确的,返回成功代码和订单号,也就是说,它把订单放在执行队列中,但不执行。而且是很多很多次。
但我想我已经明白了。
根据算法,允许的风险允许你为整个存款开设交易。交易量=可用资金/GO,也就是说,存款几乎用到了最后一分钱。(当然,这是一个错误,不应该这样做)。
从技术上讲,我们有足够的资金在这个量上开仓交易,订单被终端检查并被MT5内核接受(OrderSend函数 返回true和订单号)。
但是,订单在执行队列的某个地方被拒绝了(在经纪人处或在与交易所的网关处),结果没有被执行。这就是MT5在Metacquotes方面的缺陷所在。
问题是,我作为一个客户,没有以任何方式被告知此事。机器人一切顺利,但事实上订单被经纪人/网关/交易所拒绝了(我只能在此猜测)。
OrderSend函数本应拒绝订单并返回TRADE_RETCODE_NO_MONEY 错误代码给机器人 ,但由于某些原因没有发生。
也许,我们需要详细追踪OnTradeTransaction 的执行。
迈克尔,这是终端日志,也就是说,它接受了订单,说它是正确填写的,返回成功代码和订单号,也就是说,它把订单放在执行队列中,但没有执行。而且是很多很多次。
但我想我已经明白了。
根据算法,允许的风险允许你为整个存款开设交易。交易量=可用资金/CS,也就是说,存款几乎用到了最后一分钱。(这当然是个错误,你不能这样做)。
从技术上讲,我们有足够的资金在这个量上开仓交易,订单被终端检查并被MT5内核接受(OrderSend函数 返回true和订单号)。
但是,订单在执行队列的某个地方被拒绝了(在经纪人处或在与交易所的网关处),结果没有被执行。这就是MT5在Metacquotes方面的缺陷所在。
问题是,我作为一个客户,没有以任何方式被告知此事。对机器人来说,它是成功的,但事实上订单被经纪人/网关/交易所拒绝了(我只能在这里猜测)。
OrderSend函数本应拒绝订单并返回TRADE_RETCODE_NO_MONEY 错误代码给机器人 ,但由于某些原因它没有这样做。
再一次,你没有正确控制订单设置。
您收到订单的账单并不意味着该订单已在交易所下达!您可以通过电话或电子邮件联系我们。
我再次重申,你没有正确控制订单的设置。
仅仅因为您收到了一份订单的账单,并不意味着订单已经在交易所下达!您可以通过以下方式获得订单。
我同意,事实证明,我在这个问题上有一个知识差距在这里。
我以前从未遇到过这样的行为,我琐碎地通过市场发送,总是要么打开,要么立即出现错误。
我不需要深入了解队列中订单执行的 低层次细微差别。而在这里...
同意,事实证明我在这个问题上有一个知识差距在这里。
我以前没有遇到过这种行为,我曾经通过市场发送过琐事,它总是要么打开,要么立即出现错误。
一般来说,我没有必要去研究队列中订单执行 的低层次细节。而在这里...
在收到一个订单后,使用OrderRealSelect()函数
https://www.mql5.com/ru/forum/67298/page2#comment_2089220
这大致上是你应该做的。
这大致上是你应该做的。
Aitugan,也许终究会有一些评论?:((
我当然理解,非常不想分散你在塞浦路斯度假的注意力,但不知为何,这种沉默已经持续了很长时间。:((