awesome_v2

This script functions as a specialized visual momentum indicator designed to help traders identify the strength and direction of price movements in the financial markets. By analyzing historical price data, it creates a distinct visual representation that distinguishes between bullish (upward) and bearish (downward) trends.

Core Analytical Logic

The logic operates in two primary stages: calculation and visualization.

1. Momentum Calculation The foundation of the tool relies on comparing two different types of moving averages. It looks at the "median price" over two specific timeframes: a short-term period (5 bars) and a longer-term period (34 bars).

  • By subtracting the longer-term average from the shorter-term average, the script determines the current momentum of the market.
  • If the result is positive, it suggests that recent price action is stronger than the historical average.
  • If the result is negative, it indicates that the current price movement is weaker than the historical trend.

2. Directional Filtering and Visualization Once the raw momentum value is calculated, the script processes these figures to create a clear visual "histogram" for the user:

  • Trend Tracking: The script continuously monitors whether the momentum value is increasing or decreasing compared to the previous data point.
  • Dynamic Assignment: Based on this comparison, the script assigns values to two different visual buffers (represented as green and red colors).
  • Visual Output: When the momentum is trending in a specific direction, it populates one color; when the trend shifts, it switches to the other. This creates a clear, alternating histogram that allows traders to see not just the magnitude of price movement, but also the exact point where the sentiment shifted from positive to negative (or vice versa).

Summary for Traders

Instead of showing a messy line of data, this script simplifies complex market math into a clean visual signal. It effectively "filters" the noise of the market to show you whether the current momentum is accelerating upward or pulling downward, making it easier to identify potential trend reversals and sustained movements at a glance.

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

//+------------------------------------------------------------------+
//|                                                      Awesome.mq4 |
//|                      Copyright © 2004, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property  copyright "Copyright © 2004, MetaQuotes Software Corp."
#property  link      "http://www.metaquotes.net/"
//---- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 2
#property  indicator_color1  Green
#property  indicator_color2  Red
//---- indicator buffers
double     ind_buffer1[];
double     ind_buffer2[];
double     ind_buffer3[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- 1 additional buffer used for counting.
   IndicatorBuffers(3);
   //---- drawing settings
   SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,3);
   SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,3);
   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+1);
   SetIndexDrawBegin(0,34);
   SetIndexDrawBegin(1,34);
//---- 3 indicator buffers mapping
   if(!SetIndexBuffer(0,ind_buffer1) &&
      !SetIndexBuffer(1,ind_buffer2) &&
      !SetIndexBuffer(2,ind_buffer3))
      Print("cannot set indicator buffers!");
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("AO");
//---- 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++)
      ind_buffer3[i]=iMA(NULL,0,5,0,MODE_SMA,PRICE_MEDIAN,i)-iMA(NULL,0,34,0,MODE_SMA,PRICE_MEDIAN,i);
//---- dispatch values between 2 buffers
   bool up=true;
   for(i=limit-1; i>=0; i--)
     {
      current=ind_buffer3[i];
      prev=ind_buffer3[i+1];
      if(current>prev) up=true;
      if(current<prev) up=false;
      if(!up)
        {
         ind_buffer2[i]=current;
         ind_buffer1[i]=0.0;
        }
      else
        {
         ind_buffer1[i]=current;
         ind_buffer2[i]=0.0;
        }
     }
//---- done
   return(0);
  }

Comments