Forum

profit calculation for only open buy orders

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. if ( PositionSelect ( _Symbol )== true ) { double Profit_Sum= 0 ; for ( int i= PositionsTotal ()- 1 ; i>= 0

How to get open prices for the buy and sell trades seperately?

void OnTick () { if ( (myMovingAverageArray20[ 0 ]>MyMovingAverageArray50[ 0 ]) && (myMovingAverageArray20[ 1 ]<MyMovingAverageArray50[ 1 ]) ) if (CountBuyPositions()== 0 && CountSellPositions()== 1 ) { trade.Buy( 2 *Lot, NULL ,Ask, 0 , 0 , NULL ); } if