June 2005
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:

  METASTOCK: MODIFIED DARVAS TECHNIQUE
  TRADESTATION: DARVAS TECHNIQUE
  WEALTH-LAB: MODIFIED DARVAS TECHNIQUE
  AMIBROKER: MODIFIED DARVAS TECHNIQUE
  eSIGNAL: MODIFIED DARVAS TECHNIQUE
  NEUROSHELL TRADER: MODIFIED DARVAS TECHNIQUE
  NEOTICKER: MODIFIED DARVAS TECHNIQUE
  TECHNIFILTER PLUS: MODIFIED DARVAS TECHNIQUE
  TRADING SOLUTIONS: MODIFIED DARVAS TECHNIQUE

or return to June 2005 Contents



METASTOCK: MODIFIED DARVAS TECHNIQUE

Daryl Guppy's two articles, "Something Darvas, Something New" in this issue and "Darvas-Style Trading" in the May 2005 S&C, introduce a new trading system. Guppy's article in this issue contains the MetaStock code for some indicators and a matching Expert Advisor. Given here are the instructions to add a system test.

After you have created the indicators given in Guppy's article in this issue, set up a system test in MetaStock as follows:
 

1. Select Tools > the Enhanced System Tester
2. Click New
3. Enter a name for the system
4. Select the Buy Order tab and enter the following formula:
Fml("Darvas Buy")
5. Select the Sell Order tab and enter this formula:
Fml("Darvas Sell")
6. Click OK to close the system editor.
--William Golson
Equis International


GO BACK


TRADESTATION: DARVAS TECHNIQUE

Daryl Guppy's two articles, "Something Darvas, Something New" in this issue and "Darvas-Style Trading" in the May 2005 S&C, describe how Darvas boxes are drawn and also describes three methods for using the boxes: the classic, modern, and breakout methods.

FIGURE 1: TRADESTATION, DARVAS TECHNIQUE. Here is an example of drawing Darvas boxes in TradeStation.
To demonstrate how these methods might be implemented in an EasyLanguage strategy, we have written a strategy called "Darvas by Guppy." To begin, create a daily chart of the symbol of your choice. Then insert the "Darvas by Guppy" strategy into the chart.

To apply the classic style, set the periods input to 200. Ensure that the inputs ExitNextDay, GhostBoxExit, and BreakOutEntry are set to false for this style. The input VolumeEntry should be set to true.

To apply the modern Darvas style, a period length of either 100 or 200 may be used. ExitNextDay and GhostBoxExit should both be set to true for this style. VolumeEntry should be false.

Finally, to apply the breakout Darvas style, set BreakoutEntry, ExitNextDay, and GhostBoxExit to true. VolumeEntry should be set to false.

This code may be downloaded from the TradeStation Support Center, which is accessible from TradeStation.com.

Strategy: Darvas by Guppy
 

inputs:
 Periods( 100 ),
 ExitNextDay( false ),
 GhostBoxExit( false ),
 BreakoutEntry (false ),
 VolumeEntry( false ),
 VolumeAvgLen( 10 ),
 VolumeFactor( 1.5 ) ;
variables:
 BarsSinceDH( 0 ),
 BarsSinceDL( 0 ),
 CriticalLow( 0 ),
 TempD_Low( 0 ),
 SearchForLow ( false ),
 D_Low( 0 ),
 D_High( 0 ),
 BottomLineNum( 0 ),
 TopLineNum( 0 ),
 LeftSideNum( 0 ),
 RightSideNum( 0 ),
 CriticalHigh( 0 ),
 TempD_High( 0 ),
 DHighLowDiff( 0 ),
 MyStop( 0 ),
 MyTrigger( 0 ),
 DownTrend( 0 ) ;
if CurrentBar > Periods then
 begin
 BarsSinceDH = BarsSinceDH + 1 ;
 BarsSinceDL = BarsSinceDL + 1 ;
 if Low[3] <= CriticalLow[4] and
  Low[3] <= Low[2] and
  Low[3] <= Low[1] and
  Low[3] < Low
 then
  begin
  TempD_Low = Low[3] ;
  BarsSinceDL = 3 ;
  end ;
 if SearchForLow and BarsSinceDL < 6 and
  BarsSinceDL <= BarsSinceDH then
  begin
  D_Low = Low[BarsSinceDL] ;
  D_High = TempD_High ;
  SearchForLow = false ;
  BottomLineNum = TL_New( Date[BarsSinceDH],
   Time[BarsSinceDH], D_Low, Date[3], Time[3],
   D_Low ) ;
  TopLineNum = TL_New( Date[BarsSinceDH],
   Time[BarsSinceDH], D_High, Date[3], Time[3],
   D_High ) ;
  LeftSideNum = TL_New( Date[BarsSinceDH],
   Time[BarsSinceDH], D_High, Date[BarsSinceDH],
   Time[BarsSinceDH], D_Low ) ;
  RightSideNum = TL_New( Date[3], Time[3], D_High,
   Date[3], Time[3], D_Low ) ;
  end ;
 if High[3] >= CriticalHigh[4]
  and High[3] >= High[2]
  and High[3] >= High[1]
  and High[3] > High
 then
  begin
  BarsSinceDH = 3 ;
  TempD_High = High[3] ;
  SearchForLow = true ;
  end ;
 CriticalHigh = Highest( High, Periods ) ;
 CriticalLow = Lowest( Low, BarsSinceDH ) ;
 end ;
DHighLowDiff = D_High - D_Low ;
if GhostBoxExit and DHighLowDiff > 0 and Close >
 D_High + DHighLowDiff then
 begin
 MyStop = ( IntPortion( ( Close - D_Low ) /
  DHighLowdiff ) - 1 ) * DHighLowDiff + D_Low ;
 MyTrigger = MyStop + DHighLowDiff ;
 end
else
 begin
 MyStop = D_Low ;
 MyTrigger = D_High ;
 end ;
if Close crosses under D_Low then
 DownTrend = 0
else if BreakoutEntry and Close crosses over D_High then
 DownTrend = 1
else if BreakoutEntry and DownTrend = 1 and
 BarsSinceDL = 3 then
 DownTrend = 2 ;
if ( BreakoutEntry and DownTrend = 2 ) or
 BreakoutEntry = false then
 begin
 if VolumeEntry then
  begin
  if Close crosses over MyTrigger and Volume >
   Average( Volume, VolumeAvgLen ) * VolumeFactor
    then
   Buy next bar market ;
  end
 else if Close < MyTrigger then
  Buy next bar MyTrigger stop ;
 
 if ExitNextDay then
  begin
  if Low[1] >= MyStop and Low < MyStop then
   Sell next bar at market ;
  end
 else
  Sell next bar at MyStop stop ;
 end ;


--Mark Mills
TradeStation Securities, Inc.
A subsidiary of TradeStation Group, Inc.
www.TradeStationWorld.com

GO BACK


WEALTH-LAB: MODIFIED DARVAS TECHNIQUE

Visit www.wealth-lab.com to try out this month's ChartScript adaptation of the modern Darvas method by searching the public ChartScript titles for "Guppy." Select the script and then enter a symbol of your choice. As always, the WealthScript translation is available to Wealth-Lab Pro and Developer users via the Community|Download ChartScripts action.

FIGURE 2: WEALTH-LAB, MODIFIED DARVAS TECHNIQUE. Darvas boxes are drawn by the code. Green backgrounds indicate a positive resolution of a Darvas box, whereas red points to a failure in the trend. Ghost boxes are painted light blue, and the small fuchsia circles represent active stop levels.


After spot-checking selected symbols, it appeared that the method provided a better return by acting on all 100-day breakout signals as opposed to waiting for a Darvas box and then entering after an ensuing breakout. Our ChartScript reflects this modification of the trading rules, where, in a portfolio $imulation of the current Nasdaq 100 stocks over the most recent six-year period, the Darvas script squeezed out a 4% April gain with a $100,000 account after $8 per trade commissions using 5% of equity sizing. (A 1% max-risk sizing produced similar results.) Unfortunately, the simulated account suffered a 66% drawdown after achieving a whopping 120% gain in the period between April 1999 to April 2000.
 

WealthScript code:
{$I 'HighestBar2'}
{$I 'LowestBar2'}
type GhostBox = record
  Bar, BoxNum: integer;
  HighClose, Stop, Base: float;
end;
const D_BARS = 4;
var G: GhostBox;
var DBm1: integer = D_BARS - 1;
var Last_Bar: integer = BarCount - 1;
var Bar, LastDHBar, LastDLBar, DHSer, DLSer, HCSer, BoxColor, BoxEndBar: integer;
var DHCnfd, DLCnfd, DarvasValid: boolean;
var C, BoxHeight: float;
{ * Ghost boxes processed only if position active * }
procedure ManageGhostStop( Bar: integer );
begin
  var p: integer = LastPosition;
  var n: integer = G.BoxNum;
  G.HighClose := Max( G.HighClose, PriceClose( Bar ) );
  repeat
    var H: float = G.Base + BoxHeight * n;
    if G.HighClose > H then
    begin
      DrawRectangle( G.Bar, H - BoxHeight, Bar, H, 0, #BlueBkg, #Thin, #BlueBkg, true );
      G.Bar := Bar;
      Inc( n );
    end
    else break;
  until n > 25;
  G.Stop := G.Base + BoxHeight * ( n - 2 );
  G.BoxNum := n;
  DrawCircle( 5, 0, Bar, G.Stop, #Fuchsia, #Thin );
  if PriceClose( Bar ) < G.Stop then
    SellAtMarket( Bar + 1, p, 'Ghost Stop' );
end;
DHSer := CreateSeries;  // Confirmed high series
DLSer := CreateSeries;  // Confirmed low series
HCSer := HighestSeries( #Close, 100 );
for Bar := 100 to BarCount - 1 do
begin
  C := PriceClose( Bar );
  if not DHCnfd then
  begin
    if Bar >= BoxEndBar + 3  then
      DHCnfd := Bar - HighestBar2( Bar, #High, D_BARS, 4 ) >= DBm1;
    if DHCnfd then
      LastDHBar := Bar - DBm1;
  end
  else
    DHCnfd := C <= PriceHigh( LastDHBar );   // Buy trigger
  if DHCnfd then  { if D_Box high confirmed, check for the low }
    if not DLCnfd then
    begin
      DLCnfd := Bar - LowestBar2( Bar, #Low, D_BARS, 4 ) >= DBm1;
      if DLCnfd then
      begin
        LastDLBar := Bar - DBm1;
        BoxHeight := PriceHigh( LastDHBar ) - PriceLow( LastDLBar );
        DarvasValid := true;
        G.Bar := -1;
      end;
    end
    else
      DLCnfd := C >= PriceLow( LastDLBar );  // Sell trigger
{ Store values in series for graphing }
  @DHSer[Bar] := PriceHigh( LastDHBar );
  @DLSer[Bar] := PriceLow( LastDLBar );
{ Trading rules and drawing }
  if DarvasValid then
  begin
    DarvasValid := DHCnfd and DLCnfd;
    if not DarvasValid or ( Bar = Last_Bar ) then
    begin
      if not DHCnfd then
      begin
        BoxColor := #GreenBkg;
        if not LastPositionActive then
        begin
          SetRiskStopLevel( @DLSer[Bar] );
          if C > @HCSer[Bar-1] then
            BuyAtMarket( Bar + 1, '' );
        end
        else  // initialize ghost box
        begin
          G.Bar := Bar - 1;
          G.BoxNum := 1;
          G.HighClose := C;
          G.Stop := @DHSer[Bar];
          G.Base := G.Stop;
        end;
      end
      else    // DLCnfd is false
      begin
        BoxColor := #RedBkg;
        if LastPositionActive then
          SellAtMarket( Bar + 1, LastPosition, 'D_Box Stop' );
      end;
    { Draw D_Box at last bar or when 'breached' }
      if Bar = Last_Bar then
        DrawRectangle( LastDHBar, PriceHigh( LastDHBar ),
         Last_Bar, PriceLow( LastDLBar ), 0, #GreenBkg,
         #Thin, #GreenBkg, true )
      else
        DrawRectangle( LastDHBar, PriceHigh( LastDHBar ),
         Bar - 1, PriceLow( LastDLBar ), 0, #Green, #Thin,
         BoxColor, true );
      BoxEndBar := Bar;
      DHCnfd := false;    // reset
      DLCnfd := false;
    end;
  end
  else if ( G.Bar > -1 ) and LastPositionActive then
    ManageGhostStop( Bar )
  else if not LastPositionActive and ( C > @HCSer[Bar-1] ) then
    BuyAtMarket( Bar + 1, '100-bar breakout' );
end;
PlotSeriesLabel( DHSer, 0, #Blue, #Thin, 'Darvas Highs' );
PlotSeriesLabel( DLSer, 0, #Red, #Thin, 'Darvas Lows' );
PlotSeriesLabel( HCSer, 0, #Black, #Dotted, 'Highest(#Close, 100)' );
HideVolume;


--Robert Sucher
www.wealth-lab.com


GO BACK


AMIBROKER: MODIFIED DARVAS TECHNIQUE

In "Something Darvas, Something New: Modifying The Darvas Technique For Today's Markets" in this issue, Daryl Guppy presents a modified version of the Darvas trading technique, which was introduced in the 1960s. Implementing the required calculations in AmiBroker Formula Language (AFL) is straightforward. Ready-to-use Darvas formulas for AmiBroker are presented in Listing 1.
 

LISTING 1
Periods = 100;
function DarvasHigh( Periods )
{
 HHVtemp = HHV( High, Periods );
 result = HHVTemp;
 for( i = Periods + 4; i < BarCount; i++ )
 {
   result[ i ] = IIf( H[ i - 3 ] >= HHVTemp[ i - 4 ] AND
                     H[ i - 3 ] > H[ i - 2 ] AND
                     H[ i - 3 ] > H[ i - 1 ] AND
                     H[ i - 3 ] > H[ i ],
                     H[ i - 3 ],
                     result[ i - 1 ] );
 }
 return result;
}
function NewDarvasHigh( Periods )
{
  dh = DarvasHigh( Periods );
  return dh AND Nz( dh ) != Ref( Nz( dh ), -1 );
}
function NewDarvasLow( Periods )
{
  dh = DarvasHigh( Periods );
  ndl = Ref( L, -3 ) < Ref( L, -2 ) AND
        Ref( L, -3 ) < Ref( L, -1 ) AND
        Ref( L, -3 ) < L AND
        Ref( H, -2 ) < dh AND
        Ref( H, -1 ) < dh AND
        H < dh;
  return Nz( ndl ) AND Ref( Nz( ndl ), -1 ) < 1;
}
function DarvasLow( Periods )
{
  return ValueWhen( NewDarvasLow( Periods ), Ref( L, -3 ) );
}
function DarvasBoxEnd( Periods )
{
 end = BarsSince( NewDarvasHigh( Periods ) ) <
       BarsSince( Ref( NewDarvasLow( Periods ), -1 ) );
 return Nz( end ) AND NewDarvasLow( Periods );
}
function DarvasBoxHigh( Periods )
{
 dbe = DarvasBoxEnd( Periods );
 dbhi = ValueWhen( Nz( dbe ) AND NOT IsNull( Ref( dbe, -1 )),
       DarvasHigh(       Periods ) );
 return IIf( Nz( dbhi ) == 0, H + 1e-6, dbhi );
}
function DarvasBoxLow( Periods )
{
 dbe = DarvasBoxEnd( Periods );
 dblo = ValueWhen( Nz( dbe ) AND NOT IsNull( Ref( dbe, -1 ),
        DarvasLow( Periods ) );
 return IIf( Nz( dblo ) == 0, L - 1e-6, dblo );
}
function DarvasPossSell( Periods )
{
 dsl = Low < DarvasBoxLow( Periods );
 return Nz( dsl ) AND Ref( Nz( dsl ), -1 ) < Nz( dsl );
}
Plot( C, "Price", colorBlack, styleCandle );
Plot( DarvasLow( 100 ), "DL", colorRed );
Plot( DarvasHigh( 100 ), "DH", colorGreen );
--Tomasz Janeczko, AmiBroker.com
www.amibroker.com


GO BACK


eSIGNAL: MODIFIED DARVAS TECHNIQUE

For this month's article by Daryl Guppy, "Something Darvas, Something New: Modifying The Darvas Technique For Today's Markets," we've provided the indicator code "DarvasBox.efs," which is available from the eSignal website or the STOCKS & COMMODITIES website.

The study has options to configure the number of bars required to define the Darvas Box via the Edit Studies option (Chart Options-->Edit Studies). The study is configured for daily or intraday intervals. For daily charts, the formula only uses the second parameter ( "High Periods(Months): DWM" ) and is based on monthly highs. The default is set to look for a six-month high. The chart example provided is using a one-month high. For intraday charts, the formula uses the first parameter, which is based on the specified number of bars for the chart's interval. On intraday charts, the study will also give audible alerts when a bar closes above or below a Darvas box or below a ghost box. The Darvas and ghost boxes appear in blue and green, respectively.

FIGURE 3: eSIGNAL, MODIFIED DARVAS TECHNIQUE. This sample chart uses a one-month high. The Darvas and ghost boxes appear in blue and green, respectively.


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 www.esignalcentral.com.

--Jason Keck
eSignal, a division of Interactive Data Corp.
800 815-8256, www.esignalcentral.com


GO BACK


NEUROSHELL TRADER: MODIFIED DARVAS TECHNIQUE

The Darvas formulas described by Daryl Guppy can be easily implemented in NeuroShell Trader by combining a few of the NeuroShell Trader's 800+ indicators. To implement the Darvas formulas, select "New Indicator..." from the Insert menu and use the Indicator Wizard to create the following indicators:
 

DHCOND:
AND2(A>=B(Lag(High,3), Lag(HighPrice(High,PERIODS),4), A>B(Lag(High,3), HighPrice(High,3))
DARVAS HIGH:
SelectiveMovAvg(Lag(High,3), DHCOND, 1)
DLPOSS:
AND2(A<B(Lag(Low,3), LowPrice(Low,3)), A<B(HighPrice(High,3), DARVASHIGH))
DLCOND*:
AND2( DLPOSS, BarsSince(DHCOND) < Lag(BarsSince(DLPOSS) )
DARVAS LOW:
SelectiveAvg( Lag(Low,3), DLCOND )
DARVAS BOX ACTIVE*:
A<B( BarsSince(DLCOND), BarsSince(CrossBelow(Low, DARVASLOW))
DARVAS BOX HIGH:
If (DARVASBOXACTIVE, SelectiveAvg(DARVASHIGH, DLCOND,1), *)
DARVAS BOX LOW:
If (DARVASBOXACTIVE, DARVASLOW, *)
*Note: the BarsSince(COND) indicator is created as follows:
Subtract(CumulativeSum(Add2(1,0),0), SelectiveAvg(CumulativeSum(Add2(1,0),0), COND, 1) )
FIGURE 4: NEUROSHELL, MODIFIED DARVAS TECHNIQUE. Here is a sample NeuroShell chart applying the Darvas trading system.


To create a Darvis trading system, select "New Trading Strategy ..." from the Insert menu and enter the following entry and exit conditions in the appropriate locations of the Trading Strategy Wizard:

Generate a buy long MARKET order if ALL of the following are true:
 CrossAbove ( DARVIS BOX HIGH )

Generate a Trailing Stop Order at the following price level:

 DARVIS BOX LOW

If you have NeuroShell Trader Professional, you can also choose whether the Darvas periods should be optimized. After backtesting the trading strategy, use the "Detailed Analysis ..." button to view the backtest and trade-by-trade statistics for this Darvas trading system.

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


GO BACK


NEOTICKER: MODIFIED DARVAS TECHNIQUE

To implement in NeoTicker the indicators discussed in "Something Darvas, Something New" by Daryl Guppy, formula language is the tool of choice. The code is listed in same order as shown in the sidebar in Guppy's article: Darvas High (Listing 1), New Darvas High (Listing 2), New Darvas Low (Listing 3), Darvas Low (Listing 4), Darvas Box End (Listing 5), Darvas Box High (Listing 6), Darvas Box Low (Listing 7), Darvas Poss Sell (Listing 8), Darvas Sell (Listing 9), Darvas Buy (Listing 10).

To mark the buy and sell signals with up and down arrows, two additional indicators are required: up arrow on buy (Listing 11) will draw an up arrow at the low when Darvas Buy is greater than 1, down arrow on sell (Listing 12) will draw a down arrow at the high when Darvas Sell is greater than 1.

 Next, use a color plot formula to mark bullish and bearish trends on the chart. To add a color plot formula, right-click on the data series and select "Add Indicator" from the popup menu. At the Parameter tab of the "Add Indicator" window, add the formula "c >= dvboxlow(data1)" into the formula field; change color 1 to green for bullish; change color 2 to red for bearish. The result is a chart with a pane that draws a colored histogram (Figure 5).
 
 

FIGURE 5: NEOTICKER, MODIFIED DARVAS TECHNIQUE


A downloadable version of all the indicators and a sample chart will be available from the NeoTicker Yahoo! user group.
 

LISTING 1
dh := if((h(3) > hhv(4, h, param1)) and (h(3) > h(2)) and
         (h(3) > h(1)) and (h(3) > h), h(3), dh(1));
plot1 := dh;
LISTING 2
dh := dvhigh(data1, 100);
def := valid (dh, 0) > 0 and valid(dh, 2) > 0;
plot1 := if(def>0 and def(1)=0, 1, 0)+if(dh>0 and dh(1)<>dh, 1, 0);
LISTING 3
dh  := dvhigh(data1, 100);
ndl := (l(3) < l(2)) and (l(3) < l(1)) and (l(3) < l) and
       (h(2) < dh) and (h(1) < dh) and (h < dh);
def := (valid(dh, 0) > 0) and (valid (dh, 1) > 0);
plot1 := if(def > 0 and def(1) = 0, 1, 0) +if(ndl > 0 and ndl(1) < 1, 1, 0);
LISTING 4
mydl := if(ndvlow(data1) > 0, l(3), mydl(1));
plot1 := mydl;
LISTING 5
end := barssince(data1, "ndvhigh(data1) > 0") <
       barssince(data1, "ndvlow(1, data1) > 0");
def := valid(end, 0) > 0 and valid(end, 1) < 1;
plot1 := if(def > 0 and def(1)=0, 1, 0) +if(end > 0 and ndvlow(data1) > 0, 1, 0);
LISTING 6
dbe := dvboxe(data1);
dbhi := if(dbe>0 and valid(dbe,1)>0, dvhigh(data1, 100), dbhi(1));
plot1 := if(dbhi=0, h+0.0000001, dbhi);
LISTING 7
dbe := dvboxe(data1);
bl := if (dbe > 0 and valid (dbe, 1) > 0, dvlow(data1), bl(1));
plot1 := if(bl=0, l-0.0000001, bl);
LISTING 8
dsl := l < dvboxlow(data1);
def := valid(dsl, 0) > 0 and valid(dsl, 1) > 0;
plot1 := if(def > 0 and def(1)=0, 1, 0)+if(dsl > 0 and dsl(1)<dsl, 1, 0);
LISTING 9
mysell := barssince(data1, "dvboxe(data1) > 0") <
          barssince(data1, "dvposssell(data1) > 0");
def := valid(mysell, 0) > 0 and valid(mysell, 1) > 0;
plot1 := if(def > 0 and def(1)=0, 1, 0) +if(mysell=0 and mysell(1)=1, 1, 0);
LISTING 10
mydc := dvsell(data1);
mydb := c > dvboxhigh(data1) and
        barssince(data1, "dvboxe(data1)>0") <barssince(data1, "dvsell(data1)>0");
dto := if(mydb>0 and dto(1)=0, 1, if(mydc>0, 0, dto(1)));
plot1 := if (dto > 0 and dto(1)=0, 1, 0);
LISTING 11
plot1 := if(dvbuy(data1) > 0, l-0.01, 0);
success1 := if(dvbuy(data1) > 0, 1, 0);
LISTING 12
plot1 := if(dvsell(data1) > 0, h+0.01, 0);
success1 := if(dvsell(data1) > 0, 1, 0);


--Kenneth Yuen, TickQuest Inc.
www.tickquest.com


GO BACK


TECHNIFILTER PLUS: MODIFIED DARVAS TECHNIQUE

Visit the TechniFilter Plus website at www.technifilter.com or the STOCKS & COMMODITIES website at Traders.com to download TechniFilter code for the Darvas technique.

GO BACK


TRADINGSOLUTIONS: MODIFIED DARVAS TECHNIQUE

In his article in this issue, "Something Darvas, Something New: Modifying The Darvas Technique For Today's Markets," Daryl Guppy describes a system for trading Darvas-style indicators.

FIGURE 6: TRADINGSOLUTIONS, MODIFIED DARVAS TECHNIQUE. Here is a chart displaying the Darvas box system. You can see that it was effective during this uptrend.


This system can be entered into TradingSolutions as follows. This system is also available as a function file that can be downloaded from the TradingSolutions website (www.tradingsolutions.com) in the Solution Library section. As with many indicators, these functions could make good inputs to neural network predictions.
 

Name: Darvas High (D_High)
Inputs: High, Period (100)
If (And (GE (Lag (High,3),Lag (Highest (High, Period),4)),
 GT (Lag (High,3),Highest (High,3))),Lag (High,3),Prev (1))
Name: New Davras High Subvalue Def (NewD_HighSubDef)
Inputs: High, Period (100)
And (IsNotNull (D_High (High, Period)),
 IsNotNull (Lag (D_High (High, Period),2)))
Name: New Darvas High (NewD_High)
Inputs: High, Period (100)
Add (And (NewD_HighSubDef (High, Period),
 Not (Lag (NewD_HighSubDef (High, Period),1))),
 And (D_High (High, Period),Change (D_High (High, Period),1)))
Name: New Darvas Low Subvalue NDL (NewD_LowSubNDL)
Inputs: High, Low, Period (100)
And (LT (Lag (Low,3),Lowest (Low,3)),
 LT (Lowest (High,3),D_High (High, Period)))
Name: New Darvas Low Subvalue Def (NewD_LowSubDef)
Inputs: High, Period (100)
And (IsNotNull (D_High (High, Period)),
 IsNotNull (Lag (D_High (High, Period),1)))
Name: New Darvas Low (NewD_Low)
Inputs: High, Low, Period (100)
Add (And (NewD_LowSubDef (High, Period),
 Not (Lag (NewD_LowSubDef (High, Period),1))),
 And (NewD_LowSubNDL (High, Low, Period),
 LT (Lag (NewD_LowSubNDL (High, Low, Period),1),1)))
Name: Darvas Low (D_Low)
Inputs: High, Low, Period (100)
If (NewD_Low (High, Low, Period),Lag (Low,3),Prev (1))
Name: Darvas Box End Subvalue End (D_BoxEndSubEnd)
Inputs: High, Low, Period (100)
LT (BarsSinceUL (NewD_High (High, Period)),
 BarsSinceUL (Lag (NewD_Low (High, Low, Period),1)))
Name: Darvas Box End Subvalue Def (D_BoxEndSubDef)
Inputs: High, Low, Period (100)
And (IsNotNull (D_BoxEndSubEnd (High, Low, Period)),
 IsNull (Lag (D_BoxEndSubEnd (High, Low, Period),1)))
Name: Darvas Box End (D_BoxEnd)
Inputs: High, Low, Period (100)
Add (And (D_BoxEndSubDef (High, Low, Period),
 Not (Lag (D_BoxEndSubDef (High, Low, Period),1))),
 And (D_BoxEndSubEnd (High, Low, Period),
 NewD_Low (High, Low, Period)))
Name: Darvas Box High Subvalue DBHI (D_BoxHighSubDBHI)
Inputs: High, Low, Period (100)
If (And (D_BoxEnd (High, Low, Period),
 IsNotNull (Lag (D_BoxEnd (High, Low, Period),1))),
 D_High (High, Period),Prev (1))
Name: Darvas Box High (D_BoxHigh)
Inputs: High, Low, Period (100)
If (EQ (D_BoxHighSubDBHI (High, Low, Period),0),
 Add (High,0.0000001),D_BoxHighSubDBHI (High, Low, Period))
Name: Darvas Box Low Subvalue BL (D_BoxLowSubBL)
Inputs: High, Low, Period (100)
If (And (D_BoxEnd (High, Low, Period),
 IsNotNull (Lag (D_BoxEnd (High, Low, Period),1))),
 D_Low (High, Low, Period),Prev (1))
Name: Darvas Box Low (D_BoxLow)
Inputs: High, Low, Period (100)
If (EQ (D_BoxLowSubBL (High, Low, Period),0),
 Sub (Low,0.0000001),D_BoxLowSubBL (High, Low, Period))
Name: Darvas Poss Sell Subvalue DSL (D_PossSellSubDSL)
Inputs: High, Low, Period (100)
LT (Low,D_BoxLow (High, Low, Period)
Name: Darvas Poss Sell Subvalue Def (D_PossSellSubDef)
Inputs: High, Low, Period (100)
And (IsNotNull (D_PossSellSubDSL (High, Low, Period)),
 IsNotNull (Lag (D_PossSellSubDSL (High, Low, Period),1)))
Name: Darvas Poss Sell (D_PossSell)
Inputs: High, Low, Period (100)
Add (And (D_PossSellSubDef (High, Low, Period),
 Not (Lag (D_PossSellSubDef (High, Low, Period),1))),
 And (D_PossSellSubDSL (High, Low, Period),
 LT (Lag (D_PossSellSubDSL (High, Low, Period),1),
 D_PossSellSubDSL (High, Low, Period))))
Name: Darvas Sell Subvalue Sell (D_SellSubSell)
Inputs: High, Low, Period (100)
LT (BarsSinceUL (D_BoxEnd (High, Low, Period)),
 BarsSinceUL (D_PossSell (High, Low, Period)))
Name: Darvas Sell Subvalue Def (D_SellSubDef)
Inputs: High, Low, Period (100)
And (IsNotNull (D_SellSubSell (High, Low, Period)),
 IsNotNull (Lag (D_SellSubSell (High, Low, Period),1)))
Name: Darvas Sell (D_Sell)
Inputs: High, Low, Period (100)
Add (And (D_SellSubDef (High, Low, Period),
 Not (Lag (D_SellSubDef (High,Low, Period),1))),
 And (Not (D_SellSubSell (High, Low, Period)),
 Lag (D_SellSubSell (High, Low, Period),1)))
Name: Darvas Buy Subvalue DTO (D_BuySubDTO)
Inputs: Close, High, Low, Period (100)
If (And (And (GT (Close,D_BoxHigh (High, Low, Period)),
 LT (BarsSinceUL(D_BoxEnd (High, Low, Period)),
 BarsSinceUL (D_Sell (High, Low, Period)))),
 EQ (Prev (1),0)),1,If (D_Sell (High, Low, Period),0,Prev (1)))
Name: Darvas Buy (D_Buy)
Inputs: Close, High, Low, Period (100)
And (D_BuySubDTO (Close, High, Low, Period),
 EQ (Lag (D_BuySubDTO (Close,High, Low, Period),1),0))
Name: Darvas Box System
Inputs: Close, High, Low, Period (100)
Enter Long: D_Buy(Close, High, Low, Period)
Exit Long: D_Sell(High, Low, Period)
--Gary Geniesse, NeuroDimension, Inc.
800 634-3327, 352 377-5144
https://www.tradingsolutions.com
GO BACK

All rights reserved. © Copyright 2005, Technical Analysis, Inc.


Return to June 2005 Contents