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