MT4_Account history to Excel

 
Is there a way to export the account history to excel?

Thanks
 
you can write the history to a file with the filefunctions and then maybe use it for exel
 

Open the chart and do the menu File -- "Save as..."


You have the option to save a CSV (which excel can read).

 
someone wrote an EA that exports order history as a .CSV file, i modified to run it as a script

static int mPrev;
int m;
// Modified to run as a script
int init()
  {
   mPrev=Minute();
   return(0);
  }
//+------------------------------------------------------------------+
int start()
  {
   int i,handle,hstTotal=HistoryTotal();
   m=Minute();
   if(1==1)
      {
      mPrev=m;
      handle=FileOpen("OrdersReport.csv",FILE_WRITE|FILE_CSV,",");
      if(handle<0) return(0);
      FileWrite(handle,"#,Open Time,Type,Lots,Symbol,Price,Stop/Loss,Take Profit,Close Time,Close Price,Profit,Comment");
      for(i=0;i<hstTotal;i++)
         {
         if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==true)
            {
            FileWrite(handle,OrderTicket(),TimeToStr(OrderOpenTime(),TIME_DATE|TIME_MINUTES),OrderType(),OrderLots(),OrderSymbol(),OrderOpenPrice(),OrderStopLoss(),OrderTakeProfit(),TimeToStr(OrderCloseTime(),TIME_DATE|TIME_MINUTES),OrderClosePrice(),OrderProfit(),OrderComment());
            }
         }
      FileClose(handle);
      }
   return(0);
  }
//+------------------------------------------------------------------+
save it in your scripts folder and compile it. Attach it to any chart and you will have your order history in a file named "ordersreport.csv" in your /experts/files folder.

you can choose how much history you want (all, 3 months, 1 month) in the history subwindow by right-clicking

good luck
 
Abiank,

Would you attach this file here?

Thanks.
 
edfiuza:
Abiank,



Would you attach this file here?



Thanks.


here you go
Files:
 
Thank you.
 
I tried the script but didn't work.

Phy,

I want the detailed statement as EXCEL file.

Thanks.
 
edfiuza:
I tried the script but didn't work.

Phy,

I want the detailed statement as EXCEL file.

Thanks.


Sorry..

You can output the HTML and paste into excel

Reason: