//+------------------------------------------------------------------+ //| Spectr.mq4 | //| Yuriy Tokman | //| yuriytokman@gmail.com | //+------------------------------------------------------------------+ #property copyright "Yuriy Tokman" #property link "yuriytokman@gmail.com" #property indicator_chart_window #property indicator_buffers 8 #property indicator_color1 Red #property indicator_color2 Orange #property indicator_color3 Yellow #property indicator_color4 Lime #property indicator_color5 Blue #property indicator_color6 DodgerBlue #property indicator_color7 DarkViolet #property indicator_color8 DimGray //---- input parameters extern int iPeriod=240; extern int iStartFrom=1; extern int VV = 1; //Высота волны extern int pm = 1; //Период усреднения для вычисления скользящего среднего. double A[],B[],R[],F[]; //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; double ExtMapBuffer4[]; double ExtMapBuffer5[]; double ExtMapBuffer6[]; double ExtMapBuffer7[]; double ExtMapBuffer8[]; int LastLeftBar; int LastRightBar; int LastLeftTime; int LastRightTime; int LastStartFrom; int LastiStartFrom; int LastiPeriod; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE,DRAW_LINE,1); SetIndexBuffer(0,ExtMapBuffer1); SetIndexStyle(1,DRAW_LINE,DRAW_LINE,1); SetIndexBuffer(1,ExtMapBuffer2); SetIndexStyle(2,DRAW_LINE,DRAW_LINE,1); SetIndexBuffer(2,ExtMapBuffer3); SetIndexStyle(3,DRAW_LINE,DRAW_LINE,1); SetIndexBuffer(3,ExtMapBuffer4); SetIndexStyle(4,DRAW_LINE,DRAW_LINE,1); SetIndexBuffer(4,ExtMapBuffer5); SetIndexStyle(5,DRAW_LINE,DRAW_LINE,1); SetIndexBuffer(5,ExtMapBuffer6); SetIndexStyle(6,DRAW_LINE,DRAW_LINE,1); SetIndexBuffer(6,ExtMapBuffer7); SetIndexStyle(7,DRAW_LINE,DRAW_LINE,1); SetIndexBuffer(7,ExtMapBuffer8); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { //===================================================================================================== static int LastBars=0; if(iStartFrom==LastiStartFrom && iPeriod==LastiPeriod)if(Bars0){ return(MathArctan(1)*2); } else{ if(aS<0){ return(MathArctan(1)*6); } } } else{ if(aS>0){ if(aC>0){ return(MathArctan(aS/aC)); } else{ return(MathArctan(aS/aC)+MathArctan(1)*4); } } else{ if(aC>0){ return(MathArctan(aS/aC)+MathArctan(1)*8); } else{ return(MathArctan(aS/aC)+MathArctan(1)*4); } } } }