Ultimate_Oscillator

Download script
Author: Copyright � 2007, MetaQuotes Software Corp.
Ultimate_Oscillator

This script functions as a specialized technical analysis tool designed to help traders gauge the momentum and sức mạnh (strength) of a financial market's price movements. By analyzing historical price data, it translates complex fluctuations into a simplified visual indicator that helps identify whether a market is overextended or gaining significant steam.

How the Logic Works

The indicator operates through a multi-step calculation process that focuses on "Price Action" rather than just simple averages. Here is the professional breakdown of its internal logic:

1. Identifying Price Strength (Base Calculation) First, the script looks at the relationship between the current price and the previous price's "low." It calculates the distance between these two points to determine how much "room" or pressure there is in the current movement. This provides a raw measurement of market volatility and direction.

2. Multi-Speed Smoothing To prevent the indicator from being too "noisy" (reacting to every tiny, insignificant flicker in price), the script processes this raw data using three different timeframes simultaneously:

  • Fast: Captures quick, immediate shifts.
  • Middle: Identifies the current trend.
  • Slow: Tracks the long-term underlying movement.

3. Volatility Normalization A key feature of this logic is that it doesn't just look at price distance; it adjusts that distance based on how much the market is currently swinging (volatility). By dividing the moving averages by a volatility measurement, the script "normalizes" the data. This ensures that a large price jump in a volatile market isn't treated the same as a small jump in a quiet market.

4. Weighted Synthesis The script then combines these three different timeframes (Fast, Middle, and Slow) into a single score. Each timeframe is given a specific "weight" to ensure that the final result reflects a balanced view of both immediate momentum and long-term stability.

5. Final Percentage Output Finally, all these calculations are scaled into a readable percentage format. This allows traders to view the data on a consistent scale (typically looking for levels like 30 or 70), making it easy to spot when the market might be reaching an extreme point and is potentially due for a reversal or a continuation of the trend.

Summary for the User

In essence, this tool acts as a sophisticated "speedometer" for the market. It filters out the background noise of daily price fluctuations to show you the true momentum, balancing short-term excitement with long-term trends to provide a clearer picture of where the price is headed.

15 Views
0 Downloads
0 Favorites
Ultimate_Oscillator
//+------------------------------------------------------------------+
//|                                          Ultimate Oscillator.mq4 |
//|                      Copyright © 2007, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.ru/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.ru/"
//----
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Blue
#property indicator_level1 30
#property indicator_level2 70
#property indicator_levelcolor Blue
//#property indicator_maximum 100
//#property indicator_minimum 0
//---- input parameters
extern int fastperiod = 7;
extern int middleperiod = 14;
extern int slowperiod = 28;
extern int fastK = 4;
extern int middleK = 2;
extern int slowK = 1;
//---- buffers
double UOBuffer[];
double BPBuffer[];
double divider;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   string name;
   name="UOS(" + fastperiod + ", " + middleperiod + ", " + slowperiod + ")";
   IndicatorBuffers(2);
   SetIndexStyle(0, DRAW_LINE);
   SetIndexBuffer(0, UOBuffer);
   SetIndexDrawBegin(0, slowperiod);
   SetIndexBuffer(1, BPBuffer);
   IndicatorShortName(name);
   IndicatorDigits(1);
   divider = fastK + middleK + slowK;
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars = IndicatorCounted();
//----
   int i, limit, limit2;
   double TL, RawUO;
   if(counted_bars == 0) 
     {
       limit = Bars - 2;
       limit2 = Bars - slowperiod;
     }
   if(counted_bars > 0) 
     {
       limit = Bars - counted_bars;
       limit2 = limit;
     }
   for(i = limit; i >= 0; i--)
     {
       TL = MathMin(Low[i], Close[i+1]);
       BPBuffer[i] = Close[i] - TL;
     }
   for(i = limit2; i >= 0; i--)
     {
       RawUO = fastK*iMAOnArray(BPBuffer, 0, fastperiod, 0, MODE_SMA, i) / 
               iATR(NULL, 0, fastperiod, i) +
               middleK*iMAOnArray(BPBuffer, 0, middleperiod, 0, MODE_SMA, i) /
               iATR(NULL, 0, middleperiod, i) +
               slowK*iMAOnArray(BPBuffer, 0, slowperiod, 0, MODE_SMA, i) / 
               iATR(NULL, 0, slowperiod, i);
       UOBuffer[i] = RawUO / divider*100;
     }     
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments