lil_youngin86

Download script
Author: Copyright � 2006, MetaQuotes Software Corp.
lil_youngin86

This custom technical indicator is designed to help traders visualize momentum and price trends by analyzing the relationship between two different types of moving averages. Instead of looking at raw price action alone, it processes data to identify when the market's "speed" or "strength" is shifting in a specific direction.

Core Mechanics

The logic operates by calculating the difference between two specific smoothed averages:

  1. A Long-Term Average: A broader measurement that tracks the general trend over a larger period (set by default to 55 units).
  2. A Short-Term Average: A faster, more reactive measurement that follows recent price movements closely (set by default to 8 units).

By subtracting the short-term value from the long-term value, the script identifies the current "gap" or momentum between these two indicators. This gap acts as a baseline for the visual data shown on your chart.

Visual Representation

The indicator displays its results in a separate window below the main price chart using a histogram format. The logic then applies a color-coded system to help you distinguish between rising and falling momentum:

  • Green Histogram: This appears when the current momentum value is higher than it was in the previous period. It signifies that the underlying trend is gaining strength or moving upward.
  • Red Histogram: This appears as soon as the momentum value drops compared to the previous period. It signals a loss of strength or a downward shift in the trend's momentum.

How to Interpret the Logic

Rather than just showing you where the price is, this script highlights how the trend is behaving.

  • When the histogram turns Green, it suggests that the price is pushing forward with increasing force.
  • When the histogram turns Red, it indicates that the upward pressure is fading or reversing.

By monitoring these color transitions, traders can use the tool to identify potential turning points in the market, helping them see whether a move is still gaining steam or if it is beginning to lose its momentum.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
6 Views
0 Downloads
0 Favorites
lil_youngin86
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                                                lil_youngin86.mq4 |
//|                      Copyright © 2006, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red
//---- input parameters
extern int       SMA_MED=55;
extern int       SMA_CLOSE=8;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//---- indicator buffers
double ExtGreenBuffer[];
double ExtRedBuffer[];
double ExtMABuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- additional buffers are used for counting
   IndicatorBuffers(5);
//---- drawing settings
   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_HISTOGRAM);
   SetIndexBuffer(1,ExtMapBuffer2);
   IndicatorDigits(5);
   SetIndexDrawBegin(0,34);
   SetIndexDrawBegin(1,34);
//---- indicator buffers mapping
   SetIndexBuffer(0, ExtGreenBuffer);
   SetIndexBuffer(1, ExtRedBuffer);
   SetIndexBuffer(2, ExtMABuffer);
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("lil_youngin86   ");
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Awesome Oscillator                                               |
//+------------------------------------------------------------------+
int start()
  {
   int    limit;
   int    counted_bars=IndicatorCounted();
   double prev,current;
//---- 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;
//---- macd counted in the 1-st additional buffer
   for(int i=0; i<limit; i++)
      ExtMABuffer[i]=iMA(NULL,0,SMA_MED,0,MODE_SMA,PRICE_MEDIAN,i)-iMA(NULL,0,SMA_CLOSE,0,MODE_SMA,PRICE_CLOSE,i);
//---- dispatch values between 2 buffers
   bool up=true;
   for(i=limit-1; i>=0; i--)
     {
      current=ExtMABuffer[i];
      prev=ExtMABuffer[i+1];
      if(current>prev) up=true;
      if(current<prev) up=false;
      if(!up)
        {
         ExtRedBuffer[i]=current;
         ExtGreenBuffer[i]=0.0;
        }
      else
        {
         ExtGreenBuffer[i]=current;
         ExtRedBuffer[i]=0.0;
        }
     }
//---- done
   return(0);
  }
//+------------------------------------------------------------------+

Comments