OrderComment is "MyEaName "
ie space padded to 31 char. Use StringSubstr or StringFind functions
don't use comments to identify trades, use magic numbers.
I understand now. Thanks for making this clear!!
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
After #property link I have
extern string EAName = "MyEaName";
double closedProfit = 0;
somewhere after int init() I have
int i,hstTotal=OrdersHistoryTotal();
for(i=0;i<hstTotal;i++)
{OrderSelect(i, SELECT_BY_POS, MODE_HISTORY );
if ( OrderSymbol()==Symbol() && OrderComment() == EAName )
{closedProfit = closedProfit + OrderProfit();}
}
in the chart comments for my EA, I am using the closedProfit to pull up closed order profit from history but am getting a value of 0.
Any idea what I am doing wrong?
Thank you,
Jon