Ik zou zo graag de Williams Accumulation Distribution van het forum willen overnemen in Wallstreet maar hij staat nog nergens. Kunnen jullie deze programeren?
Ik heb gezien de dat deze indicator al eerder is aangevraagd, programeren lukt mij mij niet. Jullie zouden me een enorm plezier doen
Vriendelijke groet
Ad
Bij deze:Williams AD is a running sum of positive accumulation values (buying pressure) and negative distribution values (selling pressure), as determined by price's location within a given day's true range.
To calculate the Williams' Accumulation/Distribution indicator, determine:
True Range High (TRH) = Yesterday's close or today's high whichever is greater
True Range Low (TRL) = Yesterday's close or today's low whichever is less
The day's accumulation/distribution is then calculated by comparing today's closing price to yesterday's closing price.
If today's close is greater than yesterday's close: Today's A/D = today's close - TRL
If today's close is less than yesterday's close: Today's A/D = today's close - TRH
If today's close is the same as yesterday's close then the A/D is zero.
The Williams' Accumulation/Distribution indicator is a cumulative total of the daily values:
Williams A/D = Today's A/D + Yesterday's Williams A/D
Williams states it's worth selling if the price makes a new high and the indicator fails to follow suit. As well, it's better to purchase if prices fall to a new bottom yet the A/D indicator fails to reach a new low.
Code: Selecteer alles
{- Filename: Williams Acc-Dist -}
(*
Williams AD is a running sum of positive accumulation values (buying pressure) and negative distribution values (selling pressure), as determined by price's location within a given day's true range.
To calculate the Williams' Accumulation/Distribution indicator, determine:
True Range High (TRH) = Yesterday's close or today's high whichever is greater
True Range Low (TRL) = Yesterday's close or today's low whichever is less
The day's accumulation/distribution is then calculated by comparing today's closing price to yesterday's closing price.
If today's close is greater than yesterday's close: Today's A/D = today's close - TRL
If today's close is less than yesterday's close: Today's A/D = today's close - TRH
If today's close is the same as yesterday's close then the A/D is zero.
The Williams' Accumulation/Distribution indicator is a cumulative total of the daily values:
Williams A/D = Today's A/D + Yesterday's Williams A/D
Williams states it's worth selling if the price makes a new high and the indicator fails to follow suit. As well, it's better to purchase if prices fall to a new bottom yet the A/D indicator fails to reach a new low.
*)
var
i: integer;
AD, ADTotal: real;
sTRH, sTRL, sAD: TSeries;
begin
{ Indicator eigenschappen }
with Indicator do
begin
RequiredBars := 100; // Aantal benodigde koersen om eerste indicatorwaarde te berekenen
NewBand := true; // indicator standaard in nieuwe sectie plaatsen
ScaleRange := srAuto; // indicatorschaal automatisch
end;
{ Berekening }
sTRH := MaxSeries(ShiftSeries(Close, 1), High);
sTRL := MinSeries(ShiftSeries(Close, 1), Low);
sAD := CreateSeries(BarCount);
for i:=FirstValidIndex(Close)+1 to BarCount-1 do
begin
if Close[i] > Close[i-1] then
AD := Close[i] - sTRL[i]
else
if Close[i] < Close[i-1] then
AD := Close[i] - sTRH[i]
else
AD := 0;
ADTotal := ADTotal + AD;
sAD[i] := ADTotal;
end;
{ Weergave }
with CreateLine(sAD) do
begin
Name := 'Williams A/D';
Color := clLime;
end;
end.
Eric