Summing up sell and buy orders function in mql5 help
A buy order (+1) plus a sell order (-1) total up to no position at all. Unless you just love handing over your money to your broker then don't ever open a position and then instantly close it with an opposite order.
This 'hedging' thing is driving me mad since a week. It's like a promise to generate money out of nothing, like the perpetuum mobile to generate energy out of nothing.
There's some badly arranged brace here:
if(selected==true) // if the position is selected double addM=PositionGetDouble(POSITION_PROFIT); {
I think you meant:
if(selected) // if the position is selected { double addM=PositionGetDouble(POSITION_PROFIT);
bool selected= PositionGetTicket(i);
The EA opens 1 buy and 1 sell order at the same time. This function is supposed to add up the sell and buy orders and return net profit. The problem is, the code does seem
to sum both it only sums 1 order . What is the
problem?