DK-Multi Ma

Author: Copyright � 2009,Darkkiller
DK-Multi Ma

The DK Multi MA is a specialized technical analysis tool designed for the MetaTrader 4 platform. Its primary purpose is to visualize multiple Moving Averages (MA) simultaneously on a single chart, allowing traders to monitor various timeframes and price trends at a glance.

Core Functionality

Unlike standard indicators that only show one trend line, this script overlays eight distinct Moving Averages. By displaying these together, it helps traders identify "confluence"—where different timeframes or periods agree on the direction of the market.

Key Features

  • Multi-Timeframe Analysis: The script is uniquely configured to handle different timeframes for each moving average. For example, while some lines might represent the current chart's immediate price action, others are programmed to pull data from higher timeframes (such as 60-minute charts). This allows you to see "the big picture" without switching tabs or windows.
  • Customizable Periods: Each of the eight moving averages can be assigned a unique period. This means you can set a very "fast" moving average to capture quick price fluctuations and "slow" moving averages to identify long-term support and resistance levels.
  • Versatile Calculation Methods: The logic supports various standard moving average types (such as Simple or Exponential), ensuring that the data can be smoothed or weighted according to the user's specific trading strategy.
  • Visual Organization: To ensure the chart remains readable despite having eight different lines, the script allows for "shifts" and specific starting points. This prevents the visual clutter of overlapping lines and ensures that the data begins appearing only after enough candles have passed to create a valid calculation.

How It Benefits Traders

By using this tool, a trader can instantly perceive market momentum across multiple layers:

  1. Short-term Trend: Identifying immediate price reactions.
  2. Medium-term Trend: Observing the prevailing "flow" of the day.
  3. Long-term Trend: Spotting major structural shifts in the market.

In summary, this script transforms a standard chart into a comprehensive dashboard, providing a multi-dimensional view of price history and trend dynamics in one unified display.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
19 Views
0 Downloads
0 Favorites
DK-Multi Ma
//+------------------------------------------------------------------+
//|                                                  DK Multi MA.mq4 |
//|                      Copyright © 2009, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009,Darkkiller"
#property link      "http://www.metaquotes.net/"

#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 Blue
#property indicator_color2 DarkGray
#property indicator_color3 DarkGray
#property indicator_color4 White
#property indicator_color5 Blue
#property indicator_color6 DarkGray
#property indicator_color7 DarkGray
#property indicator_color8 White
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 2
#property indicator_width4 2
#property indicator_width5 2
#property indicator_width6 2
#property indicator_width7 2
#property indicator_width8 2
//---- input parameters
extern int MA1_TF=0;
extern int MA1_Period=14;
extern int MA1_Method = 0;
extern int MA1_Shift=0;
extern int MA1_Apply_to=0;

extern int MA2_TF=0;
extern int MA2_Period=50;
extern int MA2_Method = 0;
extern int MA2_Shift=0;
extern int MA2_Apply_to=0;

extern int MA3_TF=0;
extern int MA3_Period=100;
extern int MA3_Method = 0;
extern int MA3_Shift=0;
extern int MA3_Apply_to=0;

extern int MA4_TF=0;
extern int MA4_Period=200;
extern int MA4_Method = 0;
extern int MA4_Shift=0;
extern int MA4_Apply_to=0;

extern int MA5_TF=60;
extern int MA5_Period=14;
extern int MA5_Method = 0;
extern int MA5_Shift=0;
extern int MA5_Apply_to=0;

extern int MA6_TF=60;
extern int MA6_Period=50;
extern int MA6_Method = 0;
extern int MA6_Shift=0;
extern int MA6_Apply_to=0;

extern int MA7_TF=60;
extern int MA7_Period=100;
extern int MA7_Method = 0;
extern int MA7_Shift=0;
extern int MA7_Apply_to=0;

extern int MA8_TF=60;
extern int MA8_Period=200;
extern int MA8_Method = 0;
extern int MA8_Shift=0;
extern int MA8_Apply_to=0;

//---- indicator buffers
double ExtMA1Buffer[];
double ExtMA2Buffer[];
double ExtMA3Buffer[];
double ExtMA4Buffer[];
double ExtMA5Buffer[];
double ExtMA6Buffer[];
double ExtMA7Buffer[];
double ExtMA8Buffer[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- line shifts when drawing
   SetIndexShift(0,MA1_Shift);
   SetIndexShift(1,MA2_Shift);
   SetIndexShift(2,MA3_Shift);
   SetIndexShift(3,MA4_Shift);
   SetIndexShift(4,MA5_Shift);
   SetIndexShift(5,MA6_Shift);
   SetIndexShift(6,MA7_Shift);
   SetIndexShift(7,MA8_Shift);
//---- first positions skipped when drawing
   SetIndexDrawBegin(0,MA1_Period-1);
   SetIndexDrawBegin(1,MA2_Period-1);
   SetIndexDrawBegin(2,MA3_Period-1);
   SetIndexDrawBegin(3,MA4_Period-1);
   SetIndexDrawBegin(4,MA5_Period-1);
   SetIndexDrawBegin(5,MA6_Period-1);
   SetIndexDrawBegin(6,MA7_Period-1);
   SetIndexDrawBegin(7,MA8_Period-1);
//---- 3 indicator buffers mapping
   SetIndexBuffer(0,ExtMA1Buffer);
   SetIndexBuffer(1,ExtMA2Buffer);
   SetIndexBuffer(2,ExtMA3Buffer);
   SetIndexBuffer(3,ExtMA4Buffer);
   SetIndexBuffer(4,ExtMA5Buffer);
   SetIndexBuffer(5,ExtMA6Buffer);
   SetIndexBuffer(6,ExtMA7Buffer);
   SetIndexBuffer(7,ExtMA8Buffer);
//---- drawing settings
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexStyle(3,DRAW_LINE);
   SetIndexStyle(4,DRAW_LINE);
   SetIndexStyle(5,DRAW_LINE);
   SetIndexStyle(6,DRAW_LINE);
   SetIndexStyle(7,DRAW_LINE);
//---- index labels
   SetIndexLabel(0,"Value");
   SetIndexLabel(1,"Value");
   SetIndexLabel(2,"Value");
   SetIndexLabel(3,"Value");
   SetIndexLabel(4,"Value");
   SetIndexLabel(5,"Value");
   SetIndexLabel(6,"Value");
   SetIndexLabel(7,"Value");
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Multi MA                                       |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
//---- check for possible errors
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//---- main loop
   for(int i=0; i<limit; i++)
     {
      //---- ma_shift set to 0 because SetIndexShift called abowe
      ExtMA1Buffer[i]=iMA(NULL,MA1_TF,MA1_Period,0,MA1_Method,MA1_Apply_to,i);
      ExtMA2Buffer[i]=iMA(NULL,MA2_TF,MA2_Period,0,MA2_Method,MA2_Apply_to,i);
      ExtMA3Buffer[i]=iMA(NULL,MA3_TF,MA3_Period,0,MA3_Method,MA3_Apply_to,i);
      ExtMA4Buffer[i]=iMA(NULL,MA4_TF,MA4_Period,0,MA4_Method,MA4_Apply_to,i);
      ExtMA5Buffer[i]=iMA(NULL,MA5_TF,MA5_Period,0,MA5_Method,MA5_Apply_to,i);
      ExtMA6Buffer[i]=iMA(NULL,MA6_TF,MA6_Period,0,MA6_Method,MA6_Apply_to,i);
      ExtMA7Buffer[i]=iMA(NULL,MA7_TF,MA7_Period,0,MA7_Method,MA7_Apply_to,i);
      ExtMA8Buffer[i]=iMA(NULL,MA8_TF,MA8_Period,0,MA8_Method,MA8_Apply_to,i);
     }
//---- done
   return(0);
  }
//+------------------------------------------------------------------+

Comments