You just need to check the order symbol at the same time you check the magic so...
if(OrderMagicNumber() == getMagic() && OrderSymbol() == Symbol())
Lux
Thank you very much Lux!
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 following code appears to correctly report the profit being made in trades across all pairs trading on one account. But I need it to report specifically on the currency pair it is trading in. Could someone kindly amend the code to achieve this. Thanks
double profitCount()
{
double oc = 0;
for(int cnt = 0 ;cnt<OrdersTotal();cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderMagicNumber() == getMagic())
{
oc+= OrderProfit()+OrderSwap()+OrderCommission();
}
}
return(oc);
}