Ind-Widners_Oscilator_FO

Download script
Ind-Widners_Oscilator_FO

The Ind-Widners Oscillator is a technical analysis tool designed to help traders visualize and interpret market momentum by identifying extremes in price movement. Instead of simply looking at raw price data, this script processes historical "highs" and "lows" to create a smoothed representation of market sentiment.

How the Logic Works

1. Identifying Extreme Points The script begins by scanning a specific number of previous candles (defined by the user) to identify the highest and lowest price points reached during that period. It specifically looks for the peaks and troughs, capturing the most significant boundaries of the market's recent range.

2. Calculating Momentum Values Once these extreme points are identified, the script compares them against the current closing price. By calculating the relationship between these historical extremes and the current market value, it generates two distinct oscillation values:

  • One represents the downward pressure or "low-side" momentum.
  • The other represents the upward pressure or "high-side" momentum.

3. Normalization and Smoothing To make the data readable for a human observer, the script performs several mathematical adjustments:

  • Scaling: It converts the raw calculations into a percentage-based format (ranging from 0 to 100).
  • Centering: It shifts the scale so that the values oscillate around a zero baseline. This allows traders to see clearly when momentum is leaning toward the positive or negative side.
  • Moving Averages: The script applies a "Moving Average" to these oscillations. This filters out minor market "noise," resulting in smoother, more reliable lines that highlight the underlying trend.

4. Final Signal Transformation In the final stage of its logic, the script applies an exponential formula to the smoothed averages. This transformation compresses the data into a specific visual format, making it easier for traders to spot significant shifts in momentum at a glance.

Summary for the Trader

Essentially, this tool takes volatile price movements and "distills" them. By identifying the highest highs and lowest lows of recent history and comparing them to where the price is currently sitting, the indicator provides a visual representation of whether the market is overextended or gaining strength in a specific direction.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
10 Views
0 Downloads
0 Favorites
Ind-Widners_Oscilator_FO
//+------------------------------------------------------------------+
//|                                        Ind-Widners Oscilator.mq4 |
//|                    Copyright © 2004, http://www.expert-mt4.nm.ru |
//|                                      http://www.expert-mt4.nm.ru |
//+------------------------------------------------------------------+
//|                                              VininI_RSI_FO_2.mq4 |
//|                                Copyright © 2009, Victor Nicolaev |
//+------------------------------------------------------------------+
//mod2009fxtsd
#property copyright "Copyright © 2004, http://www.expert-mt4.nm.ru"
#property link      "http://www.expert-mt4.nm.ru"
//----
#property indicator_separate_window
//#property indicator_minimum 1
//#property indicator_maximum 100
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue
//----
extern int nPeriod=9;
extern int Limit=350;

extern int  MA_Period =5;
extern int  MA_Method =3;


///---- int Widners Oscilator
int cnt,nCurBar,i;
//---- buffers
double wso[];
double wro[];
double wso1[];
double wro1[];
double MA [];
double MA1[];


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {

    IndicatorBuffers(6);

//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,wso1);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,wro1);
   SetIndexBuffer(2,wso);
   SetIndexBuffer(3,wro);

   SetIndexBuffer(4,MA);
   SetIndexBuffer(5,MA1);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- TODO: add your code here
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
//---- TODO: add your code here
   double r1,r2,r3,r4,r5,r6;
   double s1,s2,s3,s4,s5,s6;
//---- ????? ????????????? ? ?????????
   if(Bars>Limit) Limit=Bars-nPeriod;
   for(nCurBar=Limit; nCurBar>0; nCurBar--)
     {
      if(Low[nCurBar+(nPeriod-1)/2]==Low[Lowest(NULL,0,MODE_LOW,nPeriod,nCurBar)])
        {
         s6=s5; s5=s4; s4=s3; s3=s2; s2=s1; s1=Low[nCurBar+(nPeriod-1)/2];
        }
      if(High[nCurBar+(nPeriod-1)/2]==High[Highest(NULL,0,MODE_HIGH,nPeriod,nCurBar)])
        {
         r6=r5; r5=r4; r4=r3; r3=r2; r2=r1; r1=High[nCurBar+(nPeriod-1)/2];
        }
      //----
      wso[nCurBar]=100*(1-(MathFloor(s1/Close[nCurBar])+
                  MathFloor(s2/Close[nCurBar])+
                  MathFloor(s3/Close[nCurBar])+
                  MathFloor(s4/Close[nCurBar])+
                  MathFloor(s5/Close[nCurBar])+
                  MathFloor(s6/Close[nCurBar]))/6);
      if(wso[nCurBar]==0) wso[nCurBar]=wso[nCurBar]+1;
      if(wso[nCurBar]==100) wso[nCurBar]=wso[nCurBar]-1;
      wro[nCurBar]=100*(1-(MathFloor(r1/Close[nCurBar])+
                  MathFloor(r2/Close[nCurBar])+
                  MathFloor(r3/Close[nCurBar])+
                  MathFloor(r4/Close[nCurBar])+
                  MathFloor(r5/Close[nCurBar])+
                  MathFloor(r6/Close[nCurBar]))/6);
      if(wro[nCurBar]==0) wro[nCurBar]=wro[nCurBar]+1;
      if(wro[nCurBar]==100) wro[nCurBar]=wro[nCurBar]-1;

     }
   for(i = Limit; i >= 0; i--) { wso[i]=wso[i]-50.0;
                                 wro[i]=wro[i]-50.0;
                                }

   for(i = Limit; i >= 0; i--)    MA[i]  =iMAOnArray(wso,0,MA_Period,0,MA_Method,i);
   for(i = Limit; i >= 0; i--)    MA1[i] =iMAOnArray(wro,0,MA_Period,0,MA_Method,i);

   for(i = Limit; i >= 0; i--) {  wso1[i]=(MathExp(2.0*MA[i])-1.0)/(MathExp(2.0*MA[i])+1.0);
                                  wro1[i]=(MathExp(2.0*MA1[i])-1.0)/(MathExp(2.0*MA1[i])+1.0);
                                }

//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments