Awesome_v3
Download scriptThis script functions as a specialized visual tool for financial charting, designed to help traders identify the underlying momentum and "health" of a market trend. Instead of just showing raw price movements, it translates complex price history into a simplified histogram that highlights the strength of a move.
How the Logic Works
The logic operates in two distinct stages:
1. Calculating Momentum (The Core Calculation) The tool begins by comparing two different types of averages over specific timeframes. It calculates a short-term average and subtracts a longer-term average from it.
- When the short-term average is significantly higher than the long-term average, it indicates positive momentum (bullish).
- When the short-term average falls below the long-term average, it suggests negative momentum (bearish).
The resulting difference between these two averages provides a "baseline" of how fast and in what direction the price is moving at any given moment.
2. Visualizing the Trend (The Histogram Display) To make this data easy for a human to read at a glance, the script applies a secondary layer of logic to separate the information visually:
- Trend Identification: The tool looks at whether the momentum value is increasing or decreasing compared to the previous moment.
- Visual Distinction: It assigns different colors (Green and Red) to these values. One color represents "upward" momentum, while the other represents "downward" momentum.
- Dynamic Mapping: By separating these into two distinct visual tracks, the tool allows a trader to see exactly when the market's strength shifts from one direction to another, making it easier to spot potential reversals or continuous trends without being overwhelmed by raw numbers.
Summary for the User
In essence, this script filters out the "noise" of the market. It calculates the difference between short-term and long-term price trends and then paints that data as a color-coded histogram. This allows you to quickly see not just which way the price is going, but how strongly it is pushing in that direction, helping you identify high-probability trading entries and exits.
/*-----------------------------+
| |
| Shared by www.Aptrafx.com |
| |
+------------------------------*/
//+------------------------------------------------------------------+
//| Awesome.mq4 |
//| Copyright © 2005, MetaQuotes Software Corp. |
//| http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net/"
//---- indicator settings
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Black
#property indicator_color2 Green
#property indicator_color3 Red
//---- indicator buffers
double ExtBuffer0[];
double ExtBuffer1[];
double ExtBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- drawing settings
SetIndexStyle(0,DRAW_NONE);
SetIndexStyle(1,DRAW_HISTOGRAM);
SetIndexStyle(2,DRAW_HISTOGRAM);
IndicatorDigits(Digits+1);
SetIndexDrawBegin(0,34);
SetIndexDrawBegin(1,34);
SetIndexDrawBegin(2,34);
//---- 3 indicator buffers mapping
SetIndexBuffer(0,ExtBuffer0);
SetIndexBuffer(1,ExtBuffer1);
SetIndexBuffer(2,ExtBuffer2);
//---- 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,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=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;
}
}
//---- done
return(0);
}
Comments