3DMa Indicator For MT4

3DMa Indicator For MT4

The 3DMa Indicator For MT4 is an indicator which adds a new dynamic to Moving Average trading systems because it displays the Moving Averages within trending markets in three dimensional format. This takes your trading analysis to a new dimension because not only are the Moving Averages in three dimensional format but it also has a rainbow colour scheme to it that is similar to a heat map. This colour map allows you to clearly detect the market sentiment and the trend reversals as it happens; furthermore you may change the parameters like the period of the Moving Averages by using your mouse (nothing complicated about that).

FREE 3DMa Indicator

Download the FREE 3DMa Indicator for MT4.

To receive my email 100% sure: 
Put my email on your whitelist!

 

Partially Automated Trading Besides Your Day Job

Alerts In Real-Time When Divergences Occur

My Recommended MT4/MT5 Broker

 

Installing the 3DMa Indicator For MT4

After you downloaded the indicator via the form above you need to unzip the zip-file. Then you need to copy the file 3DMa.mq4 into the folder MQL4\Indicators of your MT4 installation. After that please restart MT4 and then you will be able to see the indicator in the list of indicators.

Parameters of the 3DMa Indicator For MT4

The 3DMa Indicator For MT4 has 0 parameters to configure.

Buffers of the 3DMa Indicator For MT4

The 3DMa Indicator For MT4 provides 0 buffers.

Main Parts Of The Code

int OnCalculate(const int rates_total,const int prev_calculated,const int begin,const double &price[])
  {
   return(rates_total);
  }
//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
   static int MaOld=-1,stepMaOld=-1;
   static bool click=true;
   static string pre_sparam="1";
   static int preMa=0;
   if(sparam=="1" && sparam!=pre_sparam) if(click) click=false; else click=true;
   if(click)
     {
      Ma=W.MouseX+100;
      if (Ma gt =Size) Ma=Size-1;
      stepMa=W.MouseY-15;
      if(stepMa lt =0) stepMa=1;
      stepMa=1+stepMa/10;
      if(stepMa gt Ma) stepMa=Ma-1;
      if (Size gt =W.BarsInWind && preMa!=Ma) nMA();
      preMa=Ma;
     }
   if(id==CHARTEVENT_CHART_CHANGE || MaOld!=Ma || stepMaOld!=stepMa)
     {
      Size=CopyClose(_Symbol,_Period,(int)W.Right_bar,W.BarsInWind+Ma-1,close);
      if (Ma gt =Size) Ma=Size-1;
      if (Size gt =W.BarsInWind) nMA();
      MaOld=Ma; stepMaOld=stepMa;
     }
   pre_sparam=sparam;
  }
//+------------------------------------------------------------------+

void nMA()
  {
   Canvas.Erase();
   double S=0;
   double A[]; 
   ArrayResize(A,W.BarsInWind);
   for(int i=Size-1;i gt =Size-Ma; i--) S+=close[i];
   for(int Per=Ma;Per gt 0;)
     {
      double s=S;
      uint Clr=Grad((double)Per/Ma);
      int j=0;
      for(int i=Size-1; i gt =0;i--)
        {
         double Y=s/Per;
         j=Size-1-i;
         if (j lt W.BarsInWind) A[j]=Y; else break;
         if(i-Per gt =0) s=s+close[i-Per]-close[i]; else break;
        }
      DrawIndicatorLine(A,Clr,Floor(W.Right_bar),j+Floor(W.Right_bar));
      for(j=0; j lt stepMa; j++) if(Per gt 0) {S=S-close[Size-Per]; Per--;} else break;
     }
   Canvas.TextPosY=90;
   Canvas.Comm("Max Period MA = "+string(Ma));
   Canvas.Comm("Step MA = "+string(stepMa));
   Canvas.Update();
  }
//+------------------------------------------------------------------+
uint Grad(double p)
  {
   static uint Col[6]={0xFF0000FF,0xFFFF00FF,0xFFFF0000,0xFFFFFF00,0xFF00FF00,0xFF00FFFF};
   if(p gt 0.9999) return Col[5];
   if(p lt 0.0001) return Col[0];
   p=p*5;
   int n=(int)p;
   double k=p-n;
   argb c1,c2;
   c1.clr=Col[n];
   c2.clr=Col[n+1];
   return ARGB(255,c1.c[2]+uchar(k*(c2.c[2]-c1.c[2])+0.5),
               c1.c[1]+uchar(k*(c2.c[1]-c1.c[1])+0.5),
               c1.c[0]+uchar(k*(c2.c[0]-c1.c[0])+0.5));
  }
//+------------------------------------------------------------------+

void DrawIndicatorLine(double &arr[], uint clr, int barStart=INT_MIN, int barEnd=INT_MAX)
  {
   if (barStart lt W.Right_bar) barStart=Floor(W.Right_bar);
   if (barEnd gt W.Left_bar) barEnd=W.Left_bar;
   if (W.Left_bar lt =barStart) return;
   int n=barEnd-barStart;
   int x=(int)Canvas.X((double)barStart);
   int pre_y=Round(Canvas.Y(arr[0]));
   Canvas.PixelSet(x,pre_y,clr);
   x-=W.dx_pix;
   for(int i=1; i lt n; i++, x-=W.dx_pix) 
     {
      int y=Round(Canvas.Y(arr[i]));  
      if(fabs(y-pre_y) gt 1 || W.dx_pix gt 1) Canvas.Line(x,y,x+W.dx_pix,pre_y,clr);
      else Canvas.PixelSet(x,y,clr);
      pre_y=y;
     }
  }

 

About Me

I'm Mike Semlitsch the owner of PerfectTrendSystem.com. My trading career started in 2007. Since 2013 I have helped thousands of traders to take their trading to the next level. Many of them are now constantly profitable traders. 

The following performance was achieved by me while trading live in front of hundreds of my clients:

Connect With Me:  

This FREE Indicator Can Transform
Your Trading!

FREE Indicator + Telegram Group


Request the Ultimate Double Top/Bottom Indicator which is used by 10,000+ traders.

Results From 5 Months!
This service starts soon! Be the first who get's notified when it begins!