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
Hi, please help me,
this script is writing out the data from opened chart. (high, low....)
I would like to modify this script, to take as input the currency pairs
(aud-usd, or eur-usd...) and the time frame and write out the data to file
//+------------------------------------------------------------------+
//| chart_write.mq4 |
//| |
//+------------------------------------------------------------------+
#property copyright "kal"
#property link "lll"
#property show_inputs
extern datetime BeginDate = D'2009.02.11';
extern datetime EndDate = D'2009.03.31';
extern string Separator = ",";
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
void start()
{
int i, b=0, bb=0, eb;
string comm, st;
string fn=Symbol()+Period()+" "+
TimeToStr(BeginDate, TIME_DATE)+"-"+
TimeToStr(EndDate, TIME_DATE)+".csv";
for (i=Bars; i>0; i--)
{
if (Time[i]>=BeginDate && Time[i]<=EndDate)
{
if (bb==0) bb=i;
st=TimeToStr(Time[i], TIME_DATE)+Separator+
TimeToStr(Time[i], TIME_MINUTES)+Separator+
DoubleToStr(Open[i], Digits)+Separator+
DoubleToStr(High[i], Digits)+Separator+
DoubleToStr(Low[i], Digits)+Separator+
DoubleToStr(Close[i], Digits)+Separator+
DoubleToStr(Volume[i], 0);
WritingLineInFile(fn, st);
b++;
eb=i;
}
}
comm="Íŕ÷ŕëî: "+TimeToStr(Time[bb], TIME_DATE|TIME_MINUTES)+"\n";
comm=comm+"Ęîíĺö: "+TimeToStr(Time[eb], TIME_DATE|TIME_MINUTES)+"\n";
comm=comm+"Âűăđóćĺíî áŕđîâ: "+DoubleToStr(b, 0);
Comment(comm);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void WritingLineInFile(string FileName, string text)
{
int file_handle=FileOpen(FileName, FILE_READ|FILE_WRITE, " ");
if (file_handle>0)
{
FileSeek(file_handle, 0, SEEK_END);
FileWrite(file_handle, text);
FileClose(file_handle);
}
}
//+------------------------------------------------------------------+