Wilson Channels

Download script
Author: Copyright � 2006, Akuma99.
Wilson Channels

This script is a technical analysis tool designed to project specific price levels onto a trading chart based on momentum and volume oscillators. Rather than just showing a standard indicator line in a separate window, this tool calculates "breakdown" values to identify potential price areas of interest directly on the main price graph.

Core Functionality

The script works by taking standard market oscillators—which typically measure the speed and change of price movements—and converting those percentage-based readings into actual currency values. It then applies these values to find specific distance offsets from the current closing price.

Key Features and Logic

  • Multi-Oscillator Versatility: The tool is highly flexible, allowing users to switch between five different primary market indicators depending on their trading style:

    1. RSI (Relative Strength Index): Measures the speed and change of price movements.
    2. Stochastic: Compares a specific closing price to its range over a period of time.
    3. MFI (Money Flow Index): Combines price and volume to see where money is flowing.
    4. deMarker: An oscillator used to identify trend reversals.
    5. Williams %R: Measures the position of the current price relative to its high/low range.
  • Dynamic Price Mapping: The script takes the output of the chosen indicator and "translates" it into a price coordinate. It does this by calculating the percentage difference between the indicator's current reading and predefined thresholds (Overbought and Oversold levels). By subtracting these values from the current market price, the tool identifies specific price targets.

  • Visual Data Representation: The script generates eight different visual elements on the chart:

    • Lines: These provide a continuous visual path for the primary calculated price boundaries.
    • Histograms (Dots): These offer a discrete visual representation of specific data points, helping to highlight where certain thresholds are being breached or reached in real-time.

User Customization

The logic allows for fine-tuning through several adjustable parameters:

  • Period: Determines the look-back window for the calculations (how much historical data is used to influence the current reading).
  • Overbought/Oversold Thresholds: These define the "zones" the script watches. By adjusting these, users can make the tool more or less sensitive to market extremes.

Summary of Operation

In simple terms, this script acts as a bridge between momentum indicators and price action. It looks at how "overstretched" the market is based on your chosen indicator, calculates the mathematical distance of that stretch, and draws that distance as a visible line or dot on your chart, helping traders visualize potential areas of reversal or exhaustion.

Indicators Used
Relative strength indexStochastic oscillatorMoney flow indexDeMarker indicatorLarry William percent range indicator
Miscellaneous
Implements a curve of type %1
21 Views
0 Downloads
0 Favorites
Wilson Channels
//+------------------------------------------------------------------+
//|                                                         RSIP.mq4 |
//|                                       Copyright © 2006, Akuma99. |
//|                                      http://akuma99.blogspot.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Akuma99."
#property link      "http://akuma99.blogspot.com"

#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 Red
#property indicator_color2 Red
#property indicator_color3 Red
#property indicator_color4 Red
#property indicator_color5 Blue
#property indicator_color6 Blue
#property indicator_color7 Blue
#property indicator_color8 Blue

//---- input parameters
extern int          mode=0;
extern double       period=32;
extern double       overboughtStart=55;
extern double       overboughtEnd=75;
extern double       oversoldStart=45;
extern double       oversoldEnd=25;

//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
double ExtMapBuffer7[];
double ExtMapBuffer8[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
  
   IndicatorBuffers(8);
   
//---- indicators
   
   SetIndexStyle(0,DRAW_LINE);//,2,1,indicator_color2);
   SetIndexBuffer(0,ExtMapBuffer1);
   
   SetIndexStyle(1,DRAW_LINE);//,2,1,indicator_color3);
   SetIndexBuffer(1,ExtMapBuffer2);
   
   SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_DOT);//,2,1,indicator_color4);
   SetIndexBuffer(2,ExtMapBuffer3);
   
   SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_DOT);//,2,1,indicator_color5);
   SetIndexBuffer(3,ExtMapBuffer4);
   
   SetIndexStyle(4,DRAW_LINE);//,2,1,indicator_color5);
   SetIndexBuffer(4,ExtMapBuffer5);
   
   SetIndexStyle(5,DRAW_LINE);//,2,1,indicator_color5);
   SetIndexBuffer(5,ExtMapBuffer6);
   
   SetIndexStyle(6,DRAW_HISTOGRAM,STYLE_DOT);//,2,1,indicator_color5);
   SetIndexBuffer(6,ExtMapBuffer7);
   
   SetIndexStyle(7,DRAW_HISTOGRAM,STYLE_DOT);//,2,1,indicator_color5);
   SetIndexBuffer(7,ExtMapBuffer8);
   
   Comment("Wilson channels: available modes: 0=RSI, 1=Stochastic, 2=MFI, 3=deMarker, 4=Williams");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
   int    limit=Bars-counted_bars;
   double n,os1,ob1,os2,ob2;
//----
   for(int i=limit; i>=0; i--) {
      
      n = breakDownToPrice(i,50);
      os1 = breakDownToPrice(i,overboughtEnd);
      os2 = breakDownToPrice(i,overboughtStart);
      ob1 = breakDownToPrice(i,oversoldStart);
      ob2 = breakDownToPrice(i,oversoldEnd);
      
      ExtMapBuffer1[i]=ob2;
      ExtMapBuffer2[i]=ob1;
      ExtMapBuffer3[i]=ob2;
      ExtMapBuffer4[i]=ob1;
      ExtMapBuffer5[i]=os2;
      ExtMapBuffer6[i]=os1;
      ExtMapBuffer7[i]=os2;
      ExtMapBuffer8[i]=os1;
   
   }
   
   
//----
   return(0);
  }
//+------------------------------------------------------------------+

double breakDownToPrice(int cnt, int v) {
   
   double c;
   
   switch (mode) {
   
      case 0: //rsi
         c = iRSI(NULL,0,period,PRICE_CLOSE,cnt+1)-v;
         break;
      case 1: //stochastic
         c = iStochastic(NULL,0,period,3,3,MODE_SMA,0,MODE_MAIN,cnt+1)-v;
         break;
      case 2: //money flow index
         c = iMFI(NULL,0,period,cnt+1)-v;
         break;
      case 3: //demarker
         c = (iDeMarker(NULL,0,period,cnt+1)*100)-v;
         break;
      case 4:
         c = iWPR(NULL,0,period,cnt+1)+v;
         break;
    }
    
   c = c/100;
   c = Close[cnt+1]*c;
   c = Close[cnt+1]-c;
   
   return (c);

}

Comments