Candles_Ratio_v1_v1

Author: Copyright � 2010, Vladimir Hlystov
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
Candles_Ratio_v1_v1
//+------------------------------------------------------------------+
//|                                                Candles_Ratio.mq4 |
//|                               Copyright © 2010, Vladimir Hlystov |
//|                                         http://cmillion.narod.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, Vladimir Hlystov"
#property link      "WWW: http://cmillion.narod.ru  MAIL: cmillion@narod.ru"

#property indicator_separate_window
#property indicator_buffers    1
#property indicator_color1     Green
//+------------------------------------------------------------------+
extern int PeriodCN=20;
double K[];
//+------------------------------------------------------------------+
int init()
  {
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,K);
   return(0);
  }
//+------------------------------------------------------------------+
int start()
  {
   if (Bars<PeriodCN) return(-1);
   int counted_bars=IndicatorCounted();
   if(counted_bars < 0)  return(-1);
   if(counted_bars>0) counted_bars--;
   int limit=Bars-counted_bars;
   if(counted_bars==0) limit-=1+PeriodCN;

   ObjectDelete("startline");
   ObjectCreate("startline",OBJ_VLINE,0,Time[PeriodCN],0,0,0,0,0);
   ObjectSet("startline",OBJPROP_COLOR,Green);
   for(int n=0; n<limit; n++)
     {
      double B=0,M=0;
      for(int j=n; j<PeriodCN+n; j++)
        {
         if(Open[j]<Close[j]) B+=Close[j]-Open[j];
         else                  M+=Open[j]-Close[j];
        }
      K[n]=B/M;
     }
   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 ---