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