//+------------------------------------------------------------------+ //| LeManTrend.mq4 | //| Copyright © 2009, LeMan. | //| b-market@mail.ru | //+------------------------------------------------------------------+ //mod #property copyright "Copyright © 2009, LeMan." #property link "b-market@mail.ru" //---- #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Red #property indicator_color2 Green //---- Входные параметры extern int Min = 13; extern int Midle = 21; extern int Max = 34; extern int PeriodEMA = 3; //---- Буферы double ExtMapBuffer1[]; double ExtMapBuffer2[]; double TempBuffer1[]; double TempBuffer2[]; double ma[]; double ma2[]; int method_ma = 0; //+------------------------------------------------------------------+ int init() { //---- IndicatorDigits(Digits); IndicatorBuffers(4);//4 SetIndexBuffer(0,ExtMapBuffer1); SetIndexBuffer(1,ExtMapBuffer2); SetIndexBuffer(2,TempBuffer1); SetIndexBuffer(3,TempBuffer2); SetIndexStyle(0,DRAW_LINE); SetIndexStyle(1,DRAW_LINE); SetIndexDrawBegin(0,Max); SetIndexDrawBegin(1,Max); //----------------------------------- //SetIndexBuffer(2,ma); //SetIndexBuffer(3,ma2); // SetIndexStyle(2,DRAW_LINE,1, Red); // SetIndexStyle(3,DRAW_LINE, 1, Teal); //---- return(0); } //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ int start() { //---- int i, counted_bars = IndicatorCounted(); //---- if (Bars <= Max) { return(0); } //---- initial zero if (counted_bars < 1) { for(i=1; i<=Max; i++) { ExtMapBuffer1[Bars-i] = 0.0; ExtMapBuffer2[Bars-i] = 0.0; } } //---- i = Bars-counted_bars-1; //---- while(i >= 0) { double High1 = iHigh(NULL, 0, iHighest(NULL, 0, MODE_HIGH, Min,i+1)); double High2 = iHigh(NULL, 0, iHighest(NULL, 0, MODE_HIGH, Midle,i+1)); double High3 = iHigh(NULL, 0, iHighest(NULL, 0, MODE_HIGH, Max,i+1)); TempBuffer1[i] = ((High[i]-High1)+(High[i]-High2)+(High[i]-High3)); double Low1 = iLow(NULL, 0, iLowest(NULL, 0, MODE_LOW, Min, i+1)); double Low2 = iLow(NULL, 0, iLowest(NULL, 0, MODE_LOW, Midle, i+1)); double Low3 = iLow(NULL, 0, iLowest(NULL, 0, MODE_LOW, Max, i+1)); TempBuffer2[i] = ((Low1-Low[i])+(Low2-Low[i])+(Low3-Low[i])); i--; } if (counted_bars > 0) { counted_bars--; } int limit = Bars-counted_bars; for(i=0; i 0 ) { ExtMapBuffer1[i] = -iMAOnArray(TempBuffer1,Bars,PeriodEMA,0,MODE_EMA,i); ExtMapBuffer2[i] = -iMAOnArray(TempBuffer2,Bars,PeriodEMA,0,MODE_EMA,i); } else { ExtMapBuffer1[i] = TempBuffer1[i]; ExtMapBuffer2[i] = TempBuffer2[i]; } } //-------------------------------------------- //элементы скользящих средних for(i = 0; i < limit; i++) { ma[i]=iMAOnArray(ExtMapBuffer1,0,8,0,method_ma,i); ma2[i]=iMAOnArray(ExtMapBuffer2,0,8,0,method_ma,i); } //--------------------------------------------- //---- return(0); } //+------------------------------------------------------------------+