July 2006
TRADERS' TIPS

Here is this month's selection of Traders' Tips, contributed by various developers of technical analysis software to help readers more easily implement some of the strategies presented in this and other issues.

You can copy these formulas and programs for easy use in your spreadsheet or analysis software. Simply "select" the desired text by highlighting as you would in any word processing program, then use your standard key command for copy or choose "copy" from the browser menu. The copied text can then be "pasted" into any open spreadsheet or other software by selecting an insertion point and executing a paste command. By toggling back and forth between an application window and the open Web page, data can be transferred with ease.

This month's tips include formulas and programs for:

TRADESTATION: Wilson Relative Price Channel
METASTOCK: Wilson Relative Price Channel
eSIGNAL: Wilson Relative Price Channel
AIQ: Wilson Relative Price Channel
WEALTH-LAB: Wilson Relative Price Channel
AMIBROKER: Wilson Relative Price Channel
NEUROSHELL TRADER: Wilson Relative Price Channel
NEOTICKER: Wilson Relative Price Channel
TRADING SOLUTIONS: Wilson Relative Price Channel
ASPEN GRAPHICS: Wilson Relative Price Channel
TRADECISION: Wilson Relative Price Channel
VT TRADER: Wilson Relative Price Channel
TRADE NAVIGATOR/TRADESENSE: Wilson Relative Price Channel
 

or return to July 2006 Contents



TRADESTATION: Wilson Relative Price Channel

Leon Wilson's article "The Wilson Relative Price Channel" transforms J. Welles Wilder's relative strength index (RSI) into a set of price channels. Wilson's formulas are presented here as two EasyLanguage indicators. "Wilson RelPriceChan" displays Wilson's relative price channels. "RSI Bands" displays the Wilson channels in terms of traditional RSI values.

FIGURE 1: TRADESTATION, WILSON RELATIVE PRICE BANDS AND RSI BANDS. The first subgraph displays PepsiAmericas' price history, along with the Wilson relative price channels. The second subgraph displays RSI bands. These bands use the same range definitions and RSI calculations as the Wilson relative price channels.
To download the TradeStation code for this article, search for the file "Wilson.eld" in the TradeStation and EasyLanguage support area of the Support Center at https://www.TradeStation.com.
 
Indicator:  Wilson RelPriceChan
inputs:
 Length( 34 ),
 Smoothing( 1 ), { XAvg length.  If 1 then no
  smoothing }
 OverBought( 70 ),
 OverSold( 30 ),
 UpperNeutralZn( 55 ),
 LowerNeutralZn( 45 ) ;
variables:
 RSIValue( 0 ),
 OB( 0 ),
 OS( 0 ),
 NZU( 0 ),
 NZL( 0 ),
 OBLevel( 0 ),
 NZULevel( 0 ),
 NZLLevel( 0 ),
 OSLevel( 0 ) ;
RSIValue = RSI( Close, Length ) ;
OB = XAverage( RSIValue - OverBought, Smoothing ) ;
OS = XAverage( RSIValue - OverSold, Smoothing ) ;
NZU = XAverage( RSIValue - UpperNeutralZn, Smoothing ) ;
NZL = XAverage( RSIValue - LowerNeutralZn, Smoothing ) ;
OBLevel = Close - ( Close * ( OB / 100 ) ) ;
NZULevel = Close - ( Close * ( NZU / 100 ) ) ;
NZLLevel = Close - ( Close * ( NZL / 100 ) ) ;
OSLevel = Close - ( Close * ( OS / 100 ) ) ;
Plot1( High, "High" ) ; { plot in "bar high" style }
Plot2( Low, "Low" ) ;  { plot in "bar low" style }
Plot3( Open, "Open" ) ; { plot in "left tic" style }
Plot4( Close, "Close" ); { plot in "right tic" style }
Plot5( OBLevel, "OB Level" ) ; { plot in "bar high" style }
Plot6( NZULevel, "NZU Level" ) ; { plot in "bar low" style }
Plot7( NZLLevel, "NZL Level" ) ; { plot in "left tic"  style }
Plot8( OSLevel, "OS Level" ) ; { plot in "right tic" style }
Indicator:  RSI Bands
inputs:
 Price( Close ),
 Length( 14 ),
 OverBought( 70 ),
 UpperNeutralZn( 55 ),
 LowerNeutralZn( 45 ),
 OverSold( 30 ),
 OverBColor( Red ),
 OverSColor( Cyan ) ;
variables:
 RSIValue( 0 ) ;
RSIValue = RSI( Price, Length ) ;
{ Color criteria }
if RSIValue > OverBought then
 SetPlotColor( 1, OverBColor )
else if RSIValue < OverSold then
 SetPlotColor( 1, OverSColor ) ;
 
Plot1( RSIValue, "RSI" ) ; { plot in "line" style }
Plot2( OverBought, "OverBot" ) ; { plot in "bar high" style }
Plot3( UpperNeutralZn, "UNZ" ) ; { plot in "bar low" style }
Plot4( LowerNeutralZn, "LNZ" ) ; { plot in "bar high" style }
Plot5( OverSold, "OverSld" ) ; { plot in "bar low" style }
 
--Mark Mills
TradeStation Securities, Inc.
A subsidiary of TradeStation Group, Inc.
www.TradeStationWorld.com


GO BACK


METASTOCK: Wilson Relative Price Channel

[Editor's note: Article author Leon Wilson includes his version of MetaStock code for his strategy in his article in this issue.]

Leon Wilson's article, "The Wilson Relative Price Channel," introduces a new way to show overbought and oversold conditions. The procedure and formula for displaying these channel lines in MetaStock are given here.

To enter these indicators into MetaStock:

1. In the Tools menu, select Indicator Builder.
2. Click New to open the Indicator Editor for a new indicator.
3. Type the name of the formula
4. Click in the larger window and type in the formula.
5. Click OK to close the Indicator Editor.
Name:  Wilson Relative Price Channel
Formula:
Periods:=Input("Channel Periods",1, 250, 34);
Smoothing:=Input("Smoothing", 1, 55, 1);
Value2:=Input("Over Bought", 50, 99, 70);
Value3:=Input("Over Sold", 1, 50, 30);
Value4:=Input("Upper Neutral Zone", 50, 99, 55);
Value5:=Input("Lower Neutral Zone", 1, 50, 45);
OB:=Mov(RSI(Periods)-Value2,Smoothing,E);
OS:=Mov(RSI(Periods)-Value3,Smoothing,E);
NZU:=Mov(RSI(Periods)-Value4,Smoothing,E);
NZL:=Mov(RSI(Periods)-Value5,Smoothing,E);
{OverSold}
CLOSE-(CLOSE*(OS/100));
{OverBought}
CLOSE-(CLOSE*(OB/100));
{NeutUp}
CLOSE-(CLOSE*(NZU/100));
{NeutLower}
CLOSE-(CLOSE*(NZL/100));
--William Golson
Equis International
www.MetaStock.com


GO BACK


eSIGNAL: Wilson Relative Price Channel

For this month's article by Leon Wilson, "The Wilson Relative Price Channel," we've provided an eSignal formula script named "Wilson_Rpc.efs."

The study has formula parameters that may be configured through the Edit Studies option in the Advanced Chart. The study parameters include the number of periods for the channel and smoothing of the channel, as well as the cord values for overbought, oversold, upper neutral zone, and lower neutral zone. A sample chart is shown in Figure 2.
 


FIGURE 2: eSIGNAL, WILSON RELATIVE PRICE CHANNEL. Here is a demonstration of the Wilson relative price channel in eSignal.


To discuss this study or download a complete copy of the formula, please visit the EFS Library Discussion Board forum under the Bulletin Boards link at https://www.esignalcentral.com. The eSignal formula scripts (EFS) are also available for copying and pasting from here (below).
 

/***************************************
Provided By : eSignal (c) Copyright 2006
Description:  The Wilson Relative Price Channel
              by Leon Wilson
Version 1.0  05/05/2006
Notes:
* July 2006 issue of Stocks &Commodities Magazine
* Study requires version 7.9.1 or higher.
Formula Parameters:              Defaults:
Channel Periods                     34
Smoothing Periods                 1
Over Bought                            70
Over Sold                                 30
Upper Neutral Zone                 55
Lower Neutral Zone                  45
***************************************/
function preMain() {
    setPriceStudy(true);
    setStudyTitle("The Wilson Relative Price Channel ");
    setCursorLabelName("Over Bought", 0);
    setCursorLabelName("Neutral Upper", 1);
    setCursorLabelName("Neutral Lower", 2);
    setCursorLabelName("Over Sold", 3);
    setShowTitleParameters(false);
    setDefaultBarFgColor(Color.black, 0);
    setDefaultBarFgColor(Color.black, 1);
    setDefaultBarFgColor(Color.black, 2);
    setDefaultBarFgColor(Color.black, 3);
    setPlotType(PLOTTYPE_SQUAREWAVE, 0);
    setPlotType(PLOTTYPE_SQUAREWAVE, 1);
    setPlotType(PLOTTYPE_SQUAREWAVE, 2);
    setPlotType(PLOTTYPE_SQUAREWAVE, 3);
    var fp1 = new FunctionParameter("nPeriods", FunctionParameter.NUMBER);
        fp1.setName("Channel Periods");
        fp1.setLowerLimit(1);
        fp1.setUpperLimit(250);
        fp1.setDefault(34);
    var fp2 = new FunctionParameter("nSmoothing", FunctionParameter.NUMBER);
        fp2.setName("Smoothing Periods");
        fp2.setLowerLimit(1);
        fp2.setUpperLimit(55);
        fp2.setDefault(1);
    var fp3 = new FunctionParameter("nOB", FunctionParameter.NUMBER);
        fp3.setName("Over Bought");
        fp3.setLowerLimit(50);
        fp3.setUpperLimit(99);
        fp3.setDefault(70);
    var fp4 = new FunctionParameter("nOS", FunctionParameter.NUMBER);
        fp4.setName("Over Sold");
        fp4.setLowerLimit(1);
        fp4.setUpperLimit(50);
        fp4.setDefault(30);
    var fp5 = new FunctionParameter("nUpperNZ", FunctionParameter.NUMBER);
        fp5.setName("Upper Neutral Zone");
        fp5.setLowerLimit(50);
        fp5.setUpperLimit(99);
        fp5.setDefault(55);
    var fp6 = new FunctionParameter("nLowerNZ", FunctionParameter.NUMBER);
        fp6.setName("Lower Neutral Zone");
        fp6.setLowerLimit(1);
        fp6.setUpperLimit(50);
        fp6.setDefault(45);
}
var bVersion = null;
var bInit = false;
var xRPC = null;
function main(nPeriods, nSmoothing, nOB, nOS, nUpperNZ, nLowerNZ) {
    if (bVersion == null) bVersion = verify();
    if (bVersion == false) return;
    if (bInit == false) {
        xRPC = efsInternal("calcRPC", nPeriods, nSmoothing, nOB, nOS, nUpperNZ, nLowerNZ);
        bInit = true;
    }
    var nRPC_OB = getSeries(xRPC, 0);  // Over Bought
    var nRPC_UN = getSeries(xRPC, 1);  // Upper Neutral
    var nRPC_LN = getSeries(xRPC, 2);  // Lower Neutral
    var nRPC_OS = getSeries(xRPC, 3);  // Over Sold
    setBarBgColor(Color.lightgrey, 0, nRPC_UN, nRPC_OB);
    setBarBgColor(Color.grey, 2, nRPC_LN, nRPC_OS);
    return new Array(nRPC_OB, nRPC_UN, nRPC_LN, nRPC_OS);
}
function calcRPC(nPeriods, nSmoothing, nOB, nOS, nUpperNZ, nLowerNZ) {
    var nC = close(0);
    var OB = ema(nSmoothing, efsInternal("calcCord", nPeriods, nOB),      0);
    var UN = ema(nSmoothing, efsInternal("calcCord", nPeriods, nUpperNZ), 0);
    var LN = ema(nSmoothing, efsInternal("calcCord", nPeriods, nLowerNZ), 0);
    var OS = ema(nSmoothing, efsInternal("calcCord", nPeriods, nOS),      0);
    OB = nC - (nC * (OB/100));
    UN = nC - (nC * (UN/100));
    LN = nC - (nC * (LN/100));
    OS = nC - (nC * (OS/100));
    return new Array(OB, UN, LN, OS);
}
function calcCord(nPeriods, nCord) {
    return (rsi(nPeriods, 0) - nCord);
}
function verify() {
    var b = false;
    if (getBuildNumber() < 730) {
        drawTextAbsolute(5, 35, "This study requires version 7.9.1 or later.",
            Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
            null, 13, "error");
        drawTextAbsolute(5, 20, "Click HERE to upgrade.@URL=https://www.esignal.com/download/default.asp",
            Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
            null, 13, "upgrade");
        return b;
    } else {
        b = true;
    }
    return b;
}
--Jason Keck
eSignal, a division of Interactive Data Corp.
800 815-8256, www.esignalcentral.com
GO BACK
 


AIQ: Wilson Relative Price Channel

Here's the AIQ code for Leon Wilson's Wilson relative price (WRP) channel indicators.

Since AIQ is very well suited for backtesting portfolios of stocks, I devised two trading systems using the channel indicators. The author used the weekly mode in his example, so I decided to create a weekly trading system. All tests were run in the weekly mode. The first system labeled "LE" (see code below) uses only the WRP indicators:

Enter a long position on rule "LE" if
The close crosses up from below the neutral lower band

Exit a long position on rule "LX" if
1. The close crosses down from above the overbought band or
2. The close crosses down from above the upper neutral band or
3. The close is below the lower neutral band for two weeks in a row.

I then tested this over a generally bullish period from 2/28/2003 to 5/08/2006 using the S&P 500 stocks combined with the NASDAQ 100 stocks. I used the author's parameters and I did not attempt to do any optimization. The "LE" entry with "LX" exit system outperformed the SPX over the same period. The results show an 18.3% average annual return with a maximum drawdown of 9.8% and a Sharpe ratio of 0.93.

Since this is a trend-following system, I wanted to see if adding a trend filter would improve the results. I wanted to get in on potential new trends early so as to be able to follow the trend for a longer period of time. To do this, I added an ADX filter that requires the 14-week ADX to have been below 15 within the past 10 days before the crossover signal. The entry rule "LE1" is the entry rule from "LE" above plus the ADX trend filter. The addition of the filter improved the results. The equity curve and summary metrics are shown in Figure 3. The average annual return increased to 20.3% with a maximum drawdown of 8.9% and a Sharpe ratio of 1.31. The ADX filter improved the results and the WRPC indicators appear to have merit for trend-following systems.

FIGURE 3: AIQ SYSTEMS, WILSON RELATIVE PRICE CHANNEL. Here are some sample test results for a weekly trend-following system using the WRPC indicators.


This AIQ code for the WRPC indicators can be downloaded from the AIQ website at https://www.aiqsystems.com/S&C1.htm.
 

!! WILSON RELATIVE PRICE CHANNEL (WRP Channel)
!! Author: Leon Wilson, TASC July 2006
!  Coded by: Richard Denning 05/09/2006
! DEFINE PARAMETERS
Define P1 34. ! RSI periods
Define S1 1. ! Smoothing
Define V2 70. ! Upper RSI value
Define V3 30. ! Lower RSI value
Define V4 55. ! Upper RSI neutral value
Define V5 45. ! Lower RSI neutral value
! WILDER RSI INDICATOR
C is [close].
C1 is val([close],1).
U  is C - C1.
D  is C1 - C.
L1 is 2 * P1 - 1.
AvgU  is ExpAvg(iff(U>0,U,0),L1).
AvgD  is ExpAvg(iff(D>=0,D,0),L1).
RSIw is 100-(100/(1+(AvgU/AvgD))).
! AIQ RSI INDICATOR (WRP Channel uses RSIe)
AvgUe  is ExpAvg(iff(U>0,U,0),P1).
AvgDe  is ExpAvg(iff(D>=0,D,0),P1).
RSIe is 100-(100/(1+(AvgUe/AvgDe))).
! SET RSI TYPE
RSI is RSIe.
! WRP CHANNEL
OB  is expavg(RSI - V2,S1).
OS  is expavg(RSI - V3,S1).
NZU  is expavg(RSI - V4,S1).
NZL is expavg(RSI - V5,S1).
OverS is C - (C * (OS/100)).
OverB  is C - (C * (OB/100)).
NeutU is C - (C * (NZU/100)).
NeutL is C - (C * (NZL/100)).
! TRADING SYSTEM USING WRP CHANNELS
LE if C > NeutL and valrule(C < NeutL,1).
LE1 if  C > NeutL and valrule(C < NeutL,1)
 and countof([ADX]<15,10)>=1.
LX if (C < OverB and valrule(C > OverB,1))
 or (C < NeutU and valrule(C > NeutU,1))
 or countof(C < NeutL,2).
 
--Richard Denning
AIQ Systems
richard.denning@earthlink.net
GO BACK


WEALTH-LAB: Wilson Relative Price Channel

When you need to create a custom series/indicator in WealthScript, you always have two options. The first is to create an "empty series" and use an equation in a familiar-looking form like A := N -( N * ( X - Y ) / 100 ), which you use to assign the values to the empty series in a bar-by-bar fashion in a for/do loop. In the WealthScript code presented, the function WilsonRSIChannelSeries uses the second method to quickly perform the "series math" required by simple arithmetic equations. In this case, WealthScript Series functions (for example, MultiplySeries and SubtractSeries) operate on all of the elements of the series passed as parameters and return a new series as a result. The result series are handed to the next operation until obtaining the final result, whose reference is saved and ultimately plotted (Figure 4).
 


FIGURE 4: WEALTH-LAB, WILSON RELATIVE PRICE CHANNEL. Here is a sample weekly chart of PepsiAmericas (PAS) with the bullish and bearish Wilson RSI relative price channels.
WealthScript code:
{$I 'Plot Series Fill'}
const RSIPer = 21;
const EMAPer = 1;  // Increase for smoother channels (adds delay)
const LTGRAY = 888;
const BLGRAY = 778;
var hOB, hOS, hNZU, hNZL, RSIPane: integer;
function WilsonRSIChannelSeries( Series, RSIPeriod, SmoothPeriod: integer; Cord: float ): integer;
begin
  Result := RSISeries( Series, RSIPeriod );
  Result := SubtractSeriesValue( Result, Cord );
  Result := DivideSeriesValue( Result, 100 );
  Result := MultiplySeries( Series, Result );
  Result := SubtractSeries( Series, Result );
  Result := EMASeries( Result, SmoothPeriod );
end;
hOB  := WilsonRSIChannelSeries( #Close, RSIPer, EMAPer, 70 );
hNZU := WilsonRSIChannelSeries( #Close, RSIPer, EMAPer, 55 );
hNZL := WilsonRSIChannelSeries( #Close, RSIPer, EMAPer, 45 );
hOS  := WilsonRSIChannelSeries( #Close, RSIPer, EMAPer, 30 );
RSIPane := CreatePane( 100, false, true );
PlotSeriesLabel(RSISeries(#Close,RSIPer),RSIPane,#Blue,#Thin,'RSI(Close,'+IntToStr(RSIPer)+')');
SetPaneMinMax( RSIPane, 30, 80 );
DrawRectangle( 0, 30, BarCount - 1, 45, RSIPane, BLGRAY, #Thin, BLGRAY, true );
DrawRectangle( 0, 70, BarCount - 1, 55, RSIPane, LTGRAY, #Thin, LTGRAY, true );
PlotSeriesFill( hOB, hNZU, LTGRAY, #Gray, #Dotted, true );
PlotSeriesFill( hNZL, hOS, BLGRAY, #Blue, #Dotted, true );
HideVolume;


-- Robert Sucher
www.wealth-lab.com


GO BACK


AMIBROKER: Wilson Relative Price Channel

In "The Wilson Relative Price Channel," Leon Wilson presents a new application of the classic RSI. The coding for the relative price channel chart in AmiBroker Formula Language (AFL) is straightforward. Ready-to-use code for AmiBroker is presented here. To apply the formula, open Formula Editor, paste in the code, and press the "Apply Indicator" button. A sample chart can be found in Figure 5.

FIGURE 5: AMIBROKER, WILSON RELATIVE PRICE CHANNEL. This AmiBroker screenshot shows a weekly price chart of PAS (PepsiAmericas) with the Wilson relative price channel bullish band (gray) and bearish band (blue), reproducing the chart that Leon Wilson presented in his article.
Version(4.80); // requires version 4.80
Periods = Param("Channel Periods", 34, 1, 250 );
Smooth = Param("Smoothing", 1, 1, 55 );
Value2 = Param("Over Bought", 70, 50, 99 );
Value3 = Param("Over Sold", 30, 1, 50 );
Value4 = Param("Upper Neutral Zone", 55, 50, 99 );
Value5 = Param("Lower Neutral Zone", 45, 1, 50 );
r = RSI( Periods );
OB = EMA( r - Value2, Smooth );
OS = EMA( r - Value3, Smooth );
NzU = EMA( r - Value4, Smooth );
NzL = EMA( r - Value5, Smooth );
Ch1 = Close - Close * OB / 100;
Ch2 = Close - Close * NzU / 100;
Ch3 = Close - Close * NzL / 100;
Ch4 = Close - Close * OS / 100;
Plot( C, "Price", IIf( Close > Open, colorGreen, colorRed ), styleBar | styleThick );
Plot( Ch1, "", colorLightGrey );
Plot( Ch2, "", colorLightGrey, styleNoLabel | styleNoTitle );
PlotOHLC( Ch1, Ch1, Ch2, Ch2, "Upper Channel ", ColorRGB( 230, 230, 230), styleCloud );
Plot( Ch3, "", colorLightBlue );
Plot( Ch4, "", colorLightBlue, styleNoLabel | styleNoTitle );
PlotOHLC( Ch3, Ch3, Ch4, Ch4, "Lower Channel ", ColorRGB( 210, 210, 255), styleCloud );
Title = "{{NAME}} - {{INTERVAL}} {{DATE}} - {{VALUES}}";
--Tomasz Janeczko, AmiBroker.com
www.amibroker.com
GO BACK


NEUROSHELL TRADER: Wilson Relative Price Channel

The Wilson relative price channels described by Leon Wilson in his article in this issue can be easily implemented in NeuroShell Trader by combining a few of NeuroShell Trader's over 800 indicators. To implement each different channel, select "New Indicator …" from the Insert menu and use the Indicator Wizard to create the following indicator:
 

Subtract (Close,Divide(Multiply2(Close,ExpAvg(Subtract(RSI(Close,34),VALUE),1)),100))


Note that Value is set to 70 for the overbought channel, 30 for the oversold channel, 55 for the neutral upper channel, and 45 for the neutral lower channel. The default RSI period of 34 and the default exponential average period of 1 may also be changed as desired. See Figure 6.

FIGURE 6: NeuroShell, WILSON RELATIVE PRICE CHANNELS. This NeuroShell Trader chart displays the Wilson relative price channels.
--Marge Sherald, Ward Systems Group, Inc.
301 662-7950, sales@wardsystems.com
www.neuroshell.com


GO BACK



 

NEOTICKER: Wilson Relative Price Channel

NeoTicker requires three separate indicators to implement the idea presented in the article "The Wilson Relative Price Channel" by Leon Wilson. The reason why three indicators are needed is because the color regions for this indicator's plotting style requires two plots in NeoTicker, and this plotting style can only be drawn one indicator at a time.

The first NeoTicker indicator, TASC Wilson Relative Price Channel Upper Channel (Listing 1), plots the upper channel region. It has integer parameter RSI period, integer parameter smoothing, real parameter overbought, and real parameter upper neutral zone. The second indicator, TASC Wilson Relative Price Channel Neutral Zone (Listing 2), plots the middle channel region. It has indicator parameter RSI period, integer parameter smoothing, real parameter upper neutral zone and real parameter lower neutral zone. The third indicator, the TASC Wilson Relative Price Channel Lower Channel (Listing 3), plots the lower channel region. It has integer parameter RSI period, integer parameter smoothing, real parameter oversold, and real parameter lower neutral zone.

The code uses built-in functions if/and/choose to check for and replace parameter entries that exceed the upper and lower parameter range. For example, at the first line, the code checks the Rsi period parameter entry; if the entry exceeds 250, 250 is used instead of the user entry value. The calculation portion of the code uses internal indicators xaverage and rsindex to get band values.

When you apply all three indicators to a NeoTicker chart (Figure 7), it will look similar to the channel indicator shown in Wilson's article.

FIGURE 7: NEOTICKER, WILSON RELATIVE PRICE CHANNELS. Here is a sample chart of the Wilson relative price channels using NeoTicker.
Downloadable versions of the indicators will be available from the NeoTicker blog site.
 
LISTING 1
$period := if(param1>250, 250, param1); 'RSI period
$smoothing := if(param2>55, 55, param2); 'Smoothing
$value2 := choose(param3<50, 50, param3>99, 99, param3); 'Over Brought
$value4 := choose(param4<50, 50, param4>99, 99, param4); 'Upper Neutral Zone
$OB  := xaverage((rsindex(close, $period)-$value2), $smoothing);
$NZU := xaverage((rsindex(close, $period)-$value4), $smoothing);
plot1 := close-(close*($OB/100));
plot2 := close-(close*($NZU/100));
LISTING 2
$period := if(param1>250, 250, param1); 'RSI periods
$smoothing := if(param2>55, 55, param2);
$value4 := choose(param3>99, 99, param3<50, 50, param3);
$value5 := choose(param4>50, 50, param4<1, 1, param4);
$NZU := xaverage((rsindex(close, $period)-$value4), $smoothing);
$NZL := xaverage((rsindex(close, $period)-$value5), $smoothing);
plot1 := close-(close*($NZU/100));
plot2 := close-(close*($NZL/100));
LISTING 3
$period := if(param1>250, 250, param1);
$smoothing := if(param2>55, 55, param2);
$value3 := choose(param3>50, 50, param3<1, 1, param3);
$value5 := choose(param4>50, 50, param4<1, 1, param4);
$OS  := xaverage((rsindex(data1, $period)-$value3), $smoothing);
$NZL := xaverage((rsindex(data1, $period)-$value5), $smoothing);
plot1 := data1-(data1*($NZL/100));
plot2 := data1-(data1*($OS/100));
--Kenneth Yuen, TickQuest Inc.
www.tickquest.com
GO BACK


TRADING SOLUTIONS: Wilson Relative Price Channel

In "The Wilson Relative Price Channel," Leon Wilson introduces an adaptation of the relative strength index. All of the price channel bounds are based on the same formula, so it is easiest to implement that formula as a standalone function and use that for all of the other values.

These functions can be entered into TradingSolutions using the code given here. These functions are available as a function file that can be downloaded from the TradingSolutions website in the Solution Library section.
 

Function Name: Wilson Relative Price Channel - General Formula
Short Name: WRPC_Gen
Inputs: Close, Channel Periods, Smoothing, Channel Value
Sub (Close, Mult (Close, Div (EMA (Sub (RSI (Close, Channel Periods), Channel Value), Smoothing), 100)))
Function Name: Wilson Relative Price Channel - Overbought
Short Name: WRPC_OB
Inputs: Close, Channel Periods, Smoothing, Overbought
WRPC_Gen (Close, Channel Periods, Smoothing, Overbought)
Function Name: Wilson Relative Price Channel - Oversold
Short Name: WRPC_OS
Inputs: Close, Channel Periods, Smoothing, Oversold
WRPC_Gen (Close, Channel Periods, Smoothing, Oversold)
Function Name: Wilson Relative Price Channel - Upper Neutral Zone
Short Name: WRPC_NZU
Inputs: Close, Channel Periods, Smoothing, Upper Neutral Zone
WRPC_Gen (Close, Channel Periods, Smoothing, Upper Neutral Zone)
Function Name: Wilson Relative Price Channel - Lower Neutral Zone
Short Name: WRPC_NZL
Inputs: Close, Channel Periods, Smoothing, Lower Neutral Zone
WRPC_Gen (Close, Channel Periods, Smoothing, Lower Neutral Zone)
These individual formulas can be used to create fields that can be displayed in a chart with the closing price. They can also be used as optimizable inputs to a neural network or as optimizable elements of entry/exit system rules.
 
--Gary Geniesse, NeuroDimension, Inc.
800 634-3327, 352 377-5144
www.tradingsolutions.com
GO BACK



 

ASPEN GRAPHICS: Wilson Relative Price Channel

You can use the following four formulas to recreate in Aspen Graphics the bands for the Wilson relative price channel, one formula for each band:
 

BullUpper (input, cord=73)=savg($1.close-($1.close*((rsi($1.close,14)-cord)/100)),2)
BullLower (input, cord=53)=savg($1.close-($1.close*((rsi($1.close,14)-cord)/100)),2)
BearUpper (input, cord=37)=savg($1.close-($1.close*((rsi($1.close,14)-cord)/100)),2)
BearLower (input, cord=20)=savg($1.close-($1.close*((rsi($1.close,14)-cord)/100)),2)
Enter each formula into its own Formula Editor in the Aspen Graphics Formula Manager. Suggestion: Create a new folder named "Wilson Relative Price Channel" in the Formula Manager and save the formulas there. This makes it easy to locate the formulas and apply them as overlays to your Aspen Graphics charts.

These formulas are written with "cord" as a declared variable. This gives users more flexibility and control over each band. After the band has been applied to a chart, a user can modify the cord value through the band's parameters.

Please contact an Aspen Graphics Support Technician (support@aspenres.com or 970 945-2921) if you have any questions on these formulas.
 

--Ken Woods
Aspen Research Group, Ltd.
970 945-2921, www.aspenres.com


GO BACK


TRADECISION: Wilson Relative Price Channel

In "The Wilson Relative Price Channels," author Leon Wilson illustrates how to quantify the relationship between price action and strength. Based on his observation and the indicator created, we can build a trading strategy using Tradecision's Strategy Builder.
 

Entry Long
var
   Len := 30;
   OverB := 55;
   OverS := 45;
   RsiVal := RSI (Close, Len);
   OB := RsiVal - OverB;
   OS := RsiVal - OverS;
end_var
{avoiding wrong signals}
if HistorySize < Len * 2 then return false;
{generating a signal}
if CrossBelow (Close, Close - Close * OB / 100) then return true;
return false;
Exit Long
var
   Len := 30;
   OverB := 55;
   OverS := 45;
   RsiVal := RSI (Close, Len);
   OB := RsiVal - OverB;
   OS := RsiVal - OverS;
end_var
{avoiding wrong signals}
if HistorySize < Len * 2 then return false;
{generating a signal}
if CrossAbove (Close, Close - Close * OB / 100) then return true;
return false;
Entry Short
var
   Len := 30;
   OverB := 55;
   OverS := 45;
   RsiVal := RSI (Close, Len);
   OB := RsiVal - OverB;
   OS := RsiVal - OverS;
end_var
{avoiding wrong signals}
if HistorySize < Len * 2 then return false;
{generating a signal}
if CrossAbove (Close, Close - Close * OS / 100) then return true;
return false;
Exit Short
var
   Len := 30;
   OverB := 55;
   OverS := 45;
   RsiVal := RSI (Close, Len);
   OB := RsiVal - OverB;
   OS := RsiVal - OverS;
end_var
{avoiding wrong signals}
if HistorySize < Len * 2 then return false;
{generating a signal}
if CrossBelow (Close, Close - Close * OS / 100) then return true;
return false;
After the strategy is coded, launch Simulation Manager and select the symbols on which you want to run a simulation (Figure 8).
 


FIGURE 8: TRADECISION, WILSON RELATIVE PRICE CHANNEL. You can run a simulation on the Wilson RPC strategy using the Tradecision Simulation Manager.


To improve your strategy performance, you can manually change the values of the variables in the code, that is, Len := 30; OverB := 55; OverS := 45 or; in order to find the best parameters for the strategy rules, you can replace the 30, 55, 45 values with optimization character # and then run the Strategy Optimization wizard.

To download the above strategy, visit Tradecision's Knowledge Base at https://tradecision.com/support/knowledgebase.htm.

 
--Alex Grechanowski, Alyuda Research, Inc.
alex@alyuda.com, 347 416-6083
www.alyuda.com, www.tradecision.com
GO BACK


VT TRADER: Wilson Relative Price Channel

Leon Wilson's article in this issue, "The Wilson Relative Price Channel," discusses the benefits of allowing range-bound indexes, particularly the relative strength index (RSI), to adapt to price action by assuming a monetary value similar to a moving average. The relative price channel is Wilson's adaptation of the RSI to price action.
 


FIGURE 9: VT TRADER, WILSON RELATIVE PRICE CHANNEL. This screenshot displays a GBP/USD weekly chart with the bullish channel highlighted in light blue, the bearish channel in light red, and the neutral channel in white.
We'll be offering the Wilson relative price channel indicator for download in our user forums. The VT Trader code and instructions for creating this indicator are as follows (each input variable has been parameterized to allow customization):
 
1. Navigator Window>Tools>Indicator Builder>[New] button
2. In the Indicator Bookmark, type the following text for each field:
Name: Wilson Relative Price Channel
Short Name: vt_WilsonRPC
Label Mask: Wilson Relative Price Channel (RSI: %prcRSI%, %perRSI%, OB: %OBL%, OS: %OSL%,
            NZ: %NZU%-%NZL%, Smoothing: %Smoothing%, %SmoothingType%)
Placement: Price Frame
Inspect Alias: Wilson Relative Price Channel
3. In the Input Bookmark, create the following variables:
[New] button... Name: prcRSI , Display Name: Channel Price , Type: price , Default: Close
[New] button... Name: perRSI , Display Name: Channel Periods , Type: integer , Default: 34
[New] button... Name: Smoothing , Display Name: Smoothing Periods , Type: integer , Default: 1
[New] button... Name: SmoothingType , Display Name: Smoothing Type , Type: MA Type , Default: Exponential
[New] button... Name: OBL , Display Name: OverBought Level , Type: integer , Default: 70
[New] button... Name: OSL , Display Name: OverSold Level , Type: integer , Default: 30
[New] button... Name: NZU , Display Name: Upper Neutral Zone , Type: integer , Default: 55
[New] button... Name: NZL , Display Name: Lower Neutral Zone , Type: integer , Default: 45
4. In the Output Bookmark, create the following variables:
[New] button...
Var Name: OverBought
Name: OverBought
Line Color: blue
Line Width: thin line
Line Type: dashed line
[New] button...
Var Name: NeutUp
Name: NeutUp
Line Color: blue
Line Width: thin line
Line Type: dashed line
[New] button...
Var Name: NeutLower
Name: NeutLower
Line Color: red
Line Width: thin line
Line Type: dashed line
[New] button...
Var Name: OverSold
Name: OverSold
Line Color: red
Line Width: thin line
Line Type: dashed line
[New] button...
Var Name: UpperChannel_1
Name: UpperChannel_1
Line Color: very light blue
Line Width: thin line
Line Type: solid line
[New] button...
Var Name: UpperChannel_2
Name: UpperChannel_2
Line Color: very light blue
Line Width: thin line
Line Type: solid line
[New] button...
Var Name: NeutralZone_1
Name: NeutralZone_1
Line Color: white
Line Width: thin line
Line Type: solid line
[New] button...
Var Name: NeutralZone_2
Name: NeutralZone_2
Line Color: white
Line Width: thin line
Line Type: solid line
[New] button...
Var Name: LowerChannel_1
Name: LowerChannel_1
Line Color: very light red
Line Width: thin line
Line Type: solid line
[New] button...
Var Name: LowerChannel_2
Name: LowerChannel_2
Line Color: very light red
Line Width: thin line
Line Type: solid line
5. In the Formula Bookmark, copy and paste the following formula:
{Provided By: Visual Trading Systems, LLC (c) Copyright 2006}
{Description: Wilson Relative Price Channel by Leon Wilson}
{Notes: July 2006 Issue - Evolution Of An Indicator - The Wilson Relative Price Channel}
{Wilson_RPC Version 1.0}
{Create Relative Strength Index}
rsi_r:= (prcRSI - ref(prcRSI,-1));
rsi_rs:= Wilders(if(rsi_r>0,rsi_r,0),perRSI) / Wilders(if(rsi_r<0,Abs(rsi_r),0),perRSI);
_RSI:= 100-(100/(1+rsi_rs));
{Create Cords}
OB:= Mov((_RSI-OBL),Smoothing,SmoothingType);
OS:= Mov((_RSI-OSL),Smoothing,SmoothingType);
UNZ:= Mov((_RSI-NZU),Smoothing,SmoothingType);
LNZ:= Mov((_RSI-NZL),Smoothing,SmoothingType);
OverSold:= prcRSI-(prcRSI*(OS/100));
OverBought:= prcRSI-(prcRSI*(OB/100));
NeutUp:= prcRSI-(prcRSI*(UNZ/100));
NeutLower:= prcRSI-(prcRSI*(LNZ/100));
{Create Relative Price Channels}
UpperChannel_1:= If(OverBought>NeutUp,If(Prev=ref(NeutUp,-1),OverBought,NeutUp),Null);
UpperChannel_2:= If(OverBought>NeutUp,If(Prev=ref(OverBought,-1),NeutUp,OverBought),Null);
NeutralZone_1:= If(NeutUp>NeutLower,If(Prev=ref(NeutLower,-1),NeutUp,NeutLower),Null);
NeutralZone_2:= If(NeutUp>NeutLower,If(Prev=ref(NeutUp,-1),NeutLower,NeutUp),Null);
LowerChannel_1:= If(NeutLower>OverSold,If(Prev=ref(OverSold,-1),NeutLower,OverSold),Null);
LowerChannel_2:= If(NeutLower>OverSold,If(Prev=ref(NeutLower,-1),OverSold,NeutLower),Null);
6. Click the "Save" icon to finish building the Wilson Relative Price Channel indicator.
To attach the Wilson RPC indicator to a chart, click the right mouse button within the chart window and then select "Add Indicators" -> "Wilson Relative Price Channel" from the indicator list. Users will have the ability to customize the parameters at this time. Once the indicator is attached to the chart, clicking the right mouse button over the displayed indicator label and selecting "Properties" allows customization of the parameters.
 
--Chris Skidmore
Visual Trading Systems, Llc (courtesy of Cms Forex)
(866) 51-CMSFX, trading@cmsfx.com
www.cmsfx.com


GO BACK


MULTICHARTS: Wilson Relative Price Channel

Leon Wilson in his article "The Wilson Relative Price Channel" suggests an interesting method of incorporating price action and the relative strength calculation on a single scale. Notwithstanding the fact that the author didn't introduce anything new in the formula for the RSI calculation, the indicator will become much more convenient for visual perception and analysis (Figure 10).
 


 
FIGURE 10: MULTICHARTS, WILSON RELATIVE PRICE CHANNEL. Leon Wilson's implementation of RSI makes the indicator more convenient for visual inspection.


Here is the code for the Wilson relative price channel indicator for MultiCharts. The additional value of Wilson's method is that it can be applied not only to RSI but to any other oscillator as well -- for example, the stochastic oscillator or CCI. All those who want to experiment in this direction or discuss advantages of the described method of representing oscillators over the classical one, we invite to our forum at https://forum.tssupport.com.
 

inputs: Periods(34), Smoothing(1), OverBought(70), OverSold(30), UpperNeutralZone(55),
        LowerNeutralZone(45);
vars: OB(0), OS(0), NZU(0), NZL(0);
OB = xaverage( rsi(close, Periods) - OverBought, Smoothing);
OS = xaverage( rsi(close, Periods) - OverSold, Smoothing);
NZU = xaverage( rsi(close, Periods) - UpperNeutralZone, Smoothing);
NZL = xaverage( rsi(close, Periods) - LowerNeutralZone, Smoothing);
plot1( close - close * (OS / 100), "OverSold" );
plot2( close - close * (OB / 100), "OverBought" );
plot3( close - close * (NZU / 100), "NeutUp");
plot4( close - close * (NZL / 100), "NeutLower");
--Stanley Miller, TS Support, Llc
www.tssupport.com


GO BACK


TRADE NAVIGATOR/TRADESENSE: Wilson Relative Price Channel

In Trade Navigator Gold and Platinum versions, you can create custom functions to display on the chart as indicators.

Many of the functions needed to create the Wilson relative price channel indicator as seen in Leon Wilson's article are already provided for you in Trade Navigator. To recreate the indicator in Trade Navigator, follow these steps:
 

Relative Price Channel
(1) Go to the Trader's Toolbox Functions tab.
(2) Click on the New button.
(3) Type the formula Close - (Close * ((RSI (Close , 7 , False) - cord)) / 100) into the Function
    window. (FIGURE 1)
(4) Click on the Verify button.
(5) An Add Inputs window will pop up saying that cord is unrecognized, Click the Add button and change
    the Default Value to 30.
(6) Click on the Save button, type in Relative Price Channel as the name for the function and then
    click the OK button.
To add your new indicator to your chart:
(1) Click on the chart to be sure that it is the active window.
(2) Type the letter A.
(3) Click on the Indicators tab to add an indicator.
(4) Double click on the name of the indicator or highlight bar you wish to add.


If you desire to change the value to use for the Relative Price Channel cord, simply click on the chart that you have added it to, type the letter E on your keyboard, select the indicator from the list, click the Value field next to cord on the right side of the window and type the new value to use.

For your convenience, Genesis Financial Technologies has created a special file that users can download through Trade Navigator that will add the Wilson relative price channel to Trade Navigator for you. Simply download the free file "scjuly06" from within Trade Navigator and follow the upgrade prompts.
 

--Michael Herman
Genesis Financial Technologies
https://www.GenesisFT.com


GO BACK


Return to July 2006 Contents

Originally published in the July 2006 issue of Technical Analysis of STOCKS & COMMODITIES magazine.
All rights reserved. © Copyright 2006, Technical Analysis, Inc.