I-Q IFM

I-Q IFM

Type : Indicator, Name : I-Q IFM

Inputs: Price((H+L)/2);
Vars: Imult(.635),
Qmult (.338),
InPhase(0),
Quadrature(0),
count(0),
Re(0),
Im(0),
DeltaPhase(0),
InstPeriod(0),
Period(0);

If CurrentBar > 8 then begin
Value1 = Price — Price[7];
Inphase = 1.25*(Value1[4] — Imult*Value1[2]) + Imult*InPhase[3];
Quadrature = Value1[2] — Qmult*Value1 + Qmult*Quadrature[2];
Re = .2*(InPhase*InPhase[1] + Quadrature*Quadrature[1]) + .8*Re[1];
Im = .2*(InPhase*Quadrature[1] — InPhase[1]*Quadrature) + .8*Im[1];
If Re <> 0 then DeltaPhase = ArcTangent(Im/Re);

{Sum DeltaPhases to reach 360 degrees. The sum is the instantaneous period.}
InstPeriod = 0;
Value4 = 0;
For count = 0 to 50 begin
Value4 = Value4 + DeltaPhase[count];
If Value4 > 360 and InstPeriod = 0 then begin
InstPeriod = count;
end;
end;

{Resolve Instantaneous Period errors and smooth}
If InstPeriod = 0 then InstPeriod = InstPeriod[1];
Period = .25*InstPeriod + .75*Period[1];

Plot1(Period, «DC»);

end;

Николай Солабуто
Оцените автора
Николай Солабуто
Добавить комментарий