Darvas Box_code

Vragen en suggesties over Vesticode

Moderator: Perry

Darvas Box_code

Berichtdoor Jo » zo 21 nov 2004, 10:53

Hoi

Kan iemand helpen deze "Darvas Box_code" ?te vertalen naar Vesticode?


var BOXTOP, BOXBOTTOM: float;
var BOXBOTTOMDEF, BOXTOPDEF, BOXDEF, RESET, FIRST: boolean;
var BOXTOPCOUNT, BOXBOTCOUNT, BOXDAYS, LASTBOXBAR, BAR: integer;
BoxTop := 0.0;
BoxBottom := 0.0;
BoxTopCount := 0;
BoxBotCount := 0;
BoxBottomDef := False;
BoxTopDef := False;
BoxDef := False;
Reset := False;
first := true;
BoxDays := 2;
LastBoxBar := 0;

{**************************}
for Bar := 5 to BarCount() - 1 do
begin
If First = True then
?Begin
?BoxTop := PriceHigh(Bar);
?First := false;
?BoxTopCount := 0;
?BoxBotCount := 0;
?BoxBottomDef := False;
?BoxTopDef := False;
?LastBoxBar := Bar;
?End;

If BoxDef = False then
If PriceHigh(Bar) > BoxTop then
? Begin
? BoxTopCount := 0;
? BoxTop := PriceHigh(Bar);
{Resets BoxBotCount if New High is Made again}
? BoxBotCount := 0;
End;

If BoxDef = False then
If PriceHigh(Bar) <= BoxTop then
? Begin
? BoxTopCount := BoxTopCount + 1;
? End;

If BoxDef = False then
If BoxTopCount = BoxDays ?then
?If PriceHigh(Bar) <= BoxTop then
? Begin
? BoxTopDef := True;
? End;

if BoxDef = False then
If BoxTopDef = True then
?if BoxBottomDef = False then
? ?if BoxTopCount >= BoxDays+1 ?then
? Begin
? ? If BoxBotCount = 0 then
? ? ? ?Begin
? ? ? ?BoxBottom := PriceLow(Bar);
? ? ? ?End;

? ? If PriceLow(Bar) < BoxBottom then
? ? ? ?Begin
? ? ? ?BoxBotCount := 0;
? ? ? ?BoxBottom := PriceLow(Bar);
? ?End;

? ? If PriceLow(Bar) >= BoxBottom then
? ? ? ?Begin
? ? ? ?BoxBotCount := BoxBotCount + 1;
? ? ? ?End;

? ? If BoxBotCount = BoxDays+1 ?then
? ? ? ?Begin
? ? ? ?BoxBottomDef := True;
? ? ? End;
? End;

{test}
If BoxDef = False then
If BoxTopDef = True then
? ? ? Begin
? ? ? If PriceHigh(Bar) > BoxTop then
? ? ? ? ?Begin
? ? ? ? ?First := True;
? ? ? ? ?End;
? ? ? End;

If BoxDef = False then
If BoxBottomDef = True then
? If BoxTopDef = True then
? ? Begin
? ? BoxDef := True;
? ?BoxBottomDef := false;
? ?BoxTopDef := false;
? ?End;

{Darvas Box Defined}
If BoxDef = True then
? Begin
? DrawLine( Bar, BoxTop, LastBoxBar, ?BoxTop, 0, #Green, 2 );
? DrawLine( Bar, BoxBottom, LastBoxBar, ?BoxBottom, 0, #Red, 2 );

?If PriceHigh(Bar) > BoxTop then
? ? ?Begin
? ? ? BoxDef := False;
? ? ? DrawLine( LastBoxBar, BoxBottom, LastBoxBar, ?BoxTop, 0, #Green, 2 );
? ? ? DrawLine( Bar, BoxBottom, Bar, ?BoxTop, 0, #Green, 2 );
first := true;
BoxTop := PriceHigh(Bar);
End;

? If PriceLow(Bar) < BoxBottom then
? ? ?Begin
? ? ?BoxDef := False;
? ? ?DrawLine( LastBoxBar, BoxBottom, LastBoxBar, ?BoxTop, 0, #Red, 2 );
? ? ? DrawLine( Bar, BoxBottom, Bar, ?BoxTop, 0, #Red, 2 );
first := true;
BoxTop := PriceHigh(Bar);
? ?End;
End;

{second true}
If First = True then
?Begin
?BoxTop := PriceHigh(Bar);
?First := false;
?BoxTopCount := 1;
?BoxBotCount := 0;
?BoxBottomDef := False;
?BoxTopDef := False;
?LastBoxBar := Bar;
?End;
end;

Dank , ? ?Jo
Jo
 
Berichten: 44
Geregistreerd op: wo 07 jan 2004, 14:00

Darvas Box_code

Berichtdoor Paul M » zo 21 nov 2004, 16:28

Hoi Jo,

Een poging, Vestics kent volgens mij geen Drawline functie of een Drawbox functie.
Vandaar een gewone lijn.

var: BoxTop(0), BoxBottom(0);
var: BoxTopCount(0), BoxBotCount(0);
Boolean BoxBottomDef=false, BoxTopDef=false, BoxDef=false, Reset=false, First=false;
var: xBar(3), BoxDays(0),PlotvalueTop(0),PlotvalueBottom(0),xBarCount(0),ID(0);


if currentbar=1 then begin
?BoxTop := 0;
?BoxBottom := 0;
?BoxTopCount := 0;
?BoxBotCount := 0;
?BoxBottomDef := False;
?BoxTopDef := False;
?BoxDef := False;
?Reset := False;
?first := true;
?BoxDays := 2;
?xBarCount=0;
end;

{**************************}

xBarCount=xBarCount+1;
If First = True then Begin
?
?BoxTop := Highest(High,5);
?First := false;
?BoxTopCount := 0;
?BoxBotCount := 0;
?BoxBottomDef := False;
?BoxTopDef := False;
?xBarCount=0;
End;



If BoxDef = False and Highest(High,5) > BoxTop then Begin
? BoxTopCount := 0;
? BoxTop := Highest(High,5);

{Resets BoxBotCount if New High is Made again}
? BoxBotCount := 0;

End;

If BoxDef = False and Highest(High,5) <= BoxTop then Begin
? BoxTopCount := BoxTopCount + 1;
?
End;

If BoxDef = False and BoxTopCount = BoxDays ?and Highest(high,5) <= BoxTop then Begin
? BoxTopDef := True;
?
End;

If BoxDef = False and BoxTopDef = True and BoxBottomDef = False and BoxTopCount >= BoxDays+1 ?then Begin
? ? ? ?
? ? ? ?If BoxBotCount = 0 then Begin
? ? ? ?BoxBottom := Lowest(low,5);
? ? ? ?End;

? ? ? ?If Lowest(low,5) < BoxBottom then Begin
? ? ? ?BoxBotCount := 0;
? ? ? ?BoxBottom := Lowest(low,5);
? ? ? ?End;

? ? ? ?If Lowest(low,5) >= BoxBottom then Begin
? ? ? ?BoxBotCount := BoxBotCount + 1;
? ? ? ?End;

? ? ? ?If BoxBotCount = BoxDays+1 ?then Begin
? ? ? ?BoxBottomDef := True;
? ? ? ?
? ? ? ?End;
End;
If First = True then plot5(1,"true");
{test}

If BoxDef = False and BoxTopDef = True then Begin
? ? ? ? ?If Highest(high,5) > BoxTop then Begin
? ? ? ? ?First := True;
? ? ? ? ?End;
? ? ?
End;


If BoxDef = False and BoxBottomDef = True and BoxTopDef = True then Begin
? ? BoxDef := True;
? ?

? ? BoxBottomDef := false;
? ? BoxTopDef := false;


End;

{Darvas Box Defined}

If BoxDef = True ?then Begin
vars: xBarNo(0);
PlotvalueTop=BoxTop;
? ? PlotvalueBottom=BoxBottom;
? ?for xBarNo := 0 to (xBarCount-1) do ?Plot1[(xBarCount)-xBarNo] := PlotvalueTop;
? ?for xBarNo := 0 to (xBarCount-1) do ?Plot2[(xBarCount)-xBarNo] := PlotvalueBottom;

? ?plot1(PlotvalueTop,"BoxTop");
? ?plot2(PlotvalueBottom,"BoxBottom");
? ?
? ?


? ? ? If Highest(high,5) > BoxTop then Begin
? ? ?
? ? ? BoxDef := False;
? ? ? PlotvalueTop=_NA;
? ? ? PlotvalueBottom=_NA;
? ? ? first := true;
? ? ? BoxTop := Highest(high,5);
? ? ? End;

? ? ? If Lowest(low,5) < BoxBottom then Begin
? ? ? BoxDef := False;
? ? ? PlotvalueTop=_NA;
? ? ? PlotvalueBottom=_NA;
? ? ? first := true;
? ? ? BoxTop := Highest(high,5);
? ? ? End;
end
else begin
PlotvalueTop := _NA;
PlotvalueBottom :=_NA;

end;

{second true}

If First = True then
?Begin

?BoxTop := Highest(high,5);
?First := false;
?BoxTopCount := 1;
?BoxBotCount := 0;
?BoxBottomDef := False;
?BoxTopDef := False;
?xBarCount=0;
End;

Met vr gr,

Paul
Paul M
 
Berichten: 263
Geregistreerd op: vr 13 dec 2002, 23:21

Darvas Box_code

Berichtdoor Jo » zo 21 nov 2004, 19:15

Paul,


Hartelijk dank voor de snelle reactie.
Deze namiddag kreeg ik nog een code aangeboden met bijpassende grafiek, maar deze blijkt een andere weergave te geven, kan jij achterhalen hoe dit komt?

LowL:=If(Low=LLV(Low,5),Low,If(Ref(Low,-1)=LLV(Low,5),Ref(Low,-1), If(Ref(Low,-2)=LLV(Low,5),Ref(Low,-2),If(Ref(Low,-3)=LLV(Low,5),Ref(Low,-3), If(Ref(Low,-4)=LLV(Low,5),Ref(Low,-4),0)))));
NewH:=ValueWhen(1,High>Ref(HHV(High,5),-1),High);
box1:=HHV(High,3)<HHV(High,4);
box2:=ValueWhen(1,BarsSince(High>Ref(HHV(High,5),-1))=3 AND box1=true,NewH);
box3:=ValueWhen(1,BarsSince(High>Ref(HHV(High,5),-1))=3 AND box1=true,LowL);
TopBox:=box2;
BottomBox:=box3;
TopBox;
BottomBox;

Ht:=If(Cross(HHV(H,4)=Ref(H,-3),.9)=1,Ref(H,-3),PREV);
Top:=If(Ht>Ref(Ht,-1),Ht,PREV);
Lt:=If(Cross(HHV(H,4)=Ref(H,-3),.9)=1,L,PREV);
Bot:=If(Lt<Ref(Lt,-1),Lt,PREV);
Top;
Bot;


Dank ? Jo
Jo
 
Berichten: 44
Geregistreerd op: wo 07 jan 2004, 14:00

Darvas Box_code

Berichtdoor Paul M » ma 22 nov 2004, 11:41

Hoi Jo,

Vars:LowL(0),NHMRO(0),NewH(0),Box2(0),Box3(0),TopBox(0),BottomBox(0),Ht(0),Top(0),Lt(0),Bot(0),PlotvalueTop(0),PlotvalueBottom(0);

LowL=iff(low=lowest(low,5),low,
? ? iff(low[1]=lowest(low,5),low[1],
? ? iff(low[2]=lowest(low,5),low[2],
? ? iff(low[3]=lowest(low,5),low[3],
? ? iff(low[4]=lowest(low,5),low[4],0)))));

NHMRO=MRO(High>Highest(high[1],5),5,1);
NewH=high[NHMRO];

condition1=(highest(high,3))<(highest(high,4));
if NHMRO=3 and condition1 then Box2=NewH[NHMRO];
if NHMRO=3 and condition1 then Box3=LowL[NHMRO];

TopBox=Box2;
BottomBox=Box3;

if NHMRO=3 and condition1 then begin

vars: xBarNo(0);

PlotvalueTop=TopBox;
? ? PlotvalueBottom=BottomBox;
? ?for xBarNo := 0 to 3 do ?Plot1[xBarNo] := PlotvalueTop;
? ?for xBarNo := 0 to 3 do ?Plot2[xBarNo] := PlotvalueBottom;
end
else begin
PlotvalueTop := _NA;
PlotvalueBottom :=_NA;
end;

plot1(PlotvalueTop,"BoxTop");
plot2(PlotvalueBottom,"BoxBottom");


Paul
Paul M
 
Berichten: 263
Geregistreerd op: vr 13 dec 2002, 23:21


Keer terug naar Vesticode

Wie is er online

Gebruikers op dit forum: Geen geregistreerde gebruikers en 1 gast

cron