mikko_mtf_candle

Author: Mikko
mikko_mtf_candle
Price Data Components
Series array that contains the lowest prices of each barSeries array that contains the highest prices of each bar
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
mikko_mtf_candle
//+---------------------------------------------------------------+
//|                                                    MTF candle |
//|                                   http://www.currencylabs.com |
//|                                                 (C) _mikkom   |
//+---------------------------------------------------------------+
#property copyright "Mikko"
#property link      "noneOfYOurBusiness"

//#property indicator_separate_window
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Gray
#property indicator_color2 Gray

double high[];
double low[];

extern int period = PERIOD_D1;

int init() {

   IndicatorBuffers(2);
   SetIndexBuffer(0, low);   
   SetIndexStyle(0, DRAW_LINE, EMPTY, 1); 
   
   SetIndexBuffer(1, high);     
   SetIndexStyle(1, DRAW_LINE, EMPTY, 1);  
   
   IndicatorShortName("Mikko candle "+period);
   
   if(period == 0)
      period = Period();
      
   return(0);
}
  
int deinit() {
   return(0);
}
     
int start() {
       
   int counted_bars=IndicatorCounted();
  
   if(Period() >= period)
      return;
  
   if(counted_bars < 0) 
       return(-1);
   if(counted_bars > 0) 
       counted_bars--;
       
   int limit = Bars - counted_bars;
   
   if((Low[0] < low[0] || High[0] > high[0]) && limit < period)
      limit = period;       
   
   for(int i = limit; i >= 0; i--) {
   
       int t = iBarShift(Symbol(), period, Time[i], false);       
       
       low[i] = iLow(Symbol(),period,t);
       high[i] = iHigh(Symbol(),period,t);
   } 
   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 ---