//+------------------------------------------------------------------+ //| 7-MA.mq4 | //| Copyright 2015, mrak297 | //| http://www.mql5.com/ru/users/mrak297 | //+------------------------------------------------------------------+ #property copyright "Copyright 2015, mrak297." #property link "http://www.mql5.com/ru/users/mrak297" #property version "2.0" #property description "Drawing 7 MA" #property strict #property indicator_chart_window #property indicator_buffers 7 #property indicator_plots 7 //--- plot Label1 #property indicator_label1 "MA-1" #property indicator_type1 DRAW_LINE #property indicator_color1 clrRed #property indicator_style1 STYLE_SOLID #property indicator_width1 1 //--- plot Label2 #property indicator_label2 "MA-2" #property indicator_type2 DRAW_LINE #property indicator_color2 clrDarkOrange #property indicator_style2 STYLE_SOLID #property indicator_width2 1 //--- plot Label3 #property indicator_label3 "MA-3" #property indicator_type3 DRAW_LINE #property indicator_color3 clrYellow #property indicator_style3 STYLE_SOLID #property indicator_width3 1 //--- plot Label4 #property indicator_label4 "MA-4" #property indicator_type4 DRAW_LINE #property indicator_color4 clrGreen #property indicator_style4 STYLE_SOLID #property indicator_width4 1 //--- plot Label5 #property indicator_label5 "MA-5" #property indicator_type5 DRAW_LINE #property indicator_color5 clrDeepSkyBlue #property indicator_style5 STYLE_SOLID #property indicator_width5 1 //--- plot Label6 #property indicator_label6 "MA-6" #property indicator_type6 DRAW_LINE #property indicator_color6 clrBlue #property indicator_style6 STYLE_SOLID #property indicator_width6 1 //--- plot Label7 #property indicator_label7 "MA-7" #property indicator_type7 DRAW_LINE #property indicator_color7 clrPurple #property indicator_style7 STYLE_SOLID #property indicator_width7 1 //--- input parameters input string Info = "Set Period MA = 0 for disable."; input int MA1 = 13; //Period MA 1 input int MA2 = 21; //Period MA 2 input int MA3 = 34; //Period MA 3 input int MA4 = 55; //Period MA 4 input int MA5 = 89; //Period MA 5 input int MA6 = 144; //Period MA 6 input int MA7 = 233; //Period MA 7 input ENUM_MA_METHOD Method = MODE_SMA; input ENUM_APPLIED_PRICE Price = PRICE_CLOSE; //--- indicator buffers double MA1Buffer[]; double MA2Buffer[]; double MA3Buffer[]; double MA4Buffer[]; double MA5Buffer[]; double MA6Buffer[]; double MA7Buffer[]; //+------------------------------------------------------------------+ void OnInit(void) { int draw_begin1 = MA1-1; int draw_begin2 = MA2-1; int draw_begin3 = MA3-1; int draw_begin4 = MA4-1; int draw_begin5 = MA5-1; int draw_begin6 = MA6-1; int draw_begin7 = MA7-1; SetIndexBuffer(0, MA1Buffer); SetIndexBuffer(1, MA2Buffer); SetIndexBuffer(2, MA3Buffer); SetIndexBuffer(3, MA4Buffer); SetIndexBuffer(4, MA5Buffer); SetIndexBuffer(5, MA6Buffer); SetIndexBuffer(6, MA7Buffer); for (int i = 0; i <= 6; i++) SetIndexShift(i, 0); SetIndexDrawBegin(0, draw_begin1); SetIndexDrawBegin(1, draw_begin2); SetIndexDrawBegin(2, draw_begin3); SetIndexDrawBegin(3, draw_begin4); SetIndexDrawBegin(4, draw_begin5); SetIndexDrawBegin(5, draw_begin6); SetIndexDrawBegin(6, draw_begin7); SetIndexLabel(0, "MA " + IntegerToString(MA1)); SetIndexLabel(1, "MA " + IntegerToString(MA2)); SetIndexLabel(2, "MA " + IntegerToString(MA3)); SetIndexLabel(3, "MA " + IntegerToString(MA4)); SetIndexLabel(4, "MA " + IntegerToString(MA5)); SetIndexLabel(5, "MA " + IntegerToString(MA6)); SetIndexLabel(6, "MA " + IntegerToString(MA7)); IndicatorDigits(Digits); } //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { int limit=rates_total-prev_calculated; for(int i=0; i