[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 13
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
int handle=FileOpen("OrdersReport.csv",FILE_WRITE|FILE_CSV,"\t");
if(handle<0) return(0);
//write header into file
FileWrite(handle, "#", "Opening price", "Opening time", "Symbol", "Lots");
int total=OrdersTotal();
// write only open orders into the file
for(int pos=0;pos<total;pos++)
{
if(OrderSelect(pos,SELECT_BY_POS,MODE_TRADES)==false) continue;
FileWrite(handle,OrderTicket(),OrderOpenPrice(),OrderOpenTime(),OrderSymbol(),OrderLots())
}
FileClose(handle);
Please, tell me how to use it in my EA ?
You've given your own answer - Maybe something needs to be fixed somewhere in the configuration or something...?
Where is the configuration? Please, tell me!
int handle=FileOpen("OrdersReport.csv",FILE_WRITE|FILE_CSV,"\t");
if(handle<0) return(0);
//write header into file
FileWrite(handle, "#", "Opening price", "Opening time", "Symbol", "Lots");
int total=OrdersTotal();
// write only open orders into the file
for(int pos=0;pos<total;pos++)
{
if(OrderSelect(pos,SELECT_BY_POS,MODE_TRADES)==false) continue;
FileWrite(handle,OrderTicket(),OrderOpenPrice(),OrderOpenTime(),OrderSymbol(),OrderLots())
}
FileClose(handle);
Can you tell me how to use it in my EA ?
Copy-paste ?!
You must insert the code in this way:
I understand but how to use it afterwards. Do I have to write a condition?
I understand but how to use it afterwards. Do I have to write a condition?
// This function returns the total amount of orders the expert advisor has opened
int TotalOpenOrders()
{
Cnt=OrdersTotal();
int TotalOpenOrders = 0;
if(Cnt==0)
{
return(0);
}
else
{
for(;Cnt>=0;Cnt--)
{
RefreshRates();
OrderSelect(Cnt,SELECT_BY_POS);
if(OrderMagicNumber()==Magic)
{
TotalOpenOrders++;
}
}
}
return(TotalOpenOrders);
}
And this function should be written before you start the program.
Where is this configuration? Please advise!
Read the articles
https://www.mql5.com/ru/articles/1490
https://www.mql5.com/ru/articles/1417
{ here?