Hi, I would like my EA to return the profit for all my open buy orders only. Can anyone help me code this, Tanks in advance
- How can I order profit for a single chart
- How can I get my EA to know the price of an open position
- Ask!
I got it
double buy_profit = 0;
int cnt=0;
for(cnt=OrdersTotal();cnt>=0;cnt--)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
// if( OrderMagicNumber()==1113 )
{
if(OrderType()==OP_BUY)
{
buy_profit+=OrderProfit() ;
}
}
}
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