ImpulseOsMA

Download script
Author: ����������� �������
ImpulseOsMA

Indicator Overview

The ImpulseOsMA is a technical analysis tool designed to help traders identify trend momentum and potential price "impulses" by analyzing the relationship between moving averages. Rather than simply showing where the price is, this indicator calculates the interaction between multiple layers of moving averages to provide visual cues regarding the strength and direction of the market.

How It Works

The logic behind this tool operates through a multi-step calculation process:

1. Calculating Momentum (The Base Layer) The script starts by comparing two different types of moving averages—a "Fast" one and a "Slow" one. By subtracting the Slow average from the Fast average, it creates a base value that represents the immediate momentum of the price. When this difference is wide, it suggests a strong trend; when it narrows, the trend may be weakening.

2. Creating the Signal (The Smoothing Layer) The tool then takes that base momentum value and applies another moving average to it (known as a Signal line). This helps smooth out "noise" in the data, allowing the indicator to distinguish between minor price flickers and sustained directional shifts.

3. Trend Confirmation To ensure the signals are reliable, the script looks at a third independent moving average. It compares the current direction of the momentum (calculated in step 1) against the general direction of this third moving average.

Visual Representation

The indicator displays its findings using different visual elements (lines and histograms) in a separate window below the main price chart:

  • Bullish Momentum: When both the immediate momentum is increasing and the long-term moving average is trending upward, the tool highlights a positive impulse.
  • Bearish Momentum: When the immediate momentum is decreasing and the long-term moving average is trending downward, it highlights a negative impulse.
  • Neutral/Conflict Zones: If the directions are mixed (for example, if price momentum is moving up but the overall trend is moving down), the indicator marks these as neutral or conflicting zones.

Summary for Traders

Essentially, this script acts as a filter. It ignores minor market movements and only "highlights" moments where the short-term velocity of the price aligns with the broader trend. This allows traders to see at a glance whether the current move has enough underlying strength to be considered a significant impulse in the market.

Indicators Used
Moving average indicatorMoving average indicator
Miscellaneous
Implements a curve of type %1
8 Views
0 Downloads
0 Favorites
ImpulseOsMA
//+------------------------------------------------------------------+
//|                                                  ImpulseOsMA.mq4 |
//|                                              Äçåí÷àðñêèé Íèêîëàé |
//|                                               dzenchar@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Äçåí÷àðñêèé Íèêîëàé"
#property link      "dzenchar@gmail.com"

#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 Red
#property indicator_color4 LimeGreen
#property indicator_color5 DeepSkyBlue
//---- input parameters
extern int       FastEMA=12;
extern int       SlowEMA=26;
extern int       SignalEMA=9;
extern int       MAPeriod=12;
extern int       MAMode=0; 
/* Êàêîé ìåòîä MA èñïîëüçîâàòü: 0 - SMA, 1 - EMA*/
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(2,DRAW_HISTOGRAM);
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexStyle(3,DRAW_HISTOGRAM);
   SetIndexBuffer(3,ExtMapBuffer4);
   SetIndexStyle(4,DRAW_HISTOGRAM);
   SetIndexBuffer(4,ExtMapBuffer5);
   
   IndicatorShortName("ImpulseOsMA ("+FastEMA+","+SlowEMA+","+SignalEMA+","+MAPeriod+","+MAMode+")");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int i;
   int bCount;
   int    counted_bars=IndicatorCounted();
   double cur, prev, curMA, prevMA;
//----
   if(counted_bars>0) counted_bars--;
   bCount=Bars-counted_bars;
   for(i=0; i<bCount; i++)
      ExtMapBuffer1[i]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
   for(i=0; i<bCount; i++)
      ExtMapBuffer2[i]=iMAOnArray(ExtMapBuffer1,Bars,SignalEMA,0,MODE_EMA, i);
   for(i=0; i<bCount; i++)
   {
      cur = ExtMapBuffer1[i]-ExtMapBuffer2[i];
      prev = ExtMapBuffer1[i+1]-ExtMapBuffer2[i+1];
      if(MAMode == 0)
      {
         curMA=iMA(NULL,0,MAPeriod,0,MODE_SMA,PRICE_CLOSE,i);
         prevMA=iMA(NULL,0,MAPeriod,0,MODE_SMA,PRICE_CLOSE,i+1);
      }
      if(MAMode == 1)
      {
         curMA=iMA(NULL,0,MAPeriod,0,MODE_EMA,PRICE_CLOSE,i);
         prevMA=iMA(NULL,0,MAPeriod,0,MODE_EMA,PRICE_CLOSE,i+1);
      }
      if(cur>prev && curMA>prevMA)
      {
         ExtMapBuffer3[i]=0;
         ExtMapBuffer4[i]=cur*3;
         ExtMapBuffer5[i]=0;
      }
      else if(cur<prev && curMA<prevMA)
      {
         ExtMapBuffer3[i]=cur*3;
         ExtMapBuffer4[i]=0;
         ExtMapBuffer5[i]=0;
      }
      else if((cur-prev)*(curMA-prevMA)<=0)
      {
         ExtMapBuffer3[i]=0;
         ExtMapBuffer4[i]=0;
         ExtMapBuffer5[i]=cur*3;
      }
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments