KG Momentum V.1.1a Current

Download script
Author: Copyright � 2007, MetaQuotes Software Corp.
KG Momentum V.1.1a Current

This technical indicator is designed to analyze market momentum by calculating the percentage change in price over a specific long-term period. It essentially transforms raw price data into a momentum oscillator that helps traders identify trends and potential entry or exit points based on "crossovers."

Core Logic & Functionality

1. Momentum Calculation The script begins by calculating a Linear Weighted Moving Average (LWMA) over a large base period (defaulted to 500 units). It then determines the percentage difference between the current moving average and the previous one. This provides a smoothed look at how fast the price is moving in a specific direction, effectively filtering out minor market "noise."

2. Dual Signal Smoothing Once the primary momentum value is established, the script processes it further by applying two separate filters:

  • The Primary Line: A smoothed version of the raw momentum calculation.
  • The Signal Line: A second smoothing layer applied to the first line. By using two different levels of smoothing, the indicator allows traders to see the "trend" versus the "signal," making it easier to spot when momentum is accelerating or decelerating.

3. Trend Identification & Crossovers The core utility of this script lies in the relationship between these two lines:

  • Bullish Signal (Buy): The script looks for a specific "Cross Up." If the primary momentum line moves from below to above the signal line, it identifies an upward shift in momentum.
  • Bearish Signal (Sell): Conversely, if the primary momentum line drops from above to below the signal line, it identifies a downward shift in momentum.

4. Automated Notifications The script is equipped with an alert system to notify the user in real-time when these specific crossover events occur. Depending on your settings, it can:

  • Trigger a Pop-up Alert on your trading terminal.
  • Send an Email Notification containing the current price, date, time, and symbol of the asset where the signal occurred.

Summary for Traders

This tool is meant to help you stay ahead of the market by identifying when the "speed" of a price move changes direction. Rather than looking at price alone, it shows you when the underlying momentum shifts, providing visual cues (lines) and automated alerts (pop-ups/emails) to help you react to Buy and Sell opportunities more quickly.

Indicators Used
Moving average indicatorMoving average indicator
Miscellaneous
Implements a curve of type %1It issuies visual alerts to the screenIt sends emails
8 Views
0 Downloads
0 Favorites
KG Momentum V.1.1a Current
#property copyright "Copyright © 2007, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net/"

#property indicator_separate_window
#property indicator_levelstyle 0
#property indicator_buffers 2
#property indicator_color1 MediumBlue
#property indicator_color2 Red

double g_period_76 = 500.0;
extern double Filter_1 = 4.0;
extern int Price_Type = 0;
int g_ma_method_96 = MODE_LWMA;
extern bool Alert_ON = FALSE;
extern bool EmailON = FALSE;
string gs_108;
string gs_116;
string gs_124;
double g_ibuf_132[];
double g_ibuf_136[];
int gi_140 = 0;
int gi_144 = 0;

int init() {
   string ls_0;
   SetIndexStyle(0, DRAW_LINE);
   SetIndexBuffer(0, g_ibuf_132);
   SetIndexStyle(1, DRAW_LINE);
   SetIndexBuffer(1, g_ibuf_136);
   IndicatorShortName(ls_0);
   SetIndexLabel(0, ls_0);
   return (0);
}

int start() {
   int l_ind_counted_4 = IndicatorCounted();
   if (Bars <= g_period_76) return (0);
   if (l_ind_counted_4 < 1) for (int li_0 = 1; li_0 <= g_period_76; li_0++) g_ibuf_132[Bars - li_0] = 0.0;
   li_0 = Bars - g_period_76 - 1.0;
   if (l_ind_counted_4 >= g_period_76) li_0 = Bars - l_ind_counted_4 - 1;
   while (li_0 >= 0) {
      g_ibuf_132[li_0] = 100.0 * iMA(NULL, 0, g_period_76, 0, MODE_LWMA, Price_Type, li_0) / iMA(NULL, 0, g_period_76, 0, MODE_LWMA, Price_Type, li_0 + 1) - 100.0;
      li_0--;
   }
   int li_8 = Bars - l_ind_counted_4;
   for (int li_12 = 0; li_12 < li_8; li_12++) {
      g_ibuf_132[li_12] = iMAOnArray(g_ibuf_132, Bars, Filter_1, 0, g_ma_method_96, li_12);
      g_ibuf_136[li_12] = iMAOnArray(g_ibuf_132, Bars, Filter_1, 1, g_ma_method_96, li_12);
      if (g_ibuf_132[li_12] > g_ibuf_132[li_12 + 1]) gs_108 = "Up";
      if (g_ibuf_132[li_12] < g_ibuf_132[li_12 + 1]) gs_108 = "Down";
      if (g_ibuf_132[li_12] == g_ibuf_132[li_12 + 1]) gs_108 = "Flat";
      if (g_ibuf_136[li_12] > g_ibuf_136[li_12 + 1]) gs_116 = "Up";
      if (g_ibuf_136[li_12] < g_ibuf_136[li_12 + 1]) gs_116 = "Down";
      if (g_ibuf_136[li_12] == g_ibuf_136[li_12 + 1]) gs_116 = "Flat";
      if (g_ibuf_132[li_12] > g_ibuf_136[li_12]) gs_124 = "CROSSED UP";
      if (g_ibuf_132[li_12] < g_ibuf_136[li_12]) gs_124 = "CROSSED DOWN";
      if (g_ibuf_132[li_12] == g_ibuf_136[li_12]) gs_124 = "NEUTRAL";
      if (g_ibuf_132[li_12] < g_ibuf_136[li_12] && g_ibuf_132[li_12 + 1] > g_ibuf_136[li_12 + 1]) {
         if (li_12 == 0 && gi_144 == FALSE) {
            gi_144 = TRUE;
            gi_140 = FALSE;
            if (Alert_ON) {
               Alert("SELL signal at Ask=", Ask, 
                  "\n Bid=", Bid, 
                  "\n Date=", TimeToStr(TimeCurrent(), TIME_DATE), " ", TimeHour(TimeCurrent()), ":", TimeMinute(TimeCurrent()), 
               "\n Symbol=", Symbol(), " Period=", Period());
            }
            if (EmailON) {
               SendMail("SELL signal alert", "SELL signal at Ask=" + DoubleToStr(Ask, 4) + ", Bid=" + DoubleToStr(Bid, 4) + ", Date=" + TimeToStr(TimeCurrent(), TIME_DATE) + " " +
                  TimeHour(TimeCurrent()) + ":" + TimeMinute(TimeCurrent()) + " Symbol=" + Symbol() + " Period=" + Period());
            }
         }
      }
      if (g_ibuf_132[li_12] > g_ibuf_136[li_12] && g_ibuf_132[li_12 + 1] < g_ibuf_136[li_12 + 1]) {
         if (li_12 == 0 && gi_140 == FALSE) {
            gi_140 = TRUE;
            gi_144 = FALSE;
            if (Alert_ON) {
               Alert("BUY signal at Ask=", Ask, 
                  "\n Bid=", Bid, 
                  "\n Time=", TimeToStr(TimeCurrent(), TIME_DATE), " ", TimeHour(TimeCurrent()), ":", TimeMinute(TimeCurrent()), 
               "\n Symbol=", Symbol(), " Period=", Period());
            }
            if (EmailON) {
               SendMail("BUY signal alert", "BUY signal at Ask=" + DoubleToStr(Ask, 4) + ", Bid=" + DoubleToStr(Bid, 4) + ", Date=" + TimeToStr(TimeCurrent(), TIME_DATE) + " " +
                  TimeHour(TimeCurrent()) + ":" + TimeMinute(TimeCurrent()) + " Symbol=" + Symbol() + " Period=" + Period());
            }
         }
      }
   }
   IndicatorShortName("KG Mom V.1.1a   (" + gs_108 + " " + gs_116 + ")     " + gs_124 + "    ");
   return (0);
}

Comments