Close_to_File2

Author: Copyright � 2007, MetaQuotes Software Corp.
Close_to_File2
Price Data Components
Series array that contains open prices of each barSeries array that contains the lowest prices of each barSeries array that contains the highest prices of each barSeries array that contains close prices for each barSeries array that contains tick volumes of each bar
Miscellaneous
Uses files from the file systemIt writes information to file
0 Views
0 Downloads
0 Favorites
Close_to_File2
//+------------------------------------------------------------------+
//|                                                  RSI_to_File.mq4 |
//|                      Copyright © 2007, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.ru/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.ru/"
#define NR_SYMB 6
#property show_inputs
string SymbolsArray[NR_SYMB]={"","GBPUSD","EURUSD","AUDUSD","EURCHF","EURJPY"};

//+------------------------------------------------------------------+
//| string SymbolByNumber                                   |
//+------------------------------------------------------------------+
string GetSymbolString(int Number)
  {
//----
   string res="";
   res=SymbolsArray[Number];   
//----
   return(res);
  }

//+------------------------------------------------------------------+
//| âîçâðàùàåò ïåðèîä                                                |
//+------------------------------------------------------------------+
/*
int PeriodNumber(int number)
   {
   int per_min;
   switch (number)
      {
      case 0: per_min=PERIOD_M1;break;
      case 1: per_min=PERIOD_M5;break;
      case 2: per_min=PERIOD_M15;break;
      case 3: per_min=PERIOD_M30;break;
      case 4: per_min=PERIOD_H1;break;
      case 5: per_min=PERIOD_H4;break;
      default: per_min=PERIOD_D1;break;
      }
   return(per_min);   
   }
*/
//+------------------------------------------------------------------+
//|   âûâîäèò â ôàéë êîòèðîâêè + çíà÷åíèÿ èíäèêàòîðà                 |
//+------------------------------------------------------------------+
void RSI_output(string SymbolName,int PeriodMinutes)
   {
   int size=iBars(SymbolName,PeriodMinutes);
//----
   if (size==0) return;
   int handle=FileOpen(SymbolName+PeriodMinutes+".csv",FILE_WRITE|FILE_CSV,",");
   if (handle<0) return;
   //FileWrite(handle,"TIME,OPEN,LOW,HIGH,CLOSE,VOLUME");
   //FileWrite(handle,"N10,N8.5,N8.5,N8.5,N8.5,N6");
   for (int i=size-1;i>=0;i--)
      {
      FileWrite(handle,
                  iTime(SymbolName,PeriodMinutes,i),
                  //TimeToStr(iTime(SymbolName,PeriodMinutes,i)),
                  iOpen(SymbolName,PeriodMinutes,i),
                  iLow(SymbolName,PeriodMinutes,i),
                  iHigh(SymbolName,PeriodMinutes,i),
                  iClose(SymbolName,PeriodMinutes,i),
                  iVolume(SymbolName,PeriodMinutes,i)
                  //iCustom(SymbolName,PeriodMinutes,"RSI",0,i)
                  );
      }
   FileClose(handle);      
//----
   return;
   }
//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {
  int SymbolCounter,PeriodCounter; 
//----
   for (SymbolCounter=1;SymbolCounter<NR_SYMB;SymbolCounter++)
      {
         RSI_output(GetSymbolString(SymbolCounter),PERIOD_M1);
         RSI_output(GetSymbolString(SymbolCounter),PERIOD_M5);
         RSI_output(GetSymbolString(SymbolCounter),PERIOD_H1);
         RSI_output(GetSymbolString(SymbolCounter),PERIOD_H4);
      }
   
//----
   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 ---