[英]how can I get last trade result?
How can I get the last trade result in mql4 bot?我怎样才能在 mql4 机器人中获得最后的交易结果? I mean the part of code, mine does not work.
我的意思是代码的一部分,我的不起作用。 This is code, how can I do it?
这是代码,我该怎么做?
int a = 0;
while(a == 0){
OrderSend(Symbol(),OP_BUY,0.01,price,5,0,(Ask+0.0002),0,0,0,Green);
a = 1;
}
//if(OrderSelect(OrdersTotal()-1, SELECT_BY_POS)==true){
// Print("Profit for the order 10 " + OrderProfit());
//}
//else{
// Print("OrderSelect returned the error of " + GetLastError());
//}
OrderSelect(OrderTicket(), SELECT_BY_POS);
Print("Profit for the order 10 " + OrderProfit());
OrderModify(OrderTicket(),OrderOpenPrice(),(Ask-0.0001),0,0,0);
if(OrderProfit()<0){
OrderSend(Symbol(),OP_SELL,0.01,price,5,0,0,0,0,0,Green);
}
else{
OrderSend(Symbol(),OP_BUY,0.01,price,5,0,0,0,0,0,Red);
}
To select last open or pending order from trading pool:至 select 交易池中最后未平仓或挂单:
OrderSelect(OrdersTotal()-1, SELECT_BY_POS);
If you want to select last closed or canceled order:如果要 select 最后关闭或取消的订单:
OrderSelect(OrdersHistoryTotal()-1, SELECT_BY_POS, MODE_HISTORY);
You can get more information in the docs OrderSelect()您可以在文档OrderSelect()中获取更多信息
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.