ADATAwave59

Author: ooo
ADATAwave59
Miscellaneous
Uses files from the file systemIt writes information to file
0 Views
0 Downloads
0 Favorites
ADATAwave59
//+__________________________________________________________________+
//| AgetData.mq4 |
//| Copyright 2005,fxpars |
//| 
//+__________________________________________________________________+
#property copyright "ooo"
#property link "aaa"
#property indicator_chart_window
extern int number_bars=2000;
extern int from_year = 1978;

int start()
{
int handle;
int cnt;
string strline;
string name_file;
name_file = Symbol()+ Period()+ ".prn";
handle = FileOpen(name_file , FILE_CSV|FILE_WRITE, "\t");
if(handle<1)
   {
   Print("cannot open file error_",GetLastError());
   return(0);
   }

   else
   {
   for (cnt=number_bars;cnt>=0;cnt--)
   if (from_year<TimeYear(Time[cnt]))
      {
      strline = TimeToStr(Time[cnt],TIME_DATE|TIME_SECONDS);
      strline =  StringSubstr(strline,5,2) + StringSubstr(strline,8,2) + StringSubstr(strline,0,4) +"," + StringSubstr(strline,11,5);
      strline = strline + "," + DoubleToStr(Open[cnt],4) + "," + DoubleToStr(High[cnt],4) + "," + DoubleToStr(Low[cnt],4) + "," + DoubleToStr(Close[cnt],4);// + "," + DoubleToStr(Volume[cnt],0);
      FileWrite(handle, strline);
      }
   FileClose(handle);
   return(0);
   }
}

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---