Awesome_Signal

Download script
Awesome_Signal

This custom indicator is designed to provide traders with a visual tool for analyzing market momentum and identifying potential trend reversals. It functions by processing price data into three distinct visual components: two dynamic histograms and a smoothed signal line.

Core Logic and Functionality

The logic of the script operates in three primary stages:

1. Momentum Calculation The foundation of the indicator is built on a comparative analysis of moving averages. The script calculates the difference between a "Fast" moving average (which reacts quickly to price changes) and a "Slow" moving average (which tracks the broader trend). By subtracting the slow value from the fast value, the tool creates a raw momentum figure.

2. Directional Visualization (The Histograms) Once the raw momentum is calculated, the script analyzes the movement of these values from one bar to the next:

  • Growth Tracking: If the momentum is increasing compared to the previous period, it is visualized as a specific histogram (traditionally green).
  • Decline Tracking: If the momentum is decreasing, it is visualized as a different histogram (traditionally red).
  • Trend Identification: This allows traders to see at a glance whether the current market strength is expanding or contracting.

3. The Signal Line To smooth out the "noise" of the rapid fluctuations in the histograms, the script applies a final smoothing calculation over the momentum data. This produces a continuous signal line.

  • Smoothing: It averages the momentum values over a user-defined period to provide a clearer picture of the underlying trend.
  • Shifting: The tool includes a feature to shift this signal line forward or backward, allowing users to adjust its position on the chart to better align with their specific visual preferences or strategy requirements.

Summary for the User

In essence, this script takes complex price movements and simplifies them into a readable "momentum map." It tells you how fast the market is moving (the difference between averages), whether that speed is currently accelerating or slowing down (the dual-colored histograms), and provides a smoothed guide (the signal line) to help identify the overall direction of the market trend.

Indicators Used
Moving average indicatorMoving average indicator
Miscellaneous
Implements a curve of type %1
12 Views
0 Downloads
0 Favorites
Awesome_Signal
//+------------------------------------------------------------------+
//|                                               Awesome_Signal.mq4 |
//|                      Copyright © 2005, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+

// Ðàñøèðåí è äîïîëíåí Asystem2000
// Ðàñøèðåíèå: ñòðîèòñÿ ñèãíàëüíàÿ ëèíèÿ
// Äîïîëíåíèÿ:
// 1. Ââåäåíà âîçìîæíîñòü íàñòðîéêè áûñòðîé, ìåäëåííîé è ñèãíàëüíîé ëèíèé
// 2. Ââåäåíà âîçìîæíîñòü íàñòðîéêè ñìåùåíèÿ ñèãíàëüíîé ëèíèè

#property  copyright "Copyright © 2005, MetaQuotes Software Corp."
#property  link      "http://www.metaquotes.net/"
//---- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 4
#property  indicator_color1  Black
#property  indicator_color2  Green
#property  indicator_color3  Red
#property  indicator_color4  Gold

extern int Fast = 5;
extern int Slow = 34;
extern int Signal=5;
extern int SignalShift=0;

//---- indicator buffers
double     ExtBuffer0[];
double     ExtBuffer1[];
double     ExtBuffer2[];
double     SignalBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   //---- drawing settings
   SetIndexStyle(0,DRAW_NONE);
   SetIndexStyle(1,DRAW_HISTOGRAM);
   SetIndexStyle(2,DRAW_HISTOGRAM);
   SetIndexStyle(3,DRAW_LINE,STYLE_SOLID);
    SetIndexShift( 3, SignalShift); 
   
   IndicatorDigits(Digits+1);
   SetIndexDrawBegin(0,34);
   SetIndexDrawBegin(1,34);
   SetIndexDrawBegin(2,34);
   SetIndexDrawBegin(3,34);
   
//---- 3 indicator buffers mapping
   SetIndexBuffer(0,ExtBuffer0);
   SetIndexBuffer(1,ExtBuffer1);
   SetIndexBuffer(2,ExtBuffer2);
   SetIndexBuffer(3,SignalBuffer);
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("AO");
   SetIndexLabel(1,NULL);
   SetIndexLabel(2,NULL);
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Awesome Oscillator                                               |
//+------------------------------------------------------------------+
int start()
  {
   int    limit;
   int    counted_bars=IndicatorCounted();
   double prev,current;
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//---- macd
   for(int i=0; i<limit; i++)
      ExtBuffer0[i]=iMA(NULL,0,Fast,0,MODE_SMA,PRICE_CLOSE,i)-iMA(NULL,0,Slow,0,MODE_SMA,PRICE_WEIGHTED,i);
//---- dispatch values between 2 buffers
   bool up=true;
   for(i=limit-1; i>=0; i--)
     {
      current=ExtBuffer0[i];
      prev=ExtBuffer0[i+1];
      if(current>prev) up=true;
      if(current<prev) up=false;
      if(!up)
        {
         ExtBuffer2[i]=current;
         ExtBuffer1[i]=0.0;
        }
      else
        {
         ExtBuffer1[i]=current;
         ExtBuffer2[i]=0.0;
        }
     }
// ----- Draw signal
    for(i=0; i<limit; i++)
         SignalBuffer[i]=iMAOnArray(ExtBuffer0,Bars,Signal,0,MODE_SMA,i);
//---- done
   return(0);
  }
//+------------------------------------------------------------------+

Comments