MAAngleTony

Download script
MAAngleTony

This tool is designed to provide visual clarity on market trends by analyzing the specific "tilt" or angle of a Moving Average. Rather than just showing you where the price has been, this indicator interprets the momentum and strength of the current trend based on how sharply the average is shifting.

How It Works

The logic operates by comparing the current value of a Moving Average against its previous value to determine the direction and velocity of the market. It essentially measures the "slope" of the line in real-time.

Key Components of the Logic:

  • Trend Identification: The tool looks at the difference between two consecutive points on a Moving Average. If the shift is positive and exceeds a specific minimum threshold, it identifies an upward trend. Conversely, if the shift is negative and exceeds that same threshold, it identifies a downward trend.
  • Momentum Filtering: By using a "Minimum Angle" setting, the script filters out minor market noise or "flat" price action. This ensures that only significant movements are highlighted, helping to separate true trends from sideways consolidation.
  • Visual Representation: The data is translated into a visual histogram:
    • Upward Momentum: Represented by one color (Lime Green), indicating a confirmed move up.
    • Downward Momentum: Represented by another color (Fire Brick), indicating a confirmed move down.
    • Neutral Zone: When the movement is too slight to meet the minimum angle requirements, it is marked with a third color (Yellow), indicating a lack of clear direction or a period of equilibrium.

Summary for Traders

This indicator acts as a momentum filter. It tells you not just which way the price is going, but how aggressively it is moving in that direction. By focusing on the "angle" of the trend, it helps traders identify when a move has significant strength and when the market is simply drifting without clear intent.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
13 Views
0 Downloads
0 Favorites
MAAngleTony
//+------------------------------------------------------------------+
//|                                                                  |
//|                 Copyright © 1999-2008, MetaQuotes Software Corp. |
//|                                         http://www.metaquotes.ru |
//+------------------------------------------------------------------+
#property  copyright "jpkfox"
#property  link      "http://www.strategybuilderfx.com/forums/showthread.php?t=15274&page=1&pp=8"
//---- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 3
//----
#property  indicator_color1  LimeGreen
#property  indicator_color2  FireBrick
#property  indicator_color3 Yellow
//---- indicator parameters
extern int MAMode=1;
extern int MAPeriod=34;
extern int Price=0;
extern double AngleMin=0.0020;
//---- indicator buffers
double UpBuffer[];
double DownBuffer[];
double ZeroBuffer[];
double Angle;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- 2 additional buffers are used for counting.
   IndicatorBuffers(3);
//---- drawing settings
   SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,4);
   SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,4);
   SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID,4);
   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+2);
//---- 3 indicator buffers mapping
   if(!SetIndexBuffer(0,UpBuffer) &&
      !SetIndexBuffer(1,DownBuffer) &&
      !SetIndexBuffer(2,ZeroBuffer))
      Print("cannot set indicator buffers!");
//---- name for DataWindow and indicator subwindow label
   //IndicatorShortName("MAAngle("+MAPeriod+","+AngleTreshold+","+StartMAShift+","+EndMAShift+")");
   IndicatorShortName("MAAngle");
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| The angle for EMA                                                |
//+------------------------------------------------------------------+
int start()
  {
   double fEndMA, fStartMA;
   double fAngle, mFactor, dFactor;
   int nLimit, i;
   int nCountedBars;
   double angle;
   int ShiftDif;
   string Sym;
   if (MAMode>=4) MAMode=0;
   nCountedBars=IndicatorCounted();
//---- check for possible errors
   if(nCountedBars<0)
      return(-1);
//---- last counted bar will be recounted
   if(nCountedBars>0)
      nCountedBars--;
   nLimit=Bars-nCountedBars;
   dFactor=2*3.14159/180.0;
   mFactor=10000.0;
   Sym=StringSubstr(Symbol(),3,3);
//---- main loop
   for(i=0; i<nLimit; i++)
     {
      DownBuffer[i]=0.0;
      UpBuffer[i]=0.0;
      ZeroBuffer[i]=0.0;
//----
      Angle=iMA(NULL,0,MAPeriod,0,MAMode,Price,i)-iMA(NULL,0,MAPeriod,0,MAMode,Price,i+1);
      if(Angle>AngleMin)
         UpBuffer[i]=1;
      else if (Angle<-AngleMin)
            DownBuffer[i]=-1;
         else ZeroBuffer[i]=0.5;
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments