Combined_MA_Signal

Download script
Author:
Combined_MA_Signal

This technical indicator is designed to provide traders with visual momentum and trend signals by analyzing price movements through a custom mathematical smoothing process. Rather than simply following the raw price of an asset, it focuses on the relationship between different moving averages to identify high-probability entry points.

Core Operational Logic

1. Multi-Layered Data Smoothing The logic begins by calculating a series of "differences" between four distinct moving averages. By subtracting and adding these specific averages together, the script isolates the underlying momentum of the market. This process helps filter out the "noise" (minor price fluctuations) that often confuses standard indicators, allowing the user to see the cleaner direction of the trend.

2. Dynamic Signal Compilation The script takes these calculated differences and aggregates them over a user-defined timeframe (the Signal period).

  • It builds a momentum base by totaling these differences.
  • It applies a specific weighting system where certain data points are prioritized over others based on their position in the calculation cycle.
  • The result is a smoothed value that represents the "strength" of the current price movement.

3. Trend Detection and Filtering Once the primary momentum values are established, the script performs a comparison between the current state and the previous state:

  • Upward Momentum: If the momentum base is increasing and crosses a specific threshold (the Filter Points), it identifies a potential bullish move.
  • Downward Momentum: Conversely, if the momentum base is decreasing and falls below that same threshold, it identifies a potential bearish move.

4. Visual Output To make this data actionable for a human trader, the script translates these mathematical conditions into visual markers on a separate window:

  • It uses specific colors and symbols (arrows/histograms) to highlight where the momentum has shifted significantly enough to warrant attention.
  • The "Filter Points" setting acts as a gatekeeper; by adjusting this, users can decide how much of a price move is required before a signal is actually displayed, helping to prevent "false positives" in choppy markets.

Summary for Traders

Essentially, this tool looks at the "speed" and "acceleration" of the market. It calculates how fast the price is moving by comparing different historical averages, filters out the minor vibrations of the market, and then places a visual marker on your chart only when the momentum changes with enough significant force to be considered a meaningful trend shift.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
9 Views
1 Downloads
0 Favorites
Combined_MA_Signal
//+------------------------------------------------------------------+
//|                                           Combined MA Signal.mq4 |
//|                                                  Edi Dimitrovski |
//|                                              http://maktrade.org |
//+------------------------------------------------------------------+
#property copyright ""
#property link      ""

#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 LightSeaGreen
#property indicator_color2 Silver
#property indicator_color3 Green
#property indicator_color4 Red
#property indicator_width3 1
#property indicator_width4 1
//---- input parameters
extern int       Signal=8;
extern bool      Slow=0;
extern bool      Repaint=0;
extern double    FilterPoints=8;
//---- indicator buffers
double ExtSilverBuffer[];
double ExtGreenBuffer[];
double ExtBlueBuffer[];
double ExtRedBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- drawing settings
//----
   SetIndexDrawBegin(0,Signal);
   SetIndexDrawBegin(1,Signal);
   SetIndexDrawBegin(2,Signal);
   SetIndexDrawBegin(3,Signal);
   IndicatorDigits(Digits+1);
//---- indicator style
   SetIndexStyle(1,DRAW_HISTOGRAM);
   SetIndexStyle(2,DRAW_ARROW);
   SetIndexStyle(3,DRAW_ARROW);
   SetIndexArrow(2,241);
   SetIndexArrow(3,242);
//---- indicator buffers mapping
   SetIndexBuffer(0,ExtSilverBuffer);
   SetIndexBuffer(1,ExtGreenBuffer);
   SetIndexBuffer(2,ExtBlueBuffer);
   SetIndexBuffer(3,ExtRedBuffer);
   SetIndexEmptyValue(2,0.0);
   SetIndexEmptyValue(3,0.0);
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("CMA("+Signal+","+Slow+","+Repaint+")");
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Moving Average of Oscillator                                     |
//+------------------------------------------------------------------+
int start()
  {
   int count, limit;
   double dif,buf1,buf2;
   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;
//---- counted 2 buffers
   for(int i=0; i<limit; i++)
    {
     ExtGreenBuffer[i]=0.0;
     ExtSilverBuffer[i]=0.0;
     buf1=0;
     buf2=0;
     count=Signal;
     while(count>0)
      {
       dif=
          iMA(NULL,0,(count*2),0,3,0,i)
         -iMA(NULL,0,(count*3),0,3,4,i)
         +iMA(NULL,0,(count*2),0,3,4,i)
         -iMA(NULL,0,(count*3),0,3,1,i);
       if(count>=Signal/2)ExtGreenBuffer[i]+=dif;
       if(dif!=0.0)dif/=(count+1)/2;
       if(count+1<=Signal)ExtSilverBuffer[i]+=dif;
       count--;
      }
    }
//---- counted 2 additional buffers
   for(i=0; i<limit; i++)
    {
     if ((ExtGreenBuffer[i]>ExtGreenBuffer[i+1] || ExtGreenBuffer[i]>0.0)
      && ExtSilverBuffer[i]>ExtSilverBuffer[i+1]+Point*FilterPoints && 
          (ExtSilverBuffer[i]>0.0 || !Slow) && 
           (!(ExtRedBuffer[i]<0.0)
             || Repaint)) ExtBlueBuffer[i]=2*Point;
     else if ((ExtGreenBuffer[i]<ExtGreenBuffer[i+1] || ExtGreenBuffer[i]<0.0)
      && ExtSilverBuffer[i]+Point*FilterPoints<ExtSilverBuffer[i+1] && 
          (ExtSilverBuffer[i]<0.0 || !Slow) && 
           (!(ExtBlueBuffer[i]>0.0)
             || Repaint)) ExtRedBuffer[i]=-2*Point;
    }
//---- 
//---- done
   return(0);
  }
//+------------------------------------------------------------------+

Comments