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);
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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?