PureBytes Links
Trading Reference Links
|
Thanks
Anthony...that was really Quick!!! The DLL version mentioned in the
code...where can this be found?
<FONT face=Arial color=#0000ff
size=2>
Thanks
again for your help.
<FONT face=Tahoma
size=2>-----Original Message-----From: Anthony Faragasso
[mailto:ajf1111@xxxx]Sent: Friday, July 12, 2002 7:04
PMTo: amibroker@xxxxxxxxxxxxxxxSubject: Re: [amibroker]
MAMA & FAMA indicators.../* MESA Adaptive Moving
Averages:** MAMA and FAMA**** From Stocks & Commodities
7/2001**** AFL implementation by Tomasz Janeczko, October
2001**** For faster operation please check DLL
version**/EnableScript("VBScript");FastLimit=0.5;SlowLimit=0.05;Price
= (H+L)/2;Smooth = ( 4 * Price + 3 * Ref( Price,-1) + 2 *
Ref(Price,-2) +Ref(Price,-3))/10;<%Price =
AFL("Price")Smooth = AFL("Smooth")nSize = UBound( Smooth )'
every Other Variable is an array Of the same size as smooth' so just make
A copy (quick init)Detrender = SmoothII2 = SmoothQ2 =
SmoothRe = SmoothIm = SmoothI1 = SmoothQ1 = Smoothjl =
SmoothjQ = SmoothPhase = SmoothDeltaPhase = SmoothPeriod =
SmoothPI = 3.1415926For i = 0 To nSizeIf i < 6
then ' init previous values to avoid problems ' with exp.
averaging of uninitialized values ' later DeltaPhase(i )
= 0 II2( i ) = 1.0 Q2( i ) = 1.0 Re( i ) =
0 Im( i ) = 0 Period( i ) = 6Else
factor = 0.075 * Period( i - 1 ) + 0.54
Detrender( i ) = ( ( 0.0962 *Smooth( i ) + 0.5769 * Smooth( i - 2 )
_
- 0.5769 * Smooth( i - 4) - 0.0962 * Smooth( i - 6) ) * factor
) Q1( i ) = ( ( 0.0962 *Detrender( i ) + 0.5769*
Detrender( i - 2 )
_
- 0.5769 * Detrender( i - 4) - 0.0962 * Detrender( i - 6 )) * factor
) I1( i ) = Detrender( i - 3 ) jl(
i ) = ( ( 0.0962 *I1( i ) + 0.5769 * I1( i - 2 )
_
- 0.5769 * I1( i - 4) - 0.0962 * I1( i - 6 ) ) * factor )
jQ( i ) = ( ( 0.0962 *Q1( i ) + 0.5769 * Q1( i - 2 )
_
- 0.5769 * Q1( i - 4) - 0.0962 * Q1( i - 6 ) ) * factor )
II2( i ) = I1( i ) - jQ( i ) Q2( i ) = Q1( i ) + jl( i
) II2( i ) = 0.2 * II2( i ) + 0.8 * II2( i - 1
) Q2( i ) = 0.2 * Q2( i ) + 0.8 * Q2( i - 1
) Re( i ) = II2( i ) * II2( i - 1 ) + Q2( i ) * Q2(i - 1
) Im( i ) = II2( i ) * Q2( i - 1 ) - Q2( i ) * II2( i -1
) Re( i ) = 0.2 * Re( i ) + 0.8 * Re( i - 1
) Im( i ) = 0.2 * Im( i ) + 0.8 * Im( i - 1
) Period( i ) = Period( i - 1) if (
Im( i ) <> 0 ) AND ( Re( i ) <> 0 ) Then Period( i ) =
(2 * PI) / atn( Im( i ) / Re( i ) ) End If
if( Period( i ) > 1.5 * Period( i - 1 ) ) Then Period( i ) = 1.5
*Period( i - 1 ) if( Period( i ) < 0.67 * Period( i - 1
) ) Then Period( i ) = 0.67 *Period( i - 1 ) if(
Period( i ) < 6 ) Then Period( i ) = 6 if( Period( i) >
50 ) Then Period( i ) = 50 Period( i ) = 0.2 * Period( i )
+ 0.8 * Period( i - 1 ) if( I1( i ) <> 0 ) Then
Phase( i ) = (180/PI) * atn( Q1( i )/ I1( i ))
DeltaPhase( i ) = Phase( i - 1 ) - Phase( i ) if(
DeltaPhase( i ) < 1 ) Then DeltaPhase( i ) = 1End
IfNextAFL("DeltaPhase") =
DeltaPhase%>DeltaPhase = DeltaPhase;alpha =
FastLimit/DeltaPhase;alpha = Min( alpha, FastLimit ); // not more than
fast limitalpha = Max( alpha, SlowLimit ); // not less than slow
limitMAMA = AMA( Price, alpha );FAMA = AMA( MAMA, 0.5 * alpha
);Graph0 = MAMA;Graph1 = FAMA;Graph2 = Close;Graph2Style =
64;nurudinkaba wrote:> Has anyone written AFL for
above...and would be willing to share?>>
Thanks>>>
Yahoo! Groups
Sponsor
[Image]
Click here to find your contact lenses!>> Your use of Yahoo!
Groups is subject to the Yahoo! Terms of Service.Your
use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
|