Ugur Karaes: I am able to get the profit of the first buy trade but when I open another buy it does not sum it. How can I calculate the profit for all open buy orders? Thanks in advance.
You have to select the position within the loop iterations ...
double Profit_Sum = 0; for( int i = PositionsTotal() - 1; i >= 0; i-- ) { if( PositionGetSymbol( i ) == _Symbol ) Profit_Sum += PositionGetDouble( POSITION_PROFIT ); };
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
I am able to get the profit of the first buy trade but when I open another buy it does not sum it.
How can I calculate the profit for all open buy orders?
Thanks in advance.