Author: AdvisorTC
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
Ticks_v1
//+------------------------------------------------------------------+
//|                                                        Ticks.mq4 |
//|                                                        AdvisorTC |
//|                                                                  |
//|                                              http://AdvisorTC.ru |
//|                           http://www.mql4.com/ru/users/AdvisorTC |
//|                        https://login.mql5.com/ru/users/AdvisorTC |
//+------------------------------------------------------------------+

#property copyright "AdvisorTC"
#property link      "http://AdvisorTC.ru"
#property version   "1.0"
#property description "Èíäèêàòîð îòðèñîâûâàåò â íà ãëàâíîì ãðàôèêå"
#property description "èçìåíåíèå öåí Ask è Bid."
#property description "Ðàçðàáîòàíî - AdvisorTC.ru. Âåðñèÿ 1.0.1"
#property description " "
#property description "The indicator draws on the main chart"
#property description "in price changes Ask and Bid."
#property description "Developed by AdvisorTC.ru. Version 1.0 build 1"
#property strict

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_plots   2
//--- plot Ask
#property indicator_label1  "Ask"
#property indicator_type1   DRAW_LINE
#property indicator_color1  clrPaleTurquoise
#property indicator_style1  STYLE_SOLID
#property indicator_width1  1
//--- plot Bid
#property indicator_label2  "Bid"
#property indicator_type2   DRAW_LINE
#property indicator_color2  clrLightPink
#property indicator_style2  STYLE_SOLID
#property indicator_width2  1
//--- indicator buffers
double         AskBuffer[];
double         BidBuffer[];

int _ticksCount=300;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
   IndicatorBuffers(2);
//--- indicator buffers mapping
   SetIndexBuffer(0,AskBuffer);
   SetIndexBuffer(1,BidBuffer);

   ArrayResize(AskBuffer,_ticksCount);
   ArrayResize(BidBuffer,_ticksCount);

   ArrayInitialize(AskBuffer,EMPTY_VALUE);
   ArrayInitialize(BidBuffer,EMPTY_VALUE);

   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);

//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---

   for(int t=_ticksCount; t>=1; t--)
     {
     
         AskBuffer[t]=AskBuffer[t-1];
         BidBuffer[t]=BidBuffer[t-1];
     }
   AskBuffer[0]=Ask;
   BidBuffer[0]=Bid;


//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
//| Timer function                                                   |
//+------------------------------------------------------------------+
void OnTimer()
  {
//---

  }
//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
//---

  }
//+------------------------------------------------------------------+

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