Ultitimate Oscillator_v2
Download scriptThe Ultimate Oscillator is a specialized technical analysis tool designed to provide a smoothed representation of market momentum by combining multiple layers of price data. Instead of looking at the raw, volatile price of an asset in isolation, this script synthesizes three different perspectives into a single, cohesive visual line.
Core Logic and Methodology
The script operates on the principle of "Multi-Period Averaging." It identifies three distinct timeframes (periods) to analyze the market:
- Short-Term: Captures immediate price fluctuations.
- Medium-Term: Identifies prevailing trends over a slightly broader range.
- Long-Term: Provides a steady view of the overarching market direction.
To calculate the final output, the script applies a specific type of mathematical smoothing—known as a Linear Weighted Moving Average (LWMA)—to each of these three periods independently. By using this specific method, the indicator gives more significance to recent price action while still respecting historical data, helping to filter out "noise" or random market jitters.
How it Generates Data
The tool follows a structured process to display its results:
- Data Synthesis: The script calculates the average price for all three chosen periods simultaneously.
- Aggregation: It adds these three averages together to create a combined value.
- Visual Rendering: This final sum is plotted as a continuous line in a separate window beneath your main chart.
User Experience and Visuals
For the end-user, this means that rather than reacting to every tick of price movement, you are viewing a refined signal. The resulting line represents the collective strength of three different market cycles at once. Because it aggregates several moving averages, it aims to show the cumulative momentum of the asset, making it easier to identify broader trends and potential shifts in sentiment across various time horizons.
//+------------------------------------------------------------------+
//| Ultitimate Oscillator.mq4 |
//| Ramdass - Conversion only |
//+------------------------------------------------------------------+
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Green
//---- input parameters
extern int nMAPeriod1 = 7;
extern int nMAPeriod2 = 14;
extern int nMAPeriod3 = 28;
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);
//---- name for DataWindow and indicator subwindow label
short_name = "UltOsc(" + nMAPeriod1 + ", " + nMAPeriod2 + ", " + nMAPeriod3 + ")";
IndicatorShortName(short_name);
SetIndexLabel(0, short_name);
//----
if(CountBars >= Bars)
CountBars = Bars;
SetIndexDrawBegin(0, Bars - CountBars + 28 + 1);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Ultitimate Oscillator |
//+------------------------------------------------------------------+
int start()
{
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, nMAPeriod1, 0, MODE_LWMA, MODE_CLOSE, i)+
iMA(NULL, 0, nMAPeriod2, 0, MODE_LWMA, MODE_CLOSE, i)+
iMA(NULL, 0, nMAPeriod3, 0, MODE_LWMA, MODE_CLOSE, i));
i--;
}
return(0);
}
//+------------------------------------------------------------------+
Comments