Miscellaneous
Implements a curve of type %1Uses files from the file systemIt writes information to fileIt writes information to fileIt reads information from a fileIt reads information from a file
0 Views
0 Downloads
0 Favorites
Tick_01
//+------------------------------------------------------------------+
//|                                                      Tick_01.mq4 |
//+------------------------------------------------------------------+
#property  copyright "Copyright © 2005, MetaQuotes Software Corp."
#property  link      "http://www.metaquotes.net/"
//+------------------------------------------------------------------+
#define    Max_Razm_Mas      10000
//+------------------------------------------------------------------+
#property  indicator_separate_window
#property  indicator_buffers 1
#property  indicator_color1  Red
#property  indicator_width1  1
extern int Razm_Mas=100;
double   ExtBuffer0[];
double   Buffer [Max_Razm_Mas];
int      kol_izm;
//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(1);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_HISTOGRAM);
   SetIndexBuffer(0,ExtBuffer0);
   IndicatorDigits(Digits);
   IndicatorShortName("WOC");
   ArrayInitialize(ExtBuffer0,0);
   ArrayInitialize(Buffer, 0);
   SetIndexEmptyValue(0,0);
   IndicatorShortName("Tick_01");

   Get_File();
   kol_izm=MathMin(Bars,MathMin(Razm_Mas,Max_Razm_Mas)); // îïðåäåëèòü äëèíó ãðàôèêà
   return(0);
}
//+------------------------------------------------------------------+
int deinit()
{
   Save_File();
   return(0);
}
//+------------------------------------------------------------------+
int start()
{  
   //...............................
      // çàíåñòè öåíó òèêà â ìàññèâ 
   ArrayCopy(Buffer,Buffer,1,0,kol_izm-1);
   Buffer[0]=Bid;
   //...............................
      // âûâåñòè ìàññèâ íà ýêðàí
   ArrayCopy(ExtBuffer0,Buffer,0,0,kol_izm-1);
   ExtBuffer0[kol_izm-1]=0;
   return(0);
}
//+------------------------------------------------------------------+
void Save_File()
{
   // ñîõðàíåíèå äûííûõ â ôàéëå
   // ïåðâîå çíà÷åíèå - êîë. äàííûõ â ãðóïïå (kol_izm)
   // äàëåå - òèêè (Buffer[])
   
   string name="File_Tick";
   int file=FileOpen(name,  FILE_BIN|FILE_WRITE);
   
   FileWriteInteger(file, kol_izm);
   FileWriteArray(file, Buffer,  0, kol_izm);
   FileClose(file);
   
}
//-------------------------
void Get_File()
{
   // ÷òåíèå äûííûõ èç ôàéëà
   // ïåðâîå çíà÷åíèå - êîë. äàííûõ â ãðóïïå (kol_izm)
   // äàëåå - òèêè 
   
   string name="File_Tick";
   int file=FileOpen(name,  FILE_BIN|FILE_READ);

   int kol=FileReadInteger(file);
   
   FileReadArray(file, Buffer,  0, kol);
   FileClose(file);
}
//-------------------------

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 ---