BTC USD 84,611.2 Gold USD 4,134.71
Time now: Jun 1, 12:00 AM

camna nak masuk data dari mt4 ke excel

tokebalak

Active+ Member
Messages
3,636
Joined
Feb 12, 2009
Messages
3,636
Reaction score
37
Points
30
salam semua carigoldian, and forexian, huh, aku nak tanya hampa.. camna nak masuk data bid ask, high low etc, dari mt4 ke excel, aku dah bnya cari tapi x jadik pown.. ada sapa2 bleh bantu x??? step by step.. hehehe:-?:-?:-?
 
carik file dde smple dalam metatrader folder, gi kat terminal, tool, option, server - tick kan enable DDE server...
 
salam semua carigoldian, and forexian, huh, aku nak tanya hampa.. camna nak masuk data bid ask, high low etc, dari mt4 ke excel, aku dah bnya cari tapi x jadik pown.. ada sapa2 bleh bantu x??? step by step.. hehehe:-?:-?:-?

Ini contoh kat pc aku

C:\Program Files\InstaTrader\DDE-Sample.*
* - file excel

- Pastikan Enable DDE Server (Tools Options)
 
Ni contoh benar :D

714cg2.jpg
 
salam semua carigoldian, and forexian, huh, aku nak tanya hampa.. camna nak masuk data bid ask, high low etc, dari mt4 ke excel, aku dah bnya cari tapi x jadik pown.. ada sapa2 bleh bantu x??? step by step.. hehehe:-?:-?:-?

Guna contoh ni, ni guna AUDUSD

Ask
=(DDE("MT4";"ask";"AUDUSD"))

Bid
=(DDE("MT4";"bid";"AUDUSD"))

Instead of "bid" or "ask" you can also put:
open, close, high, low & volume

selamat mencuba ye

jangan lupa enable DDE server macam yang sifu2 pesan tadi tu
 
Guna contoh ni, ni guna AUDUSD

Ask
=(DDE("MT4";"ask";"AUDUSD"))

Bid
=(DDE("MT4";"bid";"AUDUSD"))

Instead of "bid" or "ask" you can also put:
open, close, high, low & volume

selamat mencuba ye

jangan lupa enable DDE server macam yang sifu2 pesan tadi tu

aku try tak jadi la, pakai syntax ko bg tu, kalau pakai yg dekat dde sample tu bole la (=MT4|BID!XXXXX)

aku tgh carik syntax nak stream OPEN & CLOSE...ada sesapa tau?
 
salam, ni aku ada jumpa kat mql4.com, setakat ni yg bole dikira menepati citarasa, EA ni export open & close price (daily ngn tick price, rasanya bole ejas) ke excel. data saved dlm format .csv. cuma perlukan sedikit sentuhan pakar coding mql4 utk kemas kini cara dia sort, sbb EA ni dia sort date/time sebaris dgn open price value tak macam csv file yg generated thru history center. data saved dkt .../expert/files

pastu EA ni takleh nak retrive history data, dia akan start export data masa EA ni execute.

Code:
//+------------------------------------------------------------------+
//|                                                    symbol-D1.mq4 |
//|                                                    A Sexy Trader |
//|                                  http://pipsmaker.wordpress.com/ |
//+------------------------------------------------------------------+
#property copyright "A Sexy Trader"
#property link      "http://pipsmaker.wordpress.com/"
#include <stdlib.mqh>
 
extern string StartDate = "2010.04.01"   //set the starting date to get the same time data
             ,StopDate  = "2010.04.30";  //set the testing time limit to protect the over 
                                         //data recording process
 
extern bool For_OP_SELL = true;/*This is to guide for the right type of data to be collected
                                 ->if For_OP_SELL = true 
                                   the daily Open will be collected as an order open price
                                 ->if For_OP_SELL = false , means for OP_BUY,
                                   the daily Open+SPREAD will be collected instate.
                               */
                               
string name,tname;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
 
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//-------------------------------------------------------------------+
//| Some Essential Parameters In This EA                             |
//-------------------------------------------------------------------+
   int day                   // a variable to mark that today Open has been collected 
      ,ho                    // handle of the file recording the Open price 
      ,ht                    // handle of the file recording the tick price
      ,x=1                   /* the order of D1 file increasing every time D1 data is 
                             equal to 4086 characters and generate the new recording file*/
      ,xt=1                  // same as x but for tick data
      ,bartime               // a variable to mark that current bar's Open has been collected 
      ; 
   double ot                 // latest Open Time
         ,op                 // latest Open price
         ,lt                 // latest tick time
         ,ltk                // latest tick price
         ;
   string OStr               // the string to collect the daily open
         ,TStr               // the string to collect the tick value
         ;
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {   
    
    /*---------------------Only collect the data in the specific time period.----------------------*/  
    if(TimeToStr(TimeCurrent(),TIME_DATE)>=StartDate && TimeToStr(TimeCurrent(),TIME_DATE)<=StopDate)  
    {
       name=Symbol()+x+"D1.csv";       // setup the name of daily open price file
       tname=Symbol()+xt+"T.csv"       // the name of tick price file
            ;
//----       
      if(day!=TimeDay(Time[0]))        // the new day has come
       {
         ot=Time[0];                   // get the new bar time
         if(For_OP_SELL)op=Open[0];    // get the new order open price for SELL Symbol 
                                                 
         else           op=Open[0]+MarketInfo(Symbol(),MODE_SPREAD)*Point;
                                       // else if collecting for the BUY Symbol
         
 
         OStr=OStr+TimeToStr(Time[0],TIME_DATE)+",";//collect the new time data separate each data with ","
         OStr=OStr+DoubleToStr(op,Digits)+",";      //now the new open price
       
       //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~now it's time to export as a file 
       
       ho=FileOpen(name ,FILE_CSV|FILE_WRITE);  // open a file to record the daily open
       if(ho>0)                                 // if the file Symbol()+x+"D1.csv" exist
       {
        FileWrite(ho,OStr);                     // write the collected data
        FileClose(ho);                          // close the file every time your file process done
        if(StringLen(OStr)==4086){x++;OStr="";} /* if the data contains 4086 characters set new x to*/
       }                                        /*   create the new file and prepare the new string for 
                                                   the new file 
                                                */            
        
       Print(TimeToStr(Time[0],TIME_DATE));     // print the collected day time 
       
       int thex=FileOpen(Symbol()+"x.csv",FILE_CSV|FILE_WRITE);
                                                // create a file to record "how many x?" for D1 file for further usage
       if(thex>0)                               // if the file exist
       {
        string xs=DoubleToStr(x,0);             // transform x into string 
        FileWrite(thex,xs);                     // write the x value
        FileClose(thex);                        // close file (every time you finish)
       } 
        
        
        day=TimeDay(Time[0]);                   // now mark today as collected 
       }
 
//--------------------------------FOR TICK VALUE
       /*Because of the decision of collecting the tick data hourly*/
       if(bartime!=Time[0])                     // the new hourly bar has come
                                                // and to make it more flexible when you decided 
                                                      // to collect data in another time frame
       {
         lt=TimeCurrent();                      // get the tick time 
         
         if(!For_OP_SELL) ltk=Bid;              // the tick price for sell order 
         else             ltk=Ask;              // in case for buy order
         
         TStr=TStr+TimeToStr(lt,TIME_DATE|TIME_MINUTES)+",";
                                                // insert the data into the collected string 
         TStr=TStr+DoubleToStr(ltk,Digits)+","; //
         
       //~~~~~~~~                               // now export the data 
       ht=FileOpen(tname,FILE_CSV|FILE_WRITE);  // open a file to record the tick value
       if(ht>0)                                 // if the file Symbol+xt+"T.csv" exist
       {
        FileWrite(ht,TStr);                     // write the collected tick with time 
        FileClose(ht);                          // finish.
        if(StringLen(TStr)==4080){xt++;TStr="";}// prepare for new file if this file reached 4080 character
       }
       
       int thext=FileOpen(Symbol()+"xt.csv",FILE_CSV|FILE_WRITE);
                                                // record the xt value .. same as D1 file 
                                                
       if(thext>0)                              // if the file exist
       {
        string xts=DoubleToStr(xt,0);           // transform into string 
        FileWrite(thext,xts);                   // write xt
        FileClose(thext);                       // done
       } 
     bartime=Time[0];                           // mark as current hourly bar Open price has been collected
     }  
   }    
   else if(TimeToStr(TimeCurrent(),TIME_DATE)>StopDate)  // if out of specified period  
   Print("Done.");                                       // let us know it all done.
//----
   return(0);
  }
//+------------------------------------------------------------------+

coding master sila tunjuk ajar...ni report setakat yg aku testing. korang try la test...
 
owh aku dah brapa kali try.. tengok porem MQL.. masih dok merapu lagi daa... hehehhehhe.....x da ebook khusus.. heeeeeeeeee
 

Latest Posts

Live Forex Chart

Currency
Rates
EUR / USD
1.12335
USD / JPY
158.140
GBP / USD
1.33944
USD / CHF
0.82444
USD / CAD
1.40472
EUR / JPY
177.719
AUD / USD
0.70315
Back
Top
Log in Register