75(1'/,1('//
7+,63/8*,13/276$9$,/$%/(75(1'/,1(621/<)25/$679$/8(2)'$7$
7+(<&$1%(86(')25(;3/25$7,21
127)25%$&.7(67,1*
The Plugin takes four parameters
scTrendLine
(
HQGYDO,VWDUWYDO,endbar,startbar);
EndBar is the oldest barssince
StartBar is the recent barssince
Endval is the array value of the endbar
Startval is the array value of the startbar
(;$03/(
Plot
(
&ORVH,
""
,
1
,
64
);
start=
HHVBars
(
+,
20
);
end=
HHVBars
(
+,
100
);
LineSup =
scTrendLine
(
+,+,end,start);
Plot
( LineSup ,
""
,
5
,
1
);
start=
LLVBars
(
/,
20
);
end=
LLVBars
(
/,
100
);
LineInf=
scTrendLine
(
/,/,end,start);
Plot
( LineInf ,
""
,
4
,
1
);
(;$03/((;3/25$7,2172),1'75,$1*/(6
Plot
(
&ORVH,
""
,
1
,
64
);
start= (
PeakBars
(
+,
7
,
1
));
end= (
PeakBars
(
+,
7
,
2
));
LineSup =
scTrendLine
(
+,+,end,start);
Plot
( LineSup ,
""
,
5
,
1
);
start= (
TroughBars
(
/,
7
,
1
));
end= (
TroughBars
(
/,
7
,
2
));
LineInf=
scTrendLine
(
/,/,end,start);
Plot
( LineInf ,
""
,
4
,
1
);
)LOWHU = (LineSup-
Ref
(Linesup,-
1
)) <=
0
$1'
(Lineinf-
Ref
(Lineinf,-
1
)) >=
0
$1' LineSup>LineInf;
AddColumn
(
IIf
(
&>LineInf $1' &<LineSup,
1
,
0
),
"Triangle"
);
AddColumn
(
IIf
(
&<LineInf 25 &>LineSup,
1
,
0
),
"Breakout"
);
(;$03/((;3/25$7,2172),1'',9(5*(1&(
You can use the
scTrendLine
(
HQGYDO,VWDUWYDO,endbar,startbar);
with any indicator and try to find divergence with the close
start=
LLVBars
(
/,
20
);
end=
LLVBars
(
/,
100
);
LineInf =
scTrendLine
(
/,/,end,start);
I=
OBV
();
start=
LLVBars
(I,
20
);
end=
LLVBars
(I,
100
);
LineI =
scTrendLine
(I,I,end,start);
)LOWHU = (LineI-
Ref
(LineI,-
1
)) >
0
$1'
(Lineinf-
Ref
(Lineinf,-
1
)) <=
0
;
AddColumn
(
IIf
(
&>LineInf,
1
,
0
),
"Divergence"
);
=,*=$*RQ+,*+/2:
these dll plot a zigzag line on HIGH LOW based on a percentage or points changes
this zigzag does not look in the future only for the last bars, so the zigzag line is not
drawn until the correct % ( or points) is reached
the dll takes one parameter, the value of change
the zigzag line is based on a percentage, for example 4 for 4% change
or the zigzag line is based on a point change , for example 3* ATR(3)
IRUSHUFHQWDJHFKDQJHWKHGOOLVFDOOHG
scZigHiLo
(
percentage change
)
IRUSRLQWVFKDQJHWKHGOOLVFDOOHG
scZigHiLoP
(
point change
)
(;$03/(
Plot
(
scZigHiLo
(
7
) ,
""
,
FRORU%OXH,
1
); // 7 % of change
Plot
(
&ORVH,
""
,
1
,
64
);
Plot
(
scZigHiLoP
(
3
*
ATR
(
3
)),
""
,
FRORU%OXH,
1
); // 3*atr(3) of change
Plot
(
&ORVH,
""
,
1
,
64
);
'$59$6%2;
First thanks to Jonf who has written the js code for the Darvas Box.
The plugin is
Darvas
(); it takes no parameters.
A better explanation of the construction of the Darvas Box is available at:
1)
<http://www.gerryco.com/tech/darvas.html>
2)
<http://www.wealth-lab.com/cgi-bin/WealthLab.DLL/editsystem?id=2814>
A dll must return one statement , in the case of the darvas.dll, the function
Darvas() alone returns the stateArray
but you can also extract other statements from the dll
For example at the end of the source code of darvas.dll there are
gSite.SetVariable( "BotArray", BotArray );
gSite.SetVariable( "TopArray", TopArray );
gSite.SetVariable( "DBuy", DBuy );
gSite.SetVariable( "DSell", DSell );
gSite.SetVariable( "BoxArr1", BoxArr1 );
gSite.SetVariable( "BoxArr2", BoxArr2 );
gSite.SetVariable( "StateArray", StateArray );
return StateArray;
All of these statements can be given by the plugin.
You can visualize the box with the following code.
D=
Darvas
();
Plot
(
&,
""
,
1
,
64
);
Plot
(Boxarr1,
""
,D,
512
);
Plot
(Boxarr2,
""
,D,
512
);
Plot
(dbuy*
&,
""
,
5
,
2
);
Plot
(dsell*
&,
""
,
4
,
2
);
7LWOH=
"Darvas dll"
;
Note that a box is valid when the state is 5. The color allows you to see the valid box .
The Botarray and Toparray are the valid Bot and Top
'VHOODQG'EX\DUHWKHVLJQDOVZKHQD/RZLVEHORZWKH%RW$UUD\RUD+LJKDERYHWKH7RS$UUD\
'DUYDV forms "boxes" based on his studies of price actions.
1) Step1=If PriceHigh stops making new highs for 3 days, make the PriceHigh 3 days ago the BoxTop and
go to Step 2.
2) Step2= If PriceHigh breaks BoxTop, go back to Step 1. Otherwise, If PriceLow stops making new lows
for 3 days then Make the PriceLow the BoxBottom and go to Step 3.
3) Step3=Now that the BoxTop and BoxBottom are formed, we have a Darvas Box. The Darvas Box is
broken when today’s PriceHigh or PriceLow breaks BoxTop or BoxBottom.
7KH'DUYDV%R[LVEDVHGRQ6WDWHVDQGVWHSVWRIRUPWKHER[
7KHUHLVDSOXJLQWKDWDOORZXVWRFKDQJHWKHQXPEHURIVWHSVDQGWKDWJLYHVXVWKHSRVVLELOLW\WR
DGGDWLFNIRUWKH%UHDNRXWRI+LJKDERYH7RS$UUD\25/RZEHORZWKH%RW$UUD\
7KHQDPHLV
DarvasT
( ); the default value gives the
Darvas
( );
These default values are
DarvasT
(
3
,
0
);
You can modify them
For example:
D=
DarvasT
(
4
,
0.01
);
Plot
(&,
""
,
1
,
64
);
Plot
(Boxarr1,
""
,D,
512
);
Plot
(Boxarr2,
""
,D,
512
);
Plot
(dbuy*&,
""
,
5
,
2
);
Plot
(dsell*&,
""
,
4
,
2
);
7LWOH=
"Darvas dll"
;
,QYHUVH'$59$6%2;
Note the Darvas Box may be used to take a LONG position;
also in the plugin there is an Inverse Darvas Box for SHORT positions
You can visualize it with:
D=
InvDarvas
();
Plot
(
&,
""
,
1
,
64
);
Plot
(Boxarr1,
""
,D,
512
);
Plot
(Boxarr2,
""
,D,
512
);
Plot
(dshort*
&,
""
,
5
,
2
);
Plot
(dcover*
&,
""
,
4
,
2
);
7LWOH=
"Inv Darvas dll"
;
'VHOODQG'EX\DUHWKHVLJQDOVZKHQD/RZLVEHORZWKH%RW$UUD\RUD+LJKDERYHWKH7RS$UUD\
'$59$6%2;RQ$55$<
you can also built any DarvasBox on Any indicators with the plugin
DarvasA
(
Array
);
for example on the
AccDist
().
Plot
(
AccDist
(),
""
,
1
,
1
);
D=
DarvasA
(
AccDist
() );
Plot
(Boxarr1,
""
,D,
512
);
Plot
(Boxarr2,
""
,D,
512
);
Plot
(dbuy*
&,
""
,
5
,
2
);
Plot
(dsell*
&,
""
,
4
,
2
);
7LWOH=
"Darvas dll"
;
An other example with CLOSE +++
Plot
(
&ORVH,
""
,
1
,
64
);
D=
DarvasA
(
&);
Plot
(Boxarr1,
""
,D,
512
);
Plot
(Boxarr2,
""
,D,
512
);
Plot
(dbuy*
&,
""
,
5
,
2
);
Plot
(dsell*
&,
""
,
4
,
2
);
7LWOH=
"Darvas dll"
;
And if you want you can add one parameter at Darvas Array
it is the tick to get a Breakout (BO default is zero)
for example
Plot
(
&ORVH,
""
,
1
,
64
);
D=
DarvasA
(
&,
0.01
); means that you need a BO of 1% above or below the box to get a buy or sell signal
'VHOODQG'EX\DUHWKHVLJQDOVZKHQD&/26(LVEHORZWKH%RW$UUD\RUD&/26(DERYHWKH7RS$UUD\
The same thing is possible with Inverse Darvas BOX
Example
D=
InvDarvasA
(
&,
0.01
);
Plot
(
&,
""
,
1
,
64
);
Plot
(Boxarr1,
""
,D,
512
);
Plot
(Boxarr2,
""
,D,
512
);
Plot
(dshort*
&,
""
,
FRORU5HG,
2
);
Plot
(dcover*
&,
""
,
FRORU*UHHQ,
2
);
7LWOH=
"Darvas dll"
;