Click here to Login





                                                   Darvas Box Indicator Old versus New?

  0

0
Marcus Schöppl
2014-11-10 15:26:28


Hello is AmibBroker Language very different from QS Language?

I wanna try

a) The New Version of Darvas Boxes from Darly Guppy

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 );

and

b) The Traditional Darvas Boxes. Someone here who can translate this Indicators?

Here is a very good description

http://www.swing-trade-stocks.com/trading-methods-darvas-trading.html


Darvas Box Code for AmiBroker

_SECTION_BEGIN("Darvas Box");

box1=0;
box2=0;
SetBarsRequired(10000,10000);
procedure fillDarvas(start,end,swap,top, bottom )
{
for ( j = start; j < end; j++)
{
if( box1[j] == swap)
box1[j]= top ;
else
box1[j]= bottom;

if(box2[j] == swap)
box2[j]= bottom ;
else
box2[j]= top;
}
}

BoxArr1 = 0;
BoxArr2 = 0;
StateArray = 0;
DBuy = 0;
DSell = 0;
TopArray = 0;
BotArray = 0;
tick=0;

BoxTop = High[0];
BoxBot = Low[0];
swap=0;
state = 0;
BoxStart = 0;

for (i=0; i<BarCount; i++)
{
if (state==5)
{
TopArray[i]=BoxTop;
BotArray[i]=BoxBot;
if (Low[i]<(BoxBot*(1-tick/100)) || High[i]>(BoxTop*(1+tick/100)))
{
fillDarvas(BoxStart,i,swap,BoxTop,BoxBot);

state = 1;
swap = !swap;
BoxTop = High[i];
BoxStart = i;
}
}
else
{
if (High[i]<BoxTop)
{
if ((state<3) || (Low[i]>BoxBot))
{
state++;
}
else
{
state=3;
}
if (state==3)
BoxBot=Low[i];
}
else
{
state=1;
BoxTop=High[i];
}
}
StateArray[i] = state;
}

fillDarvas(BoxStart,BarCount,swap,BoxTop,BoxBot);

Plot( box1, "" , 1 + statearray, styleThick);
Plot( box2, "" , 1 + statearray , styleThick);
_SECTION_END();

Thank you.

Marcus



QuantShare
2014-11-17 10:50:53

  0

Darvas Box Indicator
New Darvas Box - Darly Guppy





Darvas Box Indicator (by Brian Brown, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads Notes Report an item
New Darvas Box - Darly Guppy (by QuantShare, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads Notes Report an item

Marcus Schöppl
2014-11-17 12:10:38

  0

thank you very much vor helping. great quantshare team!!!


RaFab
2018-03-07 13:39:26

  0

Have you try it out ? The indicator doesn't work.


QuantShare
2018-03-08 03:30:59

  0

Which one you think doesn't work? Have you installed it?
Also, please let us know the error you got.



No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










QuantShare

Trading Items
Darvas Box Indicator
New Darvas Box - Darly Guppy
Technical Analysis Continuation Pattern: Ascending Triangle Indic...
Bull Bear Ratio - Stock Market Indicator
InSync Index - Consensus Trading Indicator

How-to Lessons
How to dynamically update the settings of an indicator
How to hide a trading indicator from a particular time frame
How to optimize an indicator in your trading system
How to create a moving average of an indicator
How to add a trading indicator to a chart

Related Forum Threads
Stock or industry relative strenght : Indicator or composite ?
"New messages only" check box
Custom Indicator
to write and execute an Indicator
Retrieving or storing previous indicator result.

Blog Posts
Create a stock index or a trading indicator using the composite t...
Backtesting chart patterns using the auto support and resistance ...
Detect chart patterns using the auto support/resistance indicator
How to create the advance/decline market breadth indicator
How to create a ratio indicator using QS Trading Software









QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.