//=====================================================================================// // 2MoHLC (2 Medians of High-Low Channels) (c) Ilya Filatov, 2010 // //=====================================================================================// #property copyright "Copyright © 2010, Ilya Filatov" #property link "ilya-filatov@ya.ru" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 MediumSeaGreen #property indicator_color2 Salmon #property indicator_style1 0 #property indicator_style2 0 #property indicator_width1 1 #property indicator_width2 1 extern int p1 = 24; extern int p2 = 48; double M1[]; double M2[]; //=====================================================================================// // Инициализация // //=====================================================================================// int init() { if(p1 < 2) p1 = 2; if(p2 < 2) p2 = 2; SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,M1); SetIndexLabel(0,"HLC-M1"); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,M2); SetIndexLabel(1,"HLC-M2"); SetIndexDrawBegin(0,p1); SetIndexDrawBegin(1,p2); string short_name = "2MoHLC (" + p1 + "," + p2 + ")"; IndicatorShortName(short_name); Comment(short_name); } //=====================================================================================// // Деинициализация // //=====================================================================================// int deinit() { Comment(""); } //=====================================================================================// // Запуск // //=====================================================================================// int start() { for(int i=Bars-IndicatorCounted()-1; i>=0; i--) { M1[i] = (High[iHighest(NULL,0,MODE_HIGH,p1,i)] + Low[iLowest(NULL,0,MODE_LOW,p1,i)]) / 2; M2[i] = (High[iHighest(NULL,0,MODE_HIGH,p2,i)] + Low[iLowest(NULL,0,MODE_LOW,p2,i)]) / 2; } } //=====================================================================================//