MA_Trigger

This technical indicator is designed to provide traders with a visual representation of market momentum and trend direction by layering multiple types of moving averages. Rather than looking at raw price data alone, the tool processes information through several distinct "filters" to smooth out market noise and identify underlying trends.

How the Logic Works

The script operates by calculating four different data lines, each serving a specific purpose in interpreting the market's movement:

1. The Foundation (Fast Trigger) The logic begins by creating a primary "Fast Trigger" line. This is derived from the opening prices of candles using an Exponential Moving Average (EMA). By focusing on the opening price and applying an exponential weight, this line reacts quickly to recent price changes, serving as the base layer for all subsequent calculations.

2. The Momentum Filter (Slow Trigger) The script then takes that Fast Trigger and applies a "Simple Moving Average" (SMMA) calculation over a specific period. This secondary line is designed to filter out minor fluctuations, providing a smoother representation of the immediate momentum generated by the initial trigger.

3. The Trend Identification (Main Line) To establish a broader perspective, a third line—the Main Line—is calculated using a longer-term Simple Moving Average based on the Fast Trigger. This line helps traders distinguish between short-term price spikes and the actual overarching trend of the market.

4. The Trend Overview (TrendOver) Finally, the script produces a "TrendOver" line. This uses a Linear Weighted Moving Average (LWMA). By weighting recent data more heavily than older data, this line provides a specialized view of the current trend's strength, helping to confirm whether the market is gaining or losing steam.

Summary for the User

In simple terms, this script doesn't just show you where the price is; it processes the price through four different "lenses."

  • The Fast Trigger and Slow Trigger work together to identify immediate movements.
  • The Main Line and TrendOver provide the context, showing you the "big picture" of the market's direction.

By observing how these lines interact—such as when a fast-moving line crosses a slower one or when they align in the same direction—traders can better identify potential entry points and shifts in market sentiment.

Indicators Used
Moving average indicatorMoving average indicator
Miscellaneous
Implements a curve of type %1
9 Views
0 Downloads
0 Favorites
MA_Trigger
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
#property  copyright "Copyright © 2007, GideonSmolders(at)gmail.com."
#property  link      ""
//---- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 4
#property  indicator_color1  Blue
#property  indicator_color2  LightBlue
#property  indicator_color3  LightPink
#property  indicator_color4  LightGreen

extern double slowPeriod=9;
extern double MainPeriod=35;
extern double TrendOverPeriod=14;


//---- indicator buffers

string signal;
double fastTrigger[];
double slowTrigger[];
double MainLine[];
double TrendOver[];



//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- 2 additional buffers are used for counting.
   IndicatorBuffers(4);
   
   SetIndexDrawBegin(0,30);
   SetIndexDrawBegin(1,30);
   SetIndexDrawBegin(2,30);
   SetIndexDrawBegin(3,30);

   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1);
   SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1);
   SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,1);
   SetIndexStyle(3,DRAW_LINE,STYLE_SOLID,1);
   
   SetIndexBuffer(0,fastTrigger);
   SetIndexLabel(0,"fastTrigger");
   SetIndexBuffer(1,slowTrigger);
   SetIndexLabel(1,"slowTrigger");
   SetIndexBuffer(2,MainLine);
   SetIndexLabel(2,"Main Line");
   SetIndexBuffer(3,TrendOver);
   SetIndexLabel(3,"TrendOver");

   ArraySetAsSeries(fastTrigger, true);
   

      
//---- name for DataWindow and indicator subwindow label

   
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Calculations                                    |
//+------------------------------------------------------------------+
int start()
  {
   int limit=ArraySize(fastTrigger);
   int i;
   int counted_bars=300;
//---- 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
   
//---- done

   for(i=0; i <= limit; i++) 
   {
   fastTrigger[i]=  iMA(Symbol(),0,3,0,MODE_EMA,PRICE_OPEN,i);
   }
   for(i=0; i <= limit; i++) 
   { 
   slowTrigger[i] = iMAOnArray(fastTrigger,0,slowPeriod,0,MODE_SMMA,i);
   }
   for(i=0; i <= limit; i++) 
   {   
   MainLine[i]= iMAOnArray(fastTrigger,0,MainPeriod,0,MODE_SMMA,i);
   }
   for(i=0; i <= limit; i++) 
   {
   TrendOver[i]= iMAOnArray(fastTrigger,0,TrendOverPeriod,0,MODE_LWMA,i);
   }
  }
//+------------------------------------------------------------------+

Comments