Author: Copyright � 2007, MetaQuotes Software Corp.
BarSize
Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
BarSize
//+------------------------------------------------------------------+
//|                                                      BarSize.mq4 |
//|                      Copyright © 2007, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_color3 Red
#property indicator_color4 Blue
//---- input parameters
extern int       ParamPer=15;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,3);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,3);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(2,DRAW_HISTOGRAM);
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexStyle(3,DRAW_HISTOGRAM);
   SetIndexBuffer(3,ExtMapBuffer4);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//----
   int i,limit;
   double AvereageCandle;
   if (counted_bars==0) limit=Bars-ParamPer;
   if (counted_bars>0) limit=Bars-counted_bars;
   limit--;
   for (i=limit;i>=0;i--)
      {
      AvereageCandle=iMA(NULL,0,ParamPer,0,MODE_SMA,PRICE_HIGH,1)-iMA(NULL,0,ParamPer,0,MODE_SMA,PRICE_LOW,1);
      if (High[i]-Low[i]>AvereageCandle)
         {
         if (Close[i]>Open[i])
            {
            ExtMapBuffer1[i]=Open[i];
            ExtMapBuffer2[i]=Close[i];
            ExtMapBuffer3[i]=Low[i];
            ExtMapBuffer4[i]=High[i];
            }
         else
            {
            ExtMapBuffer1[i]=Open[i];
            ExtMapBuffer2[i]=Close[i];
            ExtMapBuffer3[i]=High[i];
            ExtMapBuffer4[i]=Low[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 ---