Darvas 'Number of Periods'.

Glenn

Experienced member
Messages
1,040
Likes
118
Firstly thanks to Iraj for admitting me to the throng. :)

The published Tradestation and Metastock routines (Guppy-style) both look at a previous number of price bars (e.g. 100, 200, 250).
However it is not clear what the use of this is for Intraday trading.
In the original Darvas model he was trading using Daily data and looking for breakouts from the years highs, which requires examination of the previous years data.
For intraday work it seems to me that the most recent or currently forming Box is the only one of interest in any timeframe, and that it's relationship to previous boxes and their upper/lower limits is irrelevant.

As I understand it, the VWAP strategy is looking for Box breakouts with low risk, as determined by price relative to VWAP and MPD's, and not by previous major turning points. So why look back 100 bars ?

...or have I missed the point ? :eek:

Glenn
 
It would depend when the box was formed. Also you may need to look back 100 bars to get a box on a 5 minute timeframe. The Guppy code needs to be modified as it is a "Long" only signal and it also needs converting from a Signal to an indicator to be able to be used in Radarscreen.


Paul
 
I've been experimenting with darvas boxes intra-day.

Obviously Grey1 is really the man to answer but

My interpretation is that Darvas looked for breakouts from 52 week high as his way of selecting strong or uptrending stocks within a daily timeframe. I suppose you could look for breakouts from a certain number of bars high in whatever your timeframe. Currently I am not taking this route but trying to find a reliable intra day method to determine strong stocks in an uptrending market day and vice versa on a weak day. I am applying Darvas to those stocks and using VWAP /MPD and MACCI to determine risk and exhaustion. ATR in the given timeframe to position size

My results are inconclusive so far but show some promising signs. At the moment I get rather too many signals at times and get whipsawed around a bit.

Gareth
 
Trader333 said:
It would depend when the box was formed. Also you may need to look back 100 bars to get a box on a 5 minute timeframe. The Guppy code needs to be modified as it is a "Long" only signal and it also needs converting from a Signal to an indicator to be able to be used in Radarscreen.


Paul
Thanks Paul
When Darvas is initially attached to a chart, then I suppose it all depends on whether you want to wait for the next Box to be formed or use the previous one as a starting point.
Once you have passed the 'initial conditions' stage then the previous boxes are irrelevant it seems to me. If that's the case it might save a bit of cpu too.

Yes, understood about the Guppy being Long only and needing converting thanks. And I saw the Radar when we visited Iraj, so know about that too.
Glenn
 
garethb said:
There is an ELD for an indicator for darvas boxes a few posts down this thread which I've based my code on so far

https://www.tradestation.com/Discus...x?Topic_ID=17485&SearchTerm=darvas&selMatch=1

Gareth
Hi

gareth, thnx for posting that link, but it needs to have username/password for that part of the forum. i'll appreciate if u could attach the code(ELD) to this forum, as non-users there can't access the thread at all. thank u.

Regards
......................................
Kako
 
Hi Kako, there are two versions in the thread, this is more recent one. I am just learning about this method so I can't say this coding is correct.

inputs:
ShowAll ( true ) ;

variables:
BoxTop ( 0 ) ,
BoxBtm ( 0 ) ,
Ctr ( 0 ) ,
BBD ( 0 ) ,
BBT ( 0 ) ,
EBD ( 0 ) ,
EBT ( 0 ) ,
TextId ( -1 ) ,
TopId ( -1 ) ,
TopIdP ( -1 ) ,
BtmId ( -1 ) ,
BtmIdP ( -1 ) ,
LSId ( -1 ) ,
LSIdP ( -1 ) ,
RSId ( -1 ) ,
RSIdP ( -1 ) ,
UpBand ( 0 ) ,
DnBand ( 0 ) ,
CurrState( 1 ) ,
HiFirst ( true ) ,
LoFirst ( false ) ,
State1 ( false ) ,
State2 ( false ) ,
State3 ( false ) ,
State4 ( false ) ,
State5 ( false ) ,
DrawBox ( false ) ,
ValidBox ( false ) ,
HadBreak ( false ) ,
NewBox ( false ) ;


if BarNumber = 1 then
begin
BoxTop = high ;
BoxBtm = low ;
State1 = true ;
BBD = date ;
BBT = time ;
end ;


if NewBox and high > UpBand then
begin
BBD = date ;
BBT = time ;
TL_SetEnd( TopId, BBD, BBT, UpBand ) ;
TL_SetEnd( BtmId, BBD, BBt, DnBand ) ;

RSIdP = RSId ;
RSId = TL_New( BBD, BBT, DnBand, BBD, BBT, UpBand ) ;

if ShowAll = false and RSIdP <> -1 then
TL_Delete( RSIdP ) ;

if HiFirst then
TL_SetColor( RSId, yellow )
else
TL_SetColor( RSId, magenta ) ;

NewBox = false ;
State1 = true ;
LoFirst = false ;
HiFirst = true ;
end ;

if NewBox and low < DnBand then
begin
BBD = date ;
BBT = time ;
TL_SetEnd( TopId, BBD, BBT, UpBand ) ;
TL_SetEnd( BtmId, BBD, BBt, DnBand ) ;

RSIdP = RSId ;
RSId = TL_New( BBD, BBT, DnBand, BBD, BBT, UpBand ) ;

if ShowAll = false and RSIdP <> -1 then
TL_Delete( RSIdP ) ;

if HiFirst then
TL_SetColor( RSId, yellow )
else
TL_SetColor( RSId, magenta ) ;

NewBox = false ;
State1 = true ;
HiFirst = false ;
LoFirst = true ;
end ;


if HiFirst then
begin
if State4 then
begin
if high > BoxTop then
begin
BoxTop = high ;
State1 = true ;
State4 = false ;
CurrState = 1 ;
end
else
begin
if low < BoxBtm then
begin
State4 = false ;
State3 = true ;
BoxBtm = low ;
CurrState = 3 ;
end
else
begin
State4 = false ;
State5 = true ;
CurrState = 5 ;
end ;
end ;
end ;

if State3 then
begin
if high > BoxTop then
begin
BoxTop = high ;
State1 = true ;
State3 = false ;
CurrState = 1 ;
end
else
begin
if low < BoxBtm then
begin
State3 = true ;
BoxBtm = low ;
CurrState = 3 ;
end
else
begin
State3 = false ;
State4 = true ;
CurrState = 4 ;
end ;
end ;
end ;

if State2 then
if high > BoxTop then
begin
BoxTop = high ;
State1 = true ;
State2 = false ;
CurrState = 1 ;
end
else
begin
State2 = false ;
State3 = true ;
BoxBtm = low ;
CurrState = 3 ;
end ;

if State1 then
if high > BoxTop then
begin
BoxTop = high ;
State1 = true ;
CurrState = 1 ;
end
else
begin
State1 = false ;
State2 = true ;
CurrState = 2 ;
end ;
end
else { Using LoFirst }
begin
if State4 then
begin
if low < BoxBtm then
begin
BoxBtm = low ;
State1 = true ;
State4 = false ;
CurrState = 1 ;
end
else
begin
if high > BoxTop then
begin
State3 = true ;
State4 = false ;
BoxTop = high ;
CurrState = 3 ;
end
else
begin
State4 = false ;
State5 = true ;
CurrState = 5 ;
end ;
end ;
end ;

if State3 then
begin
if low < BoxBtm then
begin
BoxBtm = low ;
State1 = true ;
State3 = false ;
CurrState = 1 ;
end
else
begin
if high > BoxTop then
begin
State3 = true ;
BoxTop = high ;
CurrState = 3 ;
end
else
begin
State3 = false ;
State4 = true ;
CurrState = 4 ;
end ;
end ;
end ;

if State2 then
if low < BoxBtm then
begin
Boxbtm = low ;
State1 = true ;
State2 = false ;
CurrState = 1 ;
end
else
begin
State2 = false ;
State3 = true ;
BoxTop = high ;
CurrState = 3 ;
end ;

if State1 then
if low < BoxBtm then
begin
BoxBtm = low ;
State1 = true ;
CurrState = 1 ;
end
else
begin
State1 = false ;
State2 = true ;
CurrState = 2 ;
end ;
end ; { END IF HIFIRST OR LOFIRST }

if State5 then
begin
DrawBox = true ;
EBD = date ;
EBT = time ;
end ;


if DrawBox then
begin
TopIdP = TopId ;
BtmIdP = BtmId ;
LSIdP = LSId ;

TopId = TL_New( BBD, BBT, BoxTop, EBD, EBT, BoxTop ) ;
BtmId = TL_New( BBD, BBT, BoxBtm, EBD, EBT, BoxBtm ) ;
LSId = TL_New( BBD, BBT, BoxBtm, BBD, BBT, BoxTop ) ;

if ShowAll = false then
begin
if TopIdP <> -1 then
TL_Delete( TopIdP ) ;
if BtmIdP <> -1 then
TL_Delete( BtmIdP ) ;
if LSIdP <> -1 then
TL_Delete( LSidP ) ;

end ;

if HiFirst then
begin
TL_SetColor( TopId, yellow ) ;
TL_SetColor( BtmId, yellow ) ;
TL_SetColor( LSId, yellow ) ;
end
else
begin
TL_SetColor( TopId, magenta ) ;
TL_SetColor( BtmId, magenta ) ;
TL_SetColor( LSId, magenta ) ;
end ;

State1 = false ;
State2 = false ;
State3 = false ;
State4 = false ;
State5 = false ;
DrawBox = false ;
ValidBox = true ;
end ;


if ValidBox then
begin
UpBand = BoxTop ;
DnBand = BoxBtm ;
ValidBox = false ;
NewBox = true ;
BoxTop = high ;
BoxBtm = low ;
end ;



{
if HiFirst then
TextId = Text_New( date, time, high * 1.002, NumToStr( CurrState, 0 ) )
else
TextId = Text_New( date, time, low * .998 , NumToStr( CurrState, 0 ) ) ;
}
 
Top