Hello all, and thanks in advance for reading this.
I'm having a little bit of trouble figuring out how to get two orders to close consecutively. For some reason, when I run the below code with live trading enabled and the "manual confirmation" box checked it brings up both trades for confirmation. I can successfully close both in the manual confirmation window. However, if I launch the EA without checking the manual confirmation box, only one trade closes, and the code never seems to run through the end. Any thoughts on what I'm doing wrong?
<CODE DELETED>
Please read some other posts before posting . . .
Please edit your post . . . please use the SRC button to post code: How to use the SRC button.
Hello all, and thanks in advance for reading this.
I'm having a little bit of trouble figuring out how to get two orders to close consecutively. For some reason, when I run the below code with live trading enabled and the "manual confirmation" box checked it brings up both trades for confirmation. I can successfully close both in the manual confirmation window. However, if I launch the EA without checking the manual confirmation box, only one trade closes, and the code never seems to run through the end. Any thoughts on what I'm doing wrong?
Why does the OrderClose() fail ? don't you want to know why ? read this: What are Function return values ? How do I use them ?
Thanks again Raptor -- I'll do some more searching next time. Just trying to solve these problems as quickly as possible. I appreciate the help.
Thanks again Raptor -- I'll do some more searching next time. Just trying to solve these problems as quickly as possible. I appreciate the help.
I think you're trying to close trades other Symbols at the price from the chart you have attached your EA
for example Bid EURUSD is not equal to Bid EURJPY
Thanks again Raptor -- I'll do some more searching next time. Just trying to solve these problems as quickly as possible. I appreciate the help.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello all, and thanks in advance for reading this.
I'm having a little bit of trouble figuring out how to get two orders to close consecutively. For some reason, when I run the below code with live trading enabled and the "manual confirmation" box checked it brings up both trades for confirmation. I can successfully close both in the manual confirmation window. However, if I launch the EA without checking the manual confirmation box, only one trade closes, and the code never seems to run through the end. Any thoughts on what I'm doing wrong?
int start()
{
if(OrderSelect(18346302,SELECT_BY_TICKET)==true) /* */
{
///Alert("Order Profit of the order 18231547 is ", OrderProfit());
double profit1 = OrderProfit();
}
if(OrderSelect(18346305,SELECT_BY_TICKET)==true)
{
///Alert("Order Profit of the order 18231559 is ", OrderProfit());
double profit2 = OrderProfit();
}
//Alert(profit1);
//Alert(profit2);
double netgain = profit1 + profit2;
if(netgain != 0)
{
if(OrderSelect(18346305, SELECT_BY_TICKET) == true)
{
OrderClose(18346305, 5, Bid, 100);
if (OrderSelect(18346302, SELECT_BY_TICKET) == true)
{
OrderClose(18346302, 5, Bid, 100);
}
///return;
}
}else
{
Alert("Conditions for Closure not met");
}
return;
}