YOUSEFUL / DELPHI / COMPONENTS
TAtlasMacd
The three lines TAtlasIndicators.MACD returns.
Description
Each array is as long as the input. With periods 12, 26, 9, Line starts at index 25 and Signal and Histogram at index 33.
Members
| Member | Kind | What it does |
|---|---|---|
Line | field | EMA(Fast) minus EMA(Slow). |
Signal | field | EMA(Signal) of Line. |
Histogram | field | Line minus Signal. |
Fields
Line field
Line, Signal, Histogram: TArray<Double>;EMA(Fast) minus EMA(Slow).
Signal field
Line, Signal, Histogram: TArray<Double>;EMA(Signal) of Line.
Histogram field
Line, Signal, Histogram: TArray<Double>;Line minus Signal.
Examples
Is momentum rising?
True when the newest MACD histogram value is positive and larger than the one before.
uses System.Math, Atlas.FinIndicators;
function MomentumRising(const Closes: TArray<Double>): Boolean;
var
M: TAtlasMacd;
N: Integer;
begin
Result := False;
N := Length(Closes);
if N < 2 then Exit;
M := TAtlasIndicators.MACD(Closes, 12, 26, 9);
Result := not IsNan(M.Histogram[N - 2]) and (M.Histogram[N - 1] > 0) and (M.Histogram[N - 1] > M.Histogram[N - 2]);
end;