//+------------------------------------------------------------------+ //| iFractals.mq4 | //| Copyright © 2006, SOK.LiteForEx.Net | //| http://sok.liteforex.net | //+------------------------------------------------------------------+ #property copyright "Copyright © 2006, SOK.LiteForEx.Net" #property link "http://sok.liteforex.net" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Red #property indicator_color2 Blue //---- input parameters extern int ExtParam1 = 0; //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0, DRAW_ARROW, 0, 1); SetIndexArrow(0, 159); SetIndexBuffer(0, ExtMapBuffer1); SetIndexEmptyValue(0, 0.0); SetIndexStyle(1, DRAW_ARROW, 0, 1); SetIndexArrow(1, 159); SetIndexBuffer(1, ExtMapBuffer2); SetIndexEmptyValue(1, 0.0); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars = IndicatorCounted(); //---- int periods[] = {0, PERIOD_M1, PERIOD_M5, PERIOD_M15, PERIOD_M30, PERIOD_H1, PERIOD_H4, PERIOD_D1, PERIOD_W1, PERIOD_MN1}; int period0 = periods[ArrayBsearch(periods, Period()) + ExtParam1]; int limit; //---- последний посчитанный бар будет пересчитан if(counted_bars > 0) counted_bars--; limit = Bars - counted_bars; if(counted_bars==0) limit-=2; //---- основной цикл for(int i = limit; i > 0; i--) { //---- ma_shift присваивается 0, потому что SetIndexShift, вызываемый выше int BS = iBarShift(NULL, period0, iTime(NULL, 0, i), true); ExtMapBuffer1[i] = iFractals(NULL, period0, MODE_UPPER, BS); if(ExtMapBuffer1[i] == 0) { ExtMapBuffer1[i] = ExtMapBuffer1[i+1]; } ExtMapBuffer2[i] = iFractals(NULL, period0, MODE_LOWER, BS); if(ExtMapBuffer2[i] == 0) { ExtMapBuffer2[i] = ExtMapBuffer2[i+1]; } } //---- return(0); } //+------------------------------------------------------------------+