Author: Copyright 2013, MetaQuotes Software Corp.
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
CANAL
//+------------------------------------------------------------------+
//|                                                        CANAL.mq4 |
//|                        Copyright 2013, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 5
#property indicator_color1 Red
#property indicator_color2 DeepPink
#property indicator_color3 Blue
#property indicator_color4 DodgerBlue
#property indicator_color5 Gold
//--- input parameters
extern int       per1=12;

//--- buffers
double HBuffer[];
double HBuffer1[];
double LBuffer[];
double LBuffer1[];
double SBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_SECTION);
   SetIndexBuffer(0,HBuffer);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,HBuffer1);
   SetIndexStyle(2,DRAW_SECTION);
   SetIndexBuffer(2,LBuffer);
   SetIndexStyle(3,DRAW_LINE);
   SetIndexBuffer(3,LBuffer1);
   SetIndexStyle(4,DRAW_LINE);
   SetIndexBuffer(4,SBuffer);
   IndicatorShortName("CANAL");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
    int Counted_bars=IndicatorCounted();
   double History=500;
   int i=Bars-Counted_bars-1;
   if (i>History-1)
   i=History-1;
   
   while(i>=0)
  { 
   
   HBuffer[i]=High[iHighest(NULL,0,MODE_HIGH,per1,i)];
   LBuffer[i]=Low[iLowest(NULL,0,MODE_LOW,per1,i)];
   HBuffer1[i]=Low[iHighest(NULL,0,MODE_LOW,per1,i)];
   LBuffer1[i]=High[iLowest(NULL,0,MODE_HIGH,per1,i)];
   SBuffer[i]=(High[i]+Low[i]+Open[i])/3;
   
   i--;
   }
   
//----
   
//----
   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 ---