January 2008
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:

BULLCHARTS: Profit Locking And The Relative Price Channel
METASTOCK: Profit Locking And The Relative Price Channel
TRADESTATION: Profit Locking And The Relative Price Channel
eSIGNAL: Profit Locking And The Relative Price Channel
WEALTH-LAB: Profit Locking And The Relative Price Channel
AMIBROKER: Profit Locking And The Relative Price Channel
NEUROSHELL TRADER: Profit Locking And The Relative Price Channel
AIQ: Profit Locking And The Relative Price Channel
BLOCKS: Profit Locking And The Relative Price Channel
STRATASEARCH: Profit Locking And The Relative Price Channel
STRATEGYDESK: Profit Locking And The Relative Price Channel
NINJATRADER: Profit Locking And The Relative Price Channel
OMNITRADER: Profit Locking And The Relative Price Channel
TRADECISION: Profit Locking And The Relative Price Channel
TRADE NAVIGATOR: Profit Locking And The Relative Price Channel
VT TRADER: Bear Range Trailing Stop
TRACK 'N TRADE: Profit Locking and the Relative Price Channel
 
 

or return to January 2008 Contents


BULLCHARTS: Profit Locking And The Relative Price Channel

Editor's note: Code for BullCharts was already included in a sidebar to Leon Wilson's article in this issue, "Profit Locking And The Relative Price Channel." The code is as follows:

Code for BullCharts: Bear range trailing stop

TDate:=inputdate("Trade Date");
Value1:=Input("Bearish Periods",21,3);
Value2:=Input("Multiplication Factor",3.8,1);
Value4:=Input("Channel Periods",34,1);
Value5:=Input("OverBought Region",70,55);
value6:=Input("Channel Smoothing",1,1);
Value3:=Input("Initial Stop",0,0);

HoldingDays:=BarsSince(OnOrSkipped(TDate));

Index:=RSI(CLOSE,Value4); 
OB:=Ma((Index -Value5),Value6,E);
Bullish:= Close-(Close*(OB/100));

Bearish:=(Sum(Abs(LOW-Ref(LOW,-1)),Value1))/Value1;
RangeA:=(Sum(CLOSE-LOW,Value1))/Value1;
Stop:=CLOSE-((Bearish+RangeA)*Value2);

ValueB:= If(Stop>PREV(undefined) AND Stop>Value3,Stop,If(Stop>PREV(undefined)
AND Stop < Value3,Value3,If(Stop<=PREV(undefined),PREV(undefined),Stop*Holdingdays)));

[Color=Black]
If(ValueB = 0, undefined, ValueB);

[name=Bullish Zone; linestyle=Fill; color=Light Sea Green]
If(Bullish>=ValueB,Bullish,ValueB); If(ValueB = 0, undefined, ValueB);
-- by Leon Wilson

GO BACK


METASTOCK: Profit Locking And The Relative Price Channel

Editor's note: Code for MetaStock was already included in a sidebar to Leon Wilson's article in this issue, "Profit Locking And The Relative Price Channel." Here is the code as written by Leon Wilson:

Code for MetaStock: Bear range trailing stop

Dy:=Input("Day of Trend",1,31,19);
Mn:=Input("Month of Trend",1,12,12);
Yr:=Input("Year of Trend",2000,2500,2003);

Value1:=Input("Bearish Periods",3,55,21);
Value2:=Input("Multiplication Factor",1,10,3.2);
Value3:=Input("Initial Stop",0,100000,10);

Value4:= 34;{Channel Periods}
Value5:= 75;{OverBought Region}

HoldingDays:= BarsSince(Dy=DayOfMonth()
AND Mn=Month() AND Yr=Year());

Index:=RSI(CLOSE,Value4);
OB:=Index -Value5;
Bullish:= CLOSE-(CLOSE*(OB/100));

Bearish:=(Sum(Abs(LOW-Ref(LOW,-1)),Value1))/Value1;
RangeA:=(Sum(CLOSE-LOW,Value1))/Value1;
Stop:=CLOSE-((Bearish+RangeA)*Value2);

If(Stop>PREV AND Stop>Value3,Stop,If(Stop>PREV
AND Stop < Value3,Value3,If(Stop<=PREV,PREV,Stop
*Holdingdays)));

Bullish
-- by Leon Wilson

GO BACK


TRADESTATION: Profit Locking And The Relative Price Channel

Leon Wilson's article in this issue, "Profit Locking And The Relative Price Channel," describes the use of the author's relative price channel and bear range trailing stop algorithms.

The top of the channel is defined by Wilson's relative price channel formula. The bottom of the channel is based on Wilson's bear range trailing stop. The channel begins on a date supplied by the trader. The initial value of the channel's bear range trailing stop defines the lower boundary of the channel.

The following indicator code reproduces the channel. The channel is colored by using the "bar high" and "bar low" plot styles. Price bars are then plotted by the indicator on top of this colored range. Inputs are provided so that the trader can supply the date on which the channel should begin.

To download the EasyLanguage code for this study, go to the Support Center at TradeStation.com. Search for the file "Rpcpl.eld."

TradeStation does not endorse or recommend any particular strategy.

FIGURE 1: TRADESTATION. Here is a demonstration of Leon Wilson's relative price channel with profit locking indicator. The top of the channel is defined by Wilson's relative price channel formula. The bottom of the channel is based on Wilson's bear range trailing stop.
Indicator:  RelPriceChan ProfitLock
inputs:
    MonthOfTrend( 12 ),
    DayOfTrend( 19 ),
    YearOfTrend( 2003 ),
    ChannelPeriods( 34 ),
    OverBoughtRegion( 75 ),
    BearishPeriods( 21 ),
    MultiplicationFactor( 3.2 ),
    InitialStop( 10 ) ;


variables:
    KeyDate( 0 ),
    CountHoldingDays( false ),
    HoldingDays( 0 ),
    Index( 0 ),
    OB( 0 ),
    Bullish( 0 ),
    Bearish( 0 ),
    RangeA( 0 ),
    StopLevel( 0 ),
    BearStop( 0 ) ;


if CurrentBar = 1 then
    begin
    if BarType <= 2 then
        RaiseRuntimeError( "Invalid bar interval. " +
         "Chart must contain daily bars.") ;
    KeyDate = ELDate( MonthOfTrend, DayOfTrend,
     YearOfTrend ) ;
    end ;


if Date >= KeyDate and Date[1] < KeyDate then
    CountHoldingDays = true ;


if CountHoldingDays then
    HoldingDays = HoldingDays + 1 ;


Index = RSI( Close, ChannelPeriods ) ;
OB = Index - OverBoughtRegion ;
Bullish = Close - ( Close * OB * 0.01 ) ;


if HoldingDays > 0 then
    begin
    if BearishPeriods <> 0 then
        begin
        Bearish = Summation( AbsValue( Low - Low[1] ),
         BearishPeriods ) / BearishPeriods ;
        RangeA = Summation( Close - Low,
         BearishPeriods ) / BearishPeriods ;
        end ;
 
    StopLevel = Close - ( ( Bearish + RangeA ) *
     MultiplicationFactor ) ;


     if StopLevel > BearStop[1] and
     StopLevel > InitialStop then
        BearStop = StopLevel
    else if StopLevel > BearStop[1] and
     StopLevel < InitialStop then
        BearStop = InitialStop
    else if StopLevel <= BearStop[1] then
        BearStop = BearStop[1]
    else
        BearStop = StopLevel * HoldingDays ;


    Plot1( High, "High" ) ;
    Plot2( Low, "Low" ) ;
    Plot3( Open, "Open" ) ;
    Plot4( Close, "Close" ) ;
    Plot5( Bullish, "BullishLn" ) ;
    Plot6( BearStop, "BearStopLn" ) ;
    Plot7( Bullish, "BullishBK" ) ;
    Plot8( BearStop, "BearStopBK" ) ;
    end ;


--Mark Mills
TradeStation Securities, Inc.
www.TradeStation.com

GO BACK


eSIGNAL: Profit Locking And The Relative Price Channel

For this month's Traders' Tips, we've provided the formula, BearRangeTrailingStop.efs, based on the formula code from Leon Wilson's article in this issue, "Profit Locking And The Relative Price Channel." The study contains formula parameters that may be configured through the Edit Studies option in the Advanced Chart to set the date of the trend, bearish periods, multiplication factor, initial stop and RSI periods. The date of the trend is set to a default of 10/19/2007.

To discuss this study or download a complete copy of the formula, please visit the EFS Library Discussion Board forum under the Forums link at www.esignalcentral.com or visit our EFS KnowledgeBase at www.esignalcentral.com/support/kb/efs/. A sample chart is shown in Figure 2.
 


FIGURE 2: eSIGNAL. Here is a demonstration of the bear range trailing stop channel in eSignal.
/*********************************
Provided By:
    eSignal (Copyright © eSignal), a division of Interactive Data
    Corporation. 2007. All rights reserved. This sample eSignal
    Formula Script (EFS) is for educational purposes only and may be
    modified and saved under a new file name.  eSignal is not responsible
    for the functionality once modified.  eSignal reserves the right
    to modify and overwrite this EFS file with each new release.
 
Description:        Profit Locking and The Relative Price Channel
                    by Leon Wilson
Version:            1.0  11/7/2007

Notes:
* January 2008 Issue of Stocks and Commodities Magazine
* Study requires Daily, Weekly, or Monthly interval.
* Study requires version 8.0 or later.
* The study requires the Date of the trend to be entered
    through Edit Studies.  The study does not programaticlly
    determine the start of the trend to be analyzed.

Formula Parameters:                 Defaults:
Day of Trend                        19
Month of Trend                      10
Year of Trend                       2007
Bearish Periods                     21
Multiplication Factor               3.2
Initial Stop                        10
RSI Periods                         34
**********************************/
function preMain() {
    setPriceStudy(true);
    setStudyTitle("Bear Range Trailing Stop ");
    setCursorLabelName("Stop", 0);
    setCursorLabelName("Bullish", 1);
    setDefaultBarFgColor(Color.blue, 0);
    setDefaultBarFgColor(Color.green, 1);
    setDefaultBarThickness(2, 0);
    setDefaultBarThickness(2, 1);
    setShowTitleParameters(false);

    var fp1 = new FunctionParameter("Dy", FunctionParameter.NUMBER);
        fp1.setName("Day of Trend");
        fp1.setLowerLimit(1);
        fp1.setUpperLimit(31);
        fp1.setDefault(19);
    var fp2 = new FunctionParameter("Mn", FunctionParameter.NUMBER);
        fp2.setName("Month of Trend");
        fp2.setLowerLimit(1);
        fp2.setUpperLimit(12);
        fp2.setDefault(10);
    var fp3 = new FunctionParameter("Yr", FunctionParameter.NUMBER);
        fp3.setName("Year of Trend");
        fp3.setLowerLimit(1);
        fp3.setDefault(2007);
    var fp4 = new FunctionParameter("Value1", FunctionParameter.NUMBER);
        fp4.setName("Bearish Periods");
        fp4.setLowerLimit(3);
        fp4.setUpperLimit(55);
        fp4.setDefault(21);
    var fp5 = new FunctionParameter("Value2", FunctionParameter.NUMBER);
        fp5.setName("Multiplication Factor");
        fp5.setLowerLimit(1);
        fp5.setUpperLimit(10);
        fp5.setDefault(3.2);
    var fp6 = new FunctionParameter("Value3", FunctionParameter.NUMBER);
        fp6.setName("Initial Stop");
        fp6.setLowerLimit(0);
        fp6.setUpperLimit(100000);
        fp6.setDefault(10);
    var fp7 = new FunctionParameter("Value4", FunctionParameter.NUMBER);
        fp7.setName("RSI Periods");
        fp7.setLowerLimit(1);
        fp7.setDefault(34);
}

// Global Variables
var bVersion  = null;    // Version flag
var bInit     = false;   // Initialization flag

var xIndex    = null;
var xRangeA   = null;
var xBearish  = null;
var Stop      = null;
var Stop_1    = null;
var nDaysSince = -1;

function main(Dy, Mn, Yr, Value1, Value2, Value3, Value4) {
    var nState = getBarState();
    var nIndex = getCurrentBarIndex();
    if (bVersion == null) bVersion = verify();
    if (bVersion == false) return;
 
    if (!isDWM()) {
        drawTextPixel(5, 35, "Study requires a D, W, or M interval.", Color.red, Color.lightgrey,
             Text.RELATIVETOLEFT|Text.RELATIVETOBOTTOM, null, 12, "error0");
        return;
    }
 
    if (bInit == false) {
        xIndex = rsi(Value4);
        xRangeA = sma(Value1, efsInternal("calcSum", close(), low(), Value1));
        xBearish = efsInternal("calcBearish", Value1);
        setStudyTitle("Bear Range Trailing Stop - " + Mn +"/"+ Dy +"/"+ Yr);
        bInit = true;
    }

    if (xIndex.getValue(0) == null) return;
 
    var nHoldingDays = BarsSince(Dy, Mn, Yr);
 
    if (nIndex >= -1 && nHoldingDays == -1) {// Date not found
        drawTextPixel(5, 35, "Date not found in chart data for BarsSince("+Mn+"/"+Dy+"/"+Yr+")",
             Color.red, Color.lightgrey, Text.RELATIVETOLEFT|Text.RELATIVETOBOTTOM, null, 12, "error1");
        drawTextPixel(5, 15, "Enter new date or extend chart history.", Color.red, Color.lightgrey,
             Text.RELATIVETOLEFT|Text.RELATIVETOBOTTOM, null, 12, "error2");
        return;
    } else {
        removeText("error1");
        removeText("error2");
    }

    var Value5 = 75;  // OverBought Region
    var OB = xIndex.getValue(0) - Value5;
 
    if (OB == null) return;
 
    var Bullish = close(0) - (close(0) * (OB/100));
    var Bearish = xBearish.getValue(0);
    var RangeA = xRangeA.getValue(0);

    if (Bearish == null || RangeA == null) return;
 
    if (nState == BARSTATE_NEWBAR) {
        if (Stop != null) Stop_1 = Stop;
    }
 
    if (nHoldingDays >= 0) {
        Stop = close(0) - ((Bearish+RangeA) * Value2 );
 
        if (Stop > Stop_1 && Stop > Value3) {
            Stop = Stop;
        } else if (Stop > Stop_1 && Stop < Value3) {
            Stop = Value3;
        } else if (Stop <= Stop_1) {
            Stop = Stop_1;
        } else {
            Stop = Stop*nHoldingDays;
        }
    } else {
        return;
    }
 
    return new Array(Stop_1, Bullish);
}

var xA = null;
var xB = null;

function calcSum(a, b, len) {
    if (xA == null) xA = sma(len, a);
    if (xB == null) xB = sma(len, b);
 
    var nA = a.getValue(0);
    var nB = b.getValue(0);
    if (nA == null || nB == null) return;
 
    return (nA-nB);
}

var xC = null;

function calcBearish(len) {
    if (xC == null) xC = sma(len, efsInternal("calcBSrc"));
 
    var nC = xC.getValue(0);
    if (nC == null) return;
 
    return nC;
}

function calcBSrc() {
    if (low(-1) == null) return;
    return Math.abs(low(0) - low(-1));
}

function BarsSince(d, m, y) {
    var nRet = -1;

    if (nDaysSince < 0 && day(0) >= d && month(0) >= m && year(0) >= y) {
        nDaysSince = 0;
    } else if (nDaysSince >= 0 && getBarState() == BARSTATE_NEWBAR) {
        nDaysSince++;
    }
 
    if (nDaysSince >= 0) nRet = nDaysSince;
    return nRet;
}

function verify() {
    var b = false;
    if (getBuildNumber() < 779) {
        drawTextAbsolute(5, 35, "This study requires version 8.0 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


WEALTH-LAB: Profit Locking And The Relative Price Channel

Borrowing the WilsonRSIChannelSeries function from the July 2006 Traders' Tips, we integrated Leon Wilson's bear range trailing stop-RSI channel into a strategy that enters a position on a 55-day highest close, and exits when closing price crosses Wilson's trailing stop. While the sample code given in the sidebars in Wilson's article, "Profit Locking And The Relative Price Channel," requires you to enter a single trade date, the WealthScript code given here is more useful for backtesting since it forms the channel for each trade automatically.

Although buying and holding $10,000 worth of AAPL in January 1995 would have amounted to a small fortune in November 2007, you would have had to withstand nearly 50% drawdowns in the position's profit along the way. The strategy with profit-locking made for a relatively smooth profit curve (Figure 3), and therefore would have been an easier strategy to follow.

FIGURE 3: WEALTH-LAB. Trading AAPL, the 55-day highest close entry and profit-locking strategy yielded a profit factor of 3.4 even though winners (16) and losers (15) were nearly equal.
WealthScript code:


var Bar, p, startBar, bearishPeriods, channelPeriods,
  obRegion, holdingDays, hIndex, hOB, hBearish, Low1, RangeA, hStop, hStop2: integer;
var initialStop, currentStop, prevStop: float;


{* Commented parameter values more closely match the first two figures in the article for 'CB' Weekly *}
bearishPeriods := 21;  // 55 for CB Weekly
channelPeriods := 34;  // 21 for CB Weekly
obRegion := 70;
var multFactor: float = 3.2;


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;


function BearRangeTrailingStop( Bar, holdingDays: integer ): float;
begin
  var cond1: boolean = @hStop[Bar] > prevStop;
  if cond1 and ( @hStop[Bar] > initialStop ) then
    Result := @hStop[Bar]
  else if cond1 and ( @hStop[Bar] < initialStop ) then
    Result := initialStop
  else if not cond1 then
    Result := prevStop
  else
{ This condition hit only if hStop > prevStop AND hStop = initialStop
(probably never) }
    Result := @hStop[Bar] * holdingDays;
 
  // Color the band
  var b1 : integer = Bar - 1;
  DrawDiamond( b1, @hOB[b1], Bar, @hOB[Bar], Bar, Result, b1, prevStop, 0, #BlueBkg, #Thin, #BlueBkg, true );
  prevStop := Result;
end;


{ Upper band }
hOB := WilsonRSIChannelSeries( #Close, channelPeriods, 1, obRegion );


{ Stop reference band. The actual lower Bearish band is calculated after taking a position }
Low1 := OffsetSeries( #Low, -1 );
hBearish :=  SMASeries( AbsSeries( SubtractSeries( #Low, Low1 ) ), bearishPeriods );
RangeA := SMASeries( SubtractSeries( #Close, #Low ), bearishPeriods );
hStop := MultiplySeriesValue( AddSeries( hBearish, RangeA ), multFactor );
hStop := SubtractSeries( #Close, hStop );


{ Strategy that exits on the Wilson trailing stop }
startBar := Round( Max( bearishPeriods, channelPeriods * 2 ) );
for Bar := startBar to BarCount - 1 do
begin
  if LastPositionActive then
  begin
    p := LastPosition;
    holdingDays := Bar - PositionEntryBar( p );
    currentStop := BearRangeTrailingStop( Bar, holdingDays );
    if PriceClose( Bar ) < currentStop then
      SellAtMarket( Bar + 1, LastPosition, '' );
  end
  else if PriceClose( Bar ) = Highest( Bar, #Close, 55 ) then
  begin
  { Enter on a 55-day highest close }
    BuyAtMarket( Bar + 1, '' );
    initialStop := @hStop[Bar]; // initialize for new Position
    prevStop := initialStop;
  end;
end;


--Robert Sucher
www.wealth-lab.com

GO BACK


AMIBROKER: Profit Locking And The Relative Price Channel

In "Profit Locking And The Relative Price Channel," Leon Wilson describes a trailing-stop technique based on his earlier research on the RSI.

The trailing stop and channel presented in the article can be implemented in the AmiBroker Formula Language. Ready-to-use formula is presented in Listing 1. To use it, simply open the AFL Editor window, paste in the formula, and press the "Apply indicator" button.
 
 

FIGURE 4: AMIBROKER. Here is a Chubb Corp. weekly price chart with Leon Wilson's trailing stop-RSI channel indicator, reproducing the chart presented in Wilson's article.
LISTING 1
dt = ParamDate("Date of the trend", "2004-05-19" );
Value1 = Param("Bearish Periods", 21, 3, 55 );
Value2 = Param("Multiplication Factor", 3.8, 1, 10 );
Value3 = Param("Initial Stop", 10, 0, 1e6 );
Value4 = Param("Channel Periods", 21, 3, 55 ); // Channel Periods
Value5 = Param("Overbought region", 75, 1, 100 ); // Overbought region
Value6 = Param("Channel Smoothing", 1, 1, 10 );


HoldingDays = BarsSince( DateNum() < dt );


Index = RSI( Value4 );
OB = EMA( Index - Value5, Value6 );
Bullish = Close - ( Close * OB/100 );


Bearish = Sum( abs( Low - Ref( Low, -1 ) ), Value1 ) / Value1;
RangeA = Sum( Close - Low, Value1 ) / Value1;
Stop = Close - ( ( Bearish + RangeA ) * Value2 );


TL = Null;


for( i = 1; i < BarCount; i++ )
{
 Prev = TL[ i - 1 ];
 Cond1 = Stop[ i ] > Prev;


 TL[ i ] = IIf( Cond1 AND Stop[ i ] > Value3, Stop[ i ],
           IIf( Cond1 AND Stop[ i ] < Value3, Value3,
           IIf( NOT Cond1, Prev, Stop[ i ] * HoldingDays[ i ] ) ) );
}


TL = IIf( HoldingDays == 0, Null, TL );
Bullish = IIf( HoldingDays == 0, Null, Bullish );


Plot( C, "Price",  IIf( C > O, colorGreen, colorRed ), styleBar );
Plot( TL, "TL", colorBlue );
Plot( Bullish, "Bullish", colorLightGrey );
PlotOHLC( TL, TL, Bullish, Bullish, "", ColorRGB( 230, 230, 230), styleCloud | styleNoLabel );
Title = "{{NAME}} - {{DATE}} - {{VALUES}}";


--Tomasz Janeczko, AmiBroker.com
www.amibroker.com

GO BACK


NEUROSHELL TRADER: Profit Locking And The Relative Price Channel

The profit locking and relative price channel indicators described by Leon Wilson in his article in this issue, "Profit Locking And The Relative Price Channel," can be easily implemented in NeuroShell Trader by combining a few of NeuroShell Trader's 800+ indicators (Figure 5). To recreate the indicators, select "New Indicator ? from the Insert menu and use the Indicator Wizard to create the following:

FIGURE 5: NeuroShell. Here is a sample NeuroShell Trader chart demonstrating Leon Wilson's profit locking and relative price channel chart on Lehman Brothers.
UpperCord = Sub( Close, Divide( Multiply( Close, Sub( RSI(Close, 34), 70)), 100))


Stop = MaxValueSinceEntry( Max2( Sub( Close, Mul2( Add2( Abs( Momentum( Low,
1)), 21), MovAvg( Sub(Close,Low), 21)), 3.2)), Sub(Close,10))


For more information on NeuroShell Trader, visit www.NeuroShell.com.

--Marge Sherald, Ward Systems Group, Inc.
301 662-7950, sales@wardsystems.com
www.neuroshell.com

GO BACK


AIQ: Profit Locking And The Relative Price Channel

The AIQ code for Leon Wilson's bear range trailing stop and the bullish zone profit locking stop, as described in his article in this issue, is given here together with sample code for a channel breakout (entry rule) system that uses the author's profit locking and trailing stop for exits.

The following trading rules were not mentioned by the author. Since the exit technique is of a trend-following nature, I used a channel breakout entry rule (a trend-following entry method) in order to test the exit technique.

Figure 6 shows a sample trade with the two indicators on a chart of AAPL. I also compared the author's combined profit target and trailing stop to the result of just using the author's trailing stop without the profit target stop. The trading rules are:

FIGURE 6: AIQ, PROFIT LOCKING AND TRAILING STOP. Here is a sample AIQ chart of AAPL showing Leon Wilson's profit locking (upper channel) and trailing stop (lower channel). The trade entry and exit points are shown with the arrows. The exit was a profit lock because AAPL closed above the profit locking channel and then two days later closed below the upper channel.
Enter a long position when (test 1 and test 2):
1. The close is higher than highest close in the last 34 days
2. Use the NASDAQ 100 as a test list
3. Choose trades based on a proprietary relative strength formula (higher is better).

Exit a long position when:
1. Test1: Profit lock exit is true (close above bullish zone then a close below) or the close is below the bear range trailing stop
2. Test2: The close is below the bear range trailing stop.

Using the NASDAQ list of stocks and AIQ's Portfolio Simulation module, which simulates actual trading, I tested the above rules (long only) over the four-year-plus period from 3/14/2003 to 11/9/2007. The results of the two tests are shown in Figure 7. For this test, using the parameters shown in the code, I found that adding the profit target did not improve the returns or the Sharpe ratio over simply using the author's bear range trailing stop. Other parameters and other entry techniques may give other results.

FIGURE 7: AIQ. Here are the results from AIQ's Portfolio Simulation module to test the rules on NASDAQ stocks.
!! PROFIT LOCKING & RELATIVE PRICE CHANNEL (PL_RPC)
! Author: Leon Wilson, TASC Jan 2008
! Coded by: Richard Denning 11/09/2007


!INPUTS:
!****************SET MODE FIRST************************
! To use trailing stop & profit target, for trading and/or
! backtesting, you must set mode to '1'. To use for
! plotting on a chart, mode must be '2' and date of trade
! entry must be set. Chart of indicators will only work
! for the date entered and after:


MODE    is 1.   ! 1 = backtest,   2 = charting
define     MO      9.       ! month of trade entry
define    DA      25.   ! day of trade entry
define    YEAR    2007.    ! year of trade entry
!**************************************************************
BEAR_L     is 21.    ! Authors suggested setting
MULT    is 3.8.    ! Authors suggested setting
STOP_I    is 3.0.      ! Initial stop in ATRs (not in article)
WILD    is 34.    ! Authors suggested setting
OB_R    is 70.     ! Authors suggested setting


! CODING ABBREVIATIONS:
H    is [high].
L    is [low].
L1     is val([low],1).
C    is [close].
C1    is val([close],1).
O    is [open].
PD    is {position days}.
PEP    is {position entry price}.


!AVERAGE TRUE RANGE:
TR     is Max(H - L,max(abs(C1 - L),abs(C1- H))).
ATR    is expAvg(TR,60).


! WILDER RSI:
!Wilder Averaging to Exponential Averaging:
!ExponentialPeriods = 2 * WilderPeriod - 1.
U     is C - C1.
D     is C1 - C.
Len1    is 2 * WILD - 1.
AvgU     is ExpAvg(iff(U>0,U,0),Len1).
AvgD     is ExpAvg(iff(D>=0,D,0),Len1).
rsi     is 100-(100/(1+(AvgU/AvgD))).


! FUNCTIONS FOR PL_RPC:
OB     is expAvg(rsi - OB_R,1).
Bullish    is C - (C*(OB/100)).
Bearish     is simpleAvg(abs(C - L1),BEAR_L).
RangeA     is simpleAvg(C - L,BEAR_L).
Stop    is C - (Bearish + RangeA) * MULT.
HoldD    is iff(MODE = 1, PD,reportDate() - makeDate(MO,DA,YEAR)).
EntryP    is iff(MODE = 1, PEP, valresult(O,HoldD)).
StopInit    is iff(MODE=1,PEP - STOP_I * valresult(ATR,HoldD),
    EntryP - STOP_I * valresult(ATR,HoldD)).


! ADD THE FOLLOWING TWO INDICATORS TO CHARTS AS
! AS SEPARATE SINGLE LINES TO DISPLAY ON PRICE CHART:
StopTrl     is iff(HoldD > 1,highresult(max(StopInit,Stop),HoldD),StopInit).

BullZone    is iff(Bullish >= StopTrl,Bullish,StopTrl).


! CHANNEL BREAKOUT LONG ONLY ENTRY RULE TO TEST
! PROFIT LOCKING & TRAILING STOP:
LE    if countof(C > highresult(H,34,1),5)>=1 and rsi <= OB_R - 10 .
LX    if (C1 > valresult(BullZone,1) and C < BullZone)

    or C < valresult(StopTrl,1).


! Same entry rule, pared with bear trailing stop (not using the profit locking)
LE_TS    if countof(C > highresult(H,34,1),5)>=1 and rsi <= OB_R - 10 .
LX_TS    if C < valresult(StopTrl,1).


This code can be downloaded from the AIQ website at www.aiqsystems.com and also from www.tradersedge systems.com/traderstips.htm.

--Richard Denning, AIQ Systems
richard.denning@earthlink.net

GO BACK


BLOCKS: Profit Locking And The Relative Price Channel

To use the studies described here, you will need the free Blocks software and the Strategy Trader datapack. Go to www.Blocks.com to download the software and get detailed information on the available datapacks.

In the article by Leon Wilson in this issue, "Profit Locking And The Relative Price Channel," he combines the upper cord of the bullish price channel band with bear range as the lower band. We created a tool for Blocks. This tool is available in the Blocks library. No custom coding is required.

Open the Personal Chartist workspace in Blocks, then click the Start button, then browse to the Worden/S&C Traders Tips folder and click on Wilson Bear Range Trailing Stop.

To download the Blocks analysis software, go to www.Blocks.com. Then, to choose your Blocks Analysis Packs, call 800 776-4940, or order online at the Blocks website. See Figure 8 for an example.

FIGURE 8: BLOCKS. Place the pointer on the entry date of the trade to plot the bearish range trailing stop-RSI channel.
--Bruce Loebrich and Patrick Argo
Worden Brothers, Inc.

GO BACK


STRATASEARCH: Profit Locking And The Relative Price Channel

By combining the bear range trailing stop with his existing relative price channel, the author has given us numerous relationships to explore, including reversals, confirmation, overbought/oversold situations, and breakouts (see Figure 9). These various relationships give traders a large number of possibilities to investigate.

FIGURE 9: STRATASEARCH, PROFIT LOCKING AND THE RELATIVE PRICE CHANNEL. In the top panel, the relative price channel and the bear range trailing stop are combined to identify several relationships.

Plug-ins for both the relative price channel and the current indicator can be found in the Shared Area of the StrataSearch user forum. StrataSearch users can explore these indicators by viewing them in charts, running backtests, running optimization routines, or combining them with other indicators.
 

//****************************************************************
// Bear Range Trailing Stop
//****************************************************************
DY = parameter("Day Of Trend");
MN = parameter("Month Of Trend");
YR = parameter("Year Of Trend");


Value1 = parameter("Bearish Periods");
Value2 = parameter("Mult Factor");
Value3 = parameter("Initial Stop");


Value4 = 34; // Channel Periods
Value5 = 75; // Overbought Region


HoldingDays = DaysSince(DY = DayOfMonth() AND
    MN = Month() and YR = Year());


Index = rsi(Value4);
OB = Index - Value5;
Bullish = close - (close * (OB/100));


Bearish = (sum(abs(low-ref(low, -1)), Value1)) / Value1;
RangeA = (sum(close-low, Value1)) / Value1;
Stop = close - ((Bearish+RangeA)*Value2);


BRTS = BRTSH(Stop, Value3, HoldingDays);


--Pete Rast, Avarin Systems Inc.
www.StrataSearch.com

GO BACK


STRATEGYDESK: Profit Locking And The Relative Price Channel

This month we'll look at the formula for the bear range trailing stop as discussed by Leon Wilson in this issue's article, "Profit Locking And The Relative Price Channel." Below are the StrategyDesk interpretations for the upper and lower bands. Using these formulas, you can create these as a channel on a stock price chart.

For the upper line, we are using 70 as the RSI overbought level and calculating RSI over 34 periods. These values can be changed in the formula below by simply changing the "70" or "34."

Bullish Band: (Bar[Close,D] - Bar[Close,D] * (RSI[RSI,34,D] - 70) / 100)


For the lower line, we are using 3.2 as the multiplication factor. This formula is based on 10 periods. For the purposes of explanation, the "^" signs indicate exponential growth (a number times itself). We use these to provide the absolute values called for in the article.
 

Stop Value:  (Bar[Close,D] - 3.2 * (((MomentumROC[Momentum,Low,1,0,D]
^ 2) ^ .5 + (MomentumROC[Momentum,Low,1,0,D,1] ^ 2) ^ .5 + (MomentumROC[Momentum,Low,1,0,D,2]
^ 2) ^ .5 + (MomentumROC[Momentum,Low,1,0,D,3] ^ 2) ^ .5 + (MomentumROC[Momentum,Low,1,0,D,4]
^ 2) ^ .5 + (MomentumROC[Momentum,Low,1,0,D,5] ^ 2) ^ .5 + (MomentumROC[Momentum,Low,1,0,D,6]
^ 2) ^ .5 + (MomentumROC[Momentum,Low,1,0,D,7] ^ 2) ^ .5 + (MomentumROC[Momentum,Low,1,0,D,8]
^ 2) ^ .5 + (MomentumROC[Momentum,Low,1,0,D,9] ^ 2) ^ .5) / 10 + (MovingAverage[MA,Close,10,0,D]
- MovingAverage[MA,Low,10,0,D])))


The formulas above are displayed as custom indicators on Figure 10. For reference, the RSI is shown below the price chart.
 
 

FIGURE 10: TD AMERITRADE. Here is a demonstration of the bear range trailing stop.

If you have questions about this formula or functionality, please call TD Ameritrade's StrategyDesk help line at 800 228-8056, free of charge, or access the Help Center via the StrategyDesk application. StrategyDesk is a downloadable application free for all TD Ameritrade clients. Regular commission rates apply.

TD Ameritrade and StrategyDesk do not endorse or recommend any particular trading strategy.

--Jeff Anderson
TD AMERITRADE Holding Corp.
www.tdameritrade.com

GO BACK


NINJATRADER: Profit Locking And The Relative Price Channel

The bear range trailing stop indicator, as discussed in "Profit Locking And The Relative Price Channel" by Leon Wilson elsewhere in this issue, is available for download at www.ninjatrader.com/SC/January2008SC.zip. See Figure 11 for an example.

FIGURE 11: NINJATRADER. This screenshot shows the bear range trailing stop indicator on a daily RIMM chart.
Once it is downloaded, from within the NinjaTrader Control Center window, select the menu File > Utilities > Import NinjaScript and select the downloaded file. This indicator is for NinjaTrader Version 6.5 or greater. You can review the indicator's source code by selecting the menu Tools > Edit NinjaScript > Indicator from within the NinjaTrader Control Center window and selecting WilsonBearRangeTrailingStop.

NinjaScript indicators are compiled DLLs that run native, not interpreted, which provides you with the highest performance possible.

--Raymond Deux and Joshua Peng
NinjaTrader, LLC
www.ninjatrader.com

GO BACK


OMNITRADER: Profit Locking And The Relative Price Channel

For this month's Traders' Tip, we have provided a stop called the bear range trailing stop (BearRangeTrailingStop.txt), based on Leon Wilson's article in this issue, "Profit Locking And The Relative Price Channel." (See Figure 12.)

FIGURE 12: OMNITRADER, PROFIT LOCKING AND THE RELATIVE PRICE CHANNEL. Here is a daily price chart of LEH with the BearRangeTrailingStop plotted on the price pane.


The stop attempts to better manage trending trades by analyzing the RSI to determine the quality of the trend and adjust the trailing stop appropriately. The stop also plots a bullish region to help identify overbought conditions.

To use the indicator, first copy the file BearRangeTrailingStop.txt to the Stops subdirectory of C:\Program Files\Nirvana\OT2006\/VBA\. Next, open OmniTrader and click Edit:OmniLanguage. You should see the BearRangeTrailingStop  in the stops section of the Project pane. Click Compile. The code is ready to use.

For more information and complete source code, visit https://www.omnitrader.com/ProSI.
 

#Stop
'**************************************************************
'*   Bear Range Trailing Stop (BearRangeTrailingStop.txt)
'*     by Jeremy Williams
'*       Nov. 11, 2007
'*
'*    Adapted from Technical Analysis of Stocks &Commodities
'*     January 2008
'*
'*  Summary:
'*      This stop uses the RSI to dynamically adjust the cushion
'*  of a trailing profit stop, allowing more advanced forms of
'*  trade management. For more information see "Profit Locking and
'*  The Relative Price Channel" in the January 2008 issue of
'*  Technical Analysis of Stocks &Commodities.
'*
'*  Parameters:
'*
'*  BearishPeriods -  Specifies the number of  bearish periods
'*
'*  Factor- Multiplicative Factor specifying the stop cushion
'*
'*  ChannelPeriods - Specifies the number of periods for the channel
'*
'*  Overbought  - Specifies the RSI level corresponding to an
'*                  overbought condition
'**************************************************************


#Param "BearishPeriods",21
#Param "Factor"    ,3.8
#Param "ChannelPeriods",34
#Param "Overbought",70


Dim myRSI    As Single
Dim OB    As Single
Dim Bullish     As Single
Dim Bearish     As Single
Dim RangeA    As Single
Dim myStop    As Single
Dim DeltaL    As Single
Dim DeltaA    As Single
Dim myLevel    As Single


'Calculate the bullish band
myRSI = RSI(c,ChannelPeriods)
OB = myRSI - Overbought
Bullish = c-c*(OB/100)


' Bear calculation
DeltaL = ABS(l-l[1])
Bearish = SMA(DeltaL,BearishPeriods)


' Calculate Stop level
DeltaA = c-l
RangeA = SMA(DeltaA,BearishPeriods)
myStop = c-Factor*(Bearish +RangeA)


' Update Stop Level and exit if crossed
If Signal = LongSignal and l<myLevel[1] Then
    Signal = ExitSignal


Else
    myLevel = IIF(myLevel[1]>myStop,myLevel[1],myStop)
    ExitLevel = myLevel
End If


'Plot the stop level and bullish zone.
PlotPrice("StopL",myLevel)
PlotPrice("Bull",Bullish)


--Jeremy Williams, Trading Systems Researcher
Nirvana Systems, Inc.www.omnitrader.com
www.nirvanasystems.com

GO BACK


TRADECISION: Profit Locking And The Relative Price Channel

The article by Leon Wilson in this issue, "Profit Locking And The Relative Price Channel," demonstrates a technique for identifying sustainable price action, overbought periods, and strong breakouts.

Using the Indicator Builder in Tradecision, you can recreate the BearRangeHigh and BearRangeLow based on Wilson's concepts.

Code for the BearRangeHigh indicator is as follows:
 

input
  Dy:"Day of Trend",19,1,31;
  Mn:"Month of Trend",12,1,12;
  Yr:"Year of Trend",2003,2000,2500;
  BearishPeriods:"Bearish Periods",21,3,55;
  MultiplicationFactor:"Multiplication Factor",3.2,1,10;
  InitialStop:"Initial Stop",10,0,100000;
end_input


var
 Value4:=34; {Channel Periods}
 Value5:=75; {OverBought Region}
 HoldingDays:=BarsSince(Dy = DayOfMonth() and Mn = Month() and Yr = Year());
 Index:=RSI(CLOSE, Value4);
 OB:=Index - Value5;
 Bullish:=CLOSE - (CLOSE * (OB / 100));
 Bearish:=(CumSum(Abs(LOW - Ref(LOW, -1)), BearishPeriods)) / BearishPeriods;
 RangeA:=(CumSum(CLOSE - LOW, BearishPeriods)) / BearishPeriods;
 Stop:=CLOSE - ((Bearish + RangeA) * MultiplicationFactor);
 prev := iff(historysize>0,this\1\,0);
end_var
return Bullish;


    Code for the BearRangeLow indicator is as follows:


input
  Dy:"Day of Trend",19,1,31;
  Mn:"Month of Trend",12,1,12;
  Yr:"Year of Trend",2003,2000,2500;
  BearishPeriods:"Bearish Periods",21,3,55;
  MultiplicationFactor:"Multiplication Factor",3.2,1,10;
  InitialStop:"Initial Stop",10,0,100000;
end_input


var
 Value4:=34; {Channel Periods}
 Value5:=75; {OverBought Region}
 HoldingDays:=BarsSince(Dy = DayOfMonth() and Mn = Month() and Yr = Year());
 Index:=RSI(CLOSE, Value4);
 OB:=Index - Value5;
 Bullish:=CLOSE - (CLOSE * (OB / 100));
 Bearish:=(CumSum(Abs(LOW - Ref(LOW, -1)), BearishPeriods)) / BearishPeriods;
 RangeA:=(CumSum(CLOSE - LOW, BearishPeriods)) / BearishPeriods;
 Stop:=CLOSE - ((Bearish + RangeA) * MultiplicationFactor);
 prev := iff(historysize>0,this\1\,0);
end_var
return iff(Stop >Prev and Stop >InitialStop, Stop, iff(Stop >Prev
and Stop < InitialStop, InitialStop, iff(Stop <= Prev, Prev, Stop *
Holdingdays)));


 The default settings for both indicators can be modified with a few clicks.

To use the indicators, open the Tradecision application, and from the Insert menu, select the corresponding indicator and then click "Insert."

--Alex Grechanowski
Alyuda Research, Inc.
sales@tradecision.com, 510 931-7808
www.tradecision.com

GO BACK


TRADE NAVIGATOR: Profit Locking And The Relative Price Channel

"Profit Locking And The Relative Price Channel" by Leon Wilson discusses the use of profit locking and the relative price channel. Profit locking is considered a close below the upper cord of the bullish band. Capital protection is a close below our trailing stop.

Here, we will show how to recreate the functions necessary to plot the bear range trailing stop in Trade Navigator. There are nine functions in all, and some build on others. Because some build on each other, it is important to create them in the order presented. As always, you can download a special file (in this case, "SC0108") that will give easy access to these same functions.

We're going to be working from the trader's toolbox, specifically the function creation window.

1) Click on the Edit menu and choose Functions.
2) From the functions window, click New to create a new function.
3) Type or copy and paste the following syntax:

MovingSum (Close - Low , Bearish Periods , 0) / Bearish Periods

4)    Bearish Periods is an input. Set its value on the input tab of the function creation window. The value suggested in the article is 21. Type that in the appropriate field of the input tab.
5)     Click Save to give the function a name. Type "BCRangeA" and click OK.

You will be following the same steps for eight additional functions. Remember to create them in the right order!
 

Function Name: BCIndex
Syntax: RSI (Close , ChannelPeriods , False)
Inputs and recommended default values: ChannelPeriods = 34


Function Name: BCHoldingDays
Syntax: Bars Since (YearMonthDay = YYYYMMDD , 1 , 0)
Inputs and recommended default values: YYYYMMDD = 20071031


Function Name: BCBearish
Syntax: MovingSum (Abs (Low - Low.1) , Bearish Periods , 0) / Bearish Periods
Inputs and recommended default values:  Bearish Periods = 21


Function Name: BCStop
Syntax: Close - ((BCBearish (Bearish Periods) + BCRangeA (Bearish Periods)) * Multiplication Factor)
Inputs and recommended default values: Bearish Periods = 21, Multiplication Factor = 3.8


Function Name: BCOB
Syntax: MovingAvgX (BCIndex (ChannelPeriods) - OverBought Region , Channel Smoothing , False)
Inputs and recommended default values: ChannelPeriod = 34, OverBought Region= 70, Region Channel Smoothing = 7
Function Name: BCBullish
Syntax: Close - (Close * (BCOB (ChannelPeriods , OverBought Region , Channel Smoothing) / 100))
Inputs and recommended default values: ChannelPeriod = 34, OverBought = 70, Region Channel Smoothing = 7


Function Name: BCValueB
SyntaxIFF (BCStop (Bearish Periods , Multiplication Factor) > BCStop (Bearish
Periods , Multiplication Factor).1 And BCStop (Bearish Periods , Multiplication
Factor) > Initial Stop , BCStop (Bearish Periods , Multiplication Factor)
, IFF (BCStop (Bearish Periods , Multiplication Factor) > BCStop (Bearish
Periods , Multiplication Factor).1 And BCStop (Bearish Periods , Multiplication
Factor) < Initial Stop , Initial Stop , IFF (BCStop (Bearish Periods ,
Multiplication Factor) <= BCStop (Bearish Periods , Multiplication Factor).1
, BCStop (Bearish Periods , Multiplication Factor).1 , BCStop (Bearish Periods
, Multiplication Factor) * BCHoldingDays (YYYYMMDD))))
Inputs and recommended default values: Bearish Periods = 21, Multiplication
Factor = 3.8, Initial Stop = 0, YYYYMMDD = 20071031


Function Name: BC Bear Range Trailing Stop
Syntax: Highest (BCValueB (Bearish Periods , Multiplication Factor , Initial
Stop , YYYYMMDD) , 10)
 Inputs and recommended default values: Bearish Periods = 21, Multiplication
Factor = 3.8, Initial Stop = 0, YYYYMMDD = 20071031


That's it for the functions. Everything is really a building block for the last function, the "BC Bear Range Trailing Stop."

To add it to your chart, first click on the Charts menu and click Add to Chart. Choose the Indicators tab and then scroll down to "BC Bear Range Trailing Stop." Click on the name and then click Add to add it to your chart. It should look similar to Figure 13.

FIGURE 13: TRADE NAVIGATOR. This chart demonstrates the BC bear range trailing stop.
We have created a special file that contains all the functions discussed in this article. To download the file in Trade Navigator, click on the File menu, then click "Update data." Select "Download special file" and replace "Upgrade" with "SC0108," then click Start.

Follow through the upgrade prompts. Once Trade Navigator has restarted, you will be able to chart the functions.

Consult the article for suggestions on how to use these indicators in your trading. Good luck!

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

GO BACK


VT TRADER: Bear Range Trailing Stop

Leon Wilson's article in this issue, "Profit Locking And The Relative Price Channel," discusses the use of the relative price channel in combination with the bear range trailing stop indicator as a potential solution to the problems of profit-locking and capital protection. Wilson discusses techniques to help traders identify sustainable price action, overbought periods, and strong breakouts in order to better qualify more profitable exit points. (See Figure 14 for an example.)

FIGURE 14: VT TRADER. Here is the bear range trailing stop indicator displayed over a EUR/USD weekly candle chart.
We'll be offering the bear range trailing stop indicator for download in our user forums. We'll also be offering an additional indicator inspired by Wilson's bear range trailing stop indicator. While the bear range trailing stop works well in rising markets, it does not seem to work in declining markets, so we've created the bull range trailing stop for this purpose.

The VT Trader code and instructions for creating Wilson's bear range trailing stop indicator are as follows:

Bear range trailing stop indicator:
1. Navigator Window>Tools>Indicator Builder>[New] button
2. In the Indicator Bookmark, type the following text for each field:

Name: TASC - 01/2008 - Bear Range Trailing Stop
Short Name: vt_BRTS
Label Mask: TASC - 01/2008 - Bear Range Trailing Stop (Trend Date: %Mn%/%Dy%/%Yr% | %Value1%, %Value2%, %Value3% | %Value4%, %Value5%)
Placement: Price Frame
Inspect Alias: Bear Range Trailing Stop

3. In the Input Bookmark, create the following variables:
 

[New] button... Name: Mn , Display Name: Month of Trend , Type: integer , Default: 12
[New] button... Name: Dy , Display Name: Day of Trend , Type: integer , Default: 19
[New] button... Name: Yr , Display Name: Year of Trend , Type: integer , Default: 2007
[New] button... Name: Value1 , Display Name: Bearish Periods , Type: integer , Default: 21
[New] button... Name: Value2 , Display Name: Multiplication Factor , Type: float , Default: 3.2
[New] button... Name: Value3 , Display Name: Initial Stop , Type: float , Default: 1.4
[New] button... Name: Value4 , Display Name: Channel Periods , Type: integer , Default: 34
[New] button... Name: Value4 , Display Name: Overbought Region , Type: integer , Default: 75


4. In the Output Bookmark, create the following variables:
 

[New] button...
Var Name: BRTS
Name: (BRTS)
Line Color: dark green
Line Width: thin
Line Type: dashed


[New] button...
Var Name: Bullish
Name: (Bullish Cord)
Line Color: light blue
Line Width: thin
Line Type: solid line


5. In the Formula Bookmark, copy and paste the following formula:
 

{Provided By: Visual Trading Systems, LLC & Capital Market Services,
LLC (c) Copyright 2008}
{Description: Bear Range Trailing Stop}
{Notes: January 2008 Issue - Profit Locking and the Relative Price Channel}
{vt_BRTS Version 1.0}


HoldingDays:= BarsSince(Dy=DayOfMonth() AND Mn=Month() AND Yr=Year());


Index:= RSI(Value4);
OB:= Index - Value5;
Bullish:= C-(C*(OB/100));


Bearish:= (Sum(Abs(L-ref(L,-1)),Value1))/Value1;
RangeA:= (Sum(C-L,Value1))/Value1;
Stop:= C-((Bearish+RangeA)*Value2);


BRTS:= If(Stop>PREV AND Stop>Value3,Stop,
    If(Stop>PREV AND Stop<Value3,Value3,
    If(Stop<=PREV,PREV,Stop*HoldingDays)));


6. Click the "Save" icon to finish building the bear range trailing stop indicator.

To attach the indicator to a chart, click the right mouse button within the chart window and then select "Add Indicators" -> "TASC - 01/2008 - Bear Range Trailing Stop" from the indicator list.

To learn more about VT Trader, visit www.cmsfx.com.

--Chris Skidmore, CMS Forex
(866) 51-CMSFX, trading@cmsfx.com
www.cmsfx.com

GO BACK


TRACK 'N TRADE: Profit Locking And The Relative Price Channel

In "Profit Locking And The Relative Price Channel" in this issue, Leon Wilson's discussion of implementing the RSI along with his profit-locking methodology shows the strength of using multiple, complimentary tools to accomplish the goal of the discerning trader. In his article, he makes reference to the use of multiple indicators, including such tools as the MACD, and the RSI, along with channel indexes, in an attempt to not only profit lock but also to protect capital.

Track 'n Trade High Finance software employs a number of the distinctive features included in Wilson's article. One such tool used for profit locking is the parabolic stop & reverse, or PSAR tool, designed by J. Welles Wilder, which trails the market in a mathematically calculated way, rather than relying on areas of support and resistance. This tool keeps the trader from placing stops in traditional hotspots, where sharks have the ability to drop back and knock traders out of the market.

Using the PSAR in combination with the RSI, as demonstrated by Wilson, the trader has the ability to use multiple tools to help identify the upper cord of the bullish band, while also using the PSAR trailing stop to "exit relative price action from both a profit-locking and capital-protection perspective."

Implementing the PSAR-RSI combination within Track 'n Trade High Finance is a process of taking advantage of the preprogrammed user interface. These two interfaces can be accessed by clicking on the Control Panel tab in the left window pane. This control panel is where each indicator is given access to the different variables that actuate and programmatically modify the settings of the indicators. Track 'n Trade is specifically designed for individuals who want the flexibility of customizing their indicators without the requirement of writing programming code.

Activate the Track 'n Trade programming interface by selecting the fourth tab in the left control panel, then select the RSI indicator from the chart menu accessible from a right-click. In the chart example in Figure 15 of the eurodollar vs. US dollar, we're using an RSI time frame of 14. The trigger thresholds are set to 75% high and 25% low. Upon reentry into the channel of the RSI period line, the indicator triggers either a buy signal if entering from the low 25% oversold side, or a sell signal when entering from the 75% high overbought side. Using these settings, we accomplish the goal as outlined in Wilson's article of establishing profit locking. When an arrow gives a signal, this is an indication that the market is overbought, and the decision can be made to either protect capital or continue with the trade and allow the capital protection of the PSAR trailing stop to take us out of the market.

FIGURE 15: GECKO's TRACK 'n TRADE. Here is a demonstration of Leon Wilson's profit locking and capital protection strategy using RSI and PSAR.
Tuning in the PSAR is an important step in capital protection. Track 'n Trade allows for complete modification of all aspects of the PSAR. In this example, we're using an initial acceleration of 20 periods, followed by an additional acceleration of 10, and an acceleration limit of 200. This combination of RSI profit locking and PSAR capital protection, as outlined in Leon Wilson's article, is a compliment to any trading strategy, and could be considered a complete trading system in itself.

--Lan H. Turner
www.geckosoftware.com
 

GO BACK

Return to January 2008 Contents

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