Ultitimate Oscillator
Download scriptThis tool, known as the Ultimate Oscillator, is designed to provide traders with a smoother, consolidated view of price momentum by filtering out immediate market "noise." Instead of reacting to every minor price fluctuation, it synthesizes multiple layers of historical data to identify broader trends.
Core Logic and Functionality
The logic operates through three primary mechanisms:
1. Multi-Layered Smoothing The script calculates the average closing prices of the asset over three distinct time horizons simultaneously: 7 periods, 14 periods, and 28 periods. By using a "Linear Weighted Moving Average," the tool gives more importance to the most recent price actions while still accounting for historical context.
2. Aggregated Momentum Rather than showing you three separate lines, the script merges these three different timeframes into a single, unified indicator value. By adding these averages together, it creates a cumulative momentum reading. This helps traders see whether the overall "weight" of the market is moving upward or downward across short, medium, and long-term perspectives at once.
3. Dynamic Visual Scaling The tool is programmed to focus on a specific window of recent history (defaulting to 300 bars). It intelligently manages the display so that it only renders data when there is sufficient historical information available (minimum of 28 bars). This ensures that the indicator remains stable and doesn't produce erratic lines at the very beginning of a chart.
How it Assists the Trader
By combining these three specific timeframes, the oscillator aims to highlight the underlying strength of a trend. When the line moves upward, it suggests that the weighted momentum across all three time horizons is gaining strength; conversely, a downward move indicates a weakening trend. It serves as a comprehensive "pulse check" for the market's current direction.
//+------------------------------------------------------------------+
//| Ultitimate Oscillator.mq4
//| Ramdass - Conversion only
//+------------------------------------------------------------------+
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Green
extern int CountBars=300;
//---- buffers
double WUO[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
string short_name;
//---- indicator line
IndicatorBuffers(1);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,WUO);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Ultitimate Oscillator |
//+------------------------------------------------------------------+
int start()
{
if (CountBars>=Bars) CountBars=Bars;
SetIndexDrawBegin(0,Bars-CountBars+28+1);
int i,counted_bars=IndicatorCounted();
//----
if(Bars<=28) return(0);
//---- initial zero
if(counted_bars<28)
{
for(i=1;i<=28;i++) WUO[CountBars-i]=0.0;
}
//----
i=CountBars-28-1;
while(i>=0)
{
WUO[i]=(iMA(NULL,0,7,0,MODE_LWMA,MODE_CLOSE,i)+
iMA(NULL,0,14,0,MODE_LWMA,MODE_CLOSE,i)+
iMA(NULL,0,28,0,MODE_LWMA,MODE_CLOSE,i));
i--;
}
return(0);
}
//+------------------------------------------------------------------+
Comments