[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] //MAMA & FAMA from ehlers.dll in new AB



PureBytes Links

Trading Reference Links


Hello,
 
I can not speak for Stefan, but I checked the VBScript version 
available from Member's area and it works fine. 
 

/* 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**/<FONT 
face="Courier New" color=#0000ff size=1>
EnableScript(<FONT 
face="Courier New" color=#ff00ff size=1>"VBScript"<FONT 
face="Courier New" size=1>);
FastLimit=<FONT face="Courier New" color=#ff00ff 
size=1>0.5;
SlowLimit=<FONT face="Courier New" color=#ff00ff 
size=1>0.05;
Price = (H+L)/<FONT face="Courier New" color=#ff00ff 
size=1>2;
Smooth = ( 4<FONT 
face="Courier New" size=1> * Price + <FONT face="Courier New" 
color=#ff00ff size=1>3 * <FONT 
face="Courier New" color=#0000ff size=1>Ref<FONT face="Courier New" 
size=1>( Price,-<FONT face="Courier New" color=#ff00ff 
size=1>1) + <FONT 
face="Courier New" color=#ff00ff size=1>2 
* Ref<FONT 
face="Courier New" size=1>(Price,-<FONT face="Courier New" color=#ff00ff 
size=1>2) + <FONT 
face="Courier New" color=#0000ff size=1>Ref<FONT face="Courier New" 
size=1>(Price,-<FONT face="Courier New" color=#ff00ff 
size=1>3))/<FONT 
face="Courier New" color=#ff00ff size=1>10<FONT face="Courier New" 
size=1>;
<%
Price = AFL(<FONT face="Courier New" color=#ff00ff 
size=1>"Price")
Smooth = AFL(<FONT face="Courier New" color=#ff00ff 
size=1>"Smooth")
nSize = UBound( Smooth )
' every Other Variable is an array Of the same size as smooth
' so just make A copy (quick init) 
Detrender = Smooth
II2 = Smooth
Q2 = Smooth
Re = Smooth
Im = Smooth
I1 = Smooth
Q1 = Smooth
jl = Smooth
jQ = Smooth
Phase = Smooth
DeltaPhase = Smooth
Period = Smooth
PI = <FONT face="Courier New" color=#ff00ff 
size=1>3.1415926
For i = 0<FONT 
face="Courier New" size=1> To nSize 
 
If i < 6<FONT 
face="Courier New" size=1> then 
' init previous values to avoid problems 
' with exp<FONT 
face="Courier New" size=1>. averaging of uninitialized values
' later
DeltaPhase( i ) = <FONT face="Courier New" color=#ff00ff 
size=1>0
II2( i ) = <FONT face="Courier New" color=#ff00ff 
size=1>1.0
Q2( i ) = <FONT face="Courier New" color=#ff00ff 
size=1>1.0
Re( i ) = <FONT face="Courier New" color=#ff00ff 
size=1>0
Im( i ) = <FONT face="Courier New" color=#ff00ff 
size=1>0
Period( i ) = <FONT face="Courier New" color=#ff00ff 
size=1>6
Else

factor = <FONT face="Courier New" color=#ff00ff 
size=1>0.075 * Period( i - <FONT 
face="Courier New" color=#ff00ff size=1>1 
) + 0.54<FONT 
face="Courier New" size=1>
Detrender( i ) = ( ( <FONT face="Courier New" color=#ff00ff 
size=1>0.0962 *Smooth( i ) + <FONT 
face="Courier New" color=#ff00ff size=1>0.5769<FONT face="Courier New" 
size=1> * Smooth( i - <FONT face="Courier New" color=#ff00ff 
size=1>2 ) _
- 0.5769<FONT 
face="Courier New" size=1> * Smooth( i - <FONT face="Courier New" 
color=#ff00ff size=1>4) - <FONT 
face="Courier New" color=#ff00ff size=1>0.0962<FONT face="Courier New" 
size=1> * Smooth( i - <FONT face="Courier New" color=#ff00ff 
size=1>6 ) ) * factor )
Q1( i ) = ( ( <FONT face="Courier New" color=#ff00ff 
size=1>0.0962 *Detrender( i ) + 
0.5769<FONT 
face="Courier New" size=1> * Detrender( i - <FONT face="Courier New" 
color=#ff00ff size=1>2 ) _
- 0.5769<FONT 
face="Courier New" size=1> * Detrender( i - <FONT face="Courier New" 
color=#ff00ff size=1>4) - <FONT 
face="Courier New" color=#ff00ff size=1>0.0962<FONT face="Courier New" 
size=1> * Detrender( i - <FONT face="Courier New" color=#ff00ff 
size=1>6 ) ) * factor )
I1( i ) = Detrender( i - <FONT face="Courier New" color=#ff00ff 
size=1>3 )
jl( i ) = ( ( <FONT face="Courier New" color=#ff00ff 
size=1>0.0962 *I1( i ) + <FONT 
face="Courier New" color=#ff00ff size=1>0.5769<FONT face="Courier New" 
size=1> * I1( i - <FONT face="Courier New" color=#ff00ff 
size=1>2 ) _
- 0.5769<FONT 
face="Courier New" size=1> * I1( i - <FONT face="Courier New" 
color=#ff00ff size=1>4) - <FONT 
face="Courier New" color=#ff00ff size=1>0.0962<FONT face="Courier New" 
size=1> * I1( i - <FONT face="Courier New" color=#ff00ff 
size=1>6 ) ) * factor )
jQ( i ) = ( ( <FONT face="Courier New" color=#ff00ff 
size=1>0.0962 *Q1( i ) + <FONT 
face="Courier New" color=#ff00ff size=1>0.5769<FONT face="Courier New" 
size=1> * Q1( i - <FONT face="Courier New" color=#ff00ff 
size=1>2 ) _
- 0.5769<FONT 
face="Courier New" size=1> * Q1( i - <FONT face="Courier New" 
color=#ff00ff size=1>4) - <FONT 
face="Courier New" color=#ff00ff size=1>0.0962<FONT face="Courier New" 
size=1> * Q1( i - <FONT face="Courier New" color=#ff00ff 
size=1>6 ) ) * factor )
II2( i ) = I1( i ) - jQ( i )
Q2( i ) = Q1( i ) + jl( i )
II2( i ) = <FONT face="Courier New" color=#ff00ff 
size=1>0.2 * II2( i ) + <FONT 
face="Courier New" color=#ff00ff size=1>0.8<FONT face="Courier New" 
size=1> * II2( i - <FONT face="Courier New" color=#ff00ff 
size=1>1 )
Q2( i ) = <FONT face="Courier New" color=#ff00ff 
size=1>0.2 * Q2( i ) + <FONT 
face="Courier New" color=#ff00ff size=1>0.8<FONT face="Courier New" 
size=1> * Q2( i - <FONT face="Courier New" color=#ff00ff 
size=1>1 )
Re( i ) = II2( i ) * II2( i - <FONT face="Courier New" color=#ff00ff 
size=1>1 ) + Q2( i ) * Q2( i - 
1<FONT 
face="Courier New" size=1> )
Im( i ) = II2( i ) * Q2( i - <FONT face="Courier New" color=#ff00ff 
size=1>1 ) - Q2( i ) * II2( i - 
1<FONT 
face="Courier New" size=1> )
Re( i ) = <FONT face="Courier New" color=#ff00ff 
size=1>0.2 * Re( i ) + <FONT 
face="Courier New" color=#ff00ff size=1>0.8<FONT face="Courier New" 
size=1> * Re( i - <FONT face="Courier New" color=#ff00ff 
size=1>1 )
Im( i ) = <FONT face="Courier New" color=#ff00ff 
size=1>0.2 * Im( i ) + <FONT 
face="Courier New" color=#ff00ff size=1>0.8<FONT face="Courier New" 
size=1> * Im( i - <FONT face="Courier New" color=#ff00ff 
size=1>1 )

Period( i ) = Period( i - <FONT face="Courier New" color=#ff00ff 
size=1>1) 
if ( Im( i ) <> <FONT face="Courier New" color=#ff00ff 
size=1>0 ) AND ( Re( i ) <> 
0<FONT 
face="Courier New" size=1> ) Then 
Period( i ) = (<FONT face="Courier New" color=#ff00ff 
size=1>2 * PI) / atn( Im( i ) / Re( i ) 
)
End If

if( Period( i ) > <FONT face="Courier New" color=#ff00ff 
size=1>1.5 * Period( i - <FONT 
face="Courier New" color=#ff00ff size=1>1 
) ) Then Period( i ) = <FONT face="Courier New" color=#ff00ff 
size=1>1.5 * Period( i - <FONT 
face="Courier New" color=#ff00ff size=1>1 
)
if( Period( i ) < <FONT face="Courier New" color=#ff00ff 
size=1>0.67 * Period( i - <FONT 
face="Courier New" color=#ff00ff size=1>1 
) ) Then Period( i ) = <FONT face="Courier New" color=#ff00ff 
size=1>0.67 * Period( i - <FONT 
face="Courier New" color=#ff00ff size=1>1 
)
if( Period( i ) < <FONT face="Courier New" color=#ff00ff 
size=1>6 ) Then Period( i ) = 
6<FONT 
face="Courier New" size=1>
if( Period( i ) > <FONT face="Courier New" color=#ff00ff 
size=1>50 ) Then Period( i ) = 
50<FONT 
face="Courier New" size=1>
Period( i ) = <FONT face="Courier New" color=#ff00ff 
size=1>0.2 * Period( i ) + <FONT 
face="Courier New" color=#ff00ff size=1>0.8<FONT face="Courier New" 
size=1> * Period( i - <FONT face="Courier New" color=#ff00ff 
size=1>1 )

if( I1( i ) <> <FONT face="Courier New" color=#ff00ff 
size=1>0 ) Then Phase( i ) = 
(180<FONT 
face="Courier New" size=1>/PI) * atn( Q1( i )/ I1( i ) )

DeltaPhase( i ) = Phase( i - <FONT face="Courier New" color=#ff00ff 
size=1>1 ) - Phase( i )

if( DeltaPhase( i ) < <FONT face="Courier New" color=#ff00ff 
size=1>1 ) Then DeltaPhase( i ) = 
1<FONT 
face="Courier New" size=1>
End If

Next 
AFL(<FONT face="Courier New" color=#ff00ff 
size=1>"DeltaPhase") = DeltaPhase
%>
DeltaPhase = DeltaPhase;
alpha = FastLimit/DeltaPhase;
alpha = Min<FONT 
face="Courier New" size=1>( alpha, FastLimit ); <FONT face="Courier New" 
color=#008000 size=1>// not more than fast limit<FONT 
face="Courier New" size=1>
alpha = Max<FONT 
face="Courier New" size=1>( alpha, SlowLimit ); <FONT face="Courier New" 
color=#008000 size=1>// not less than slow limit<FONT 
face="Courier New" size=1>
MAMA = AMA<FONT 
face="Courier New" size=1>( Price, alpha );
FAMA = AMA<FONT 
face="Courier New" size=1>( MAMA, <FONT face="Courier New" color=#ff00ff 
size=1>0.5 * alpha );
Graph0 = MAMA;
Graph1 = FAMA;
Graph2 = Close;
Graph2Style = <FONT face="Courier New" color=#ff00ff 
size=1>64;
Best regards,Tomasz 
Janeczkoamibroker.com
<BLOCKQUOTE 
>
----- Original Message ----- 
<DIV 
>From: 
Nurudin Kaba 

To: <A title=amibroker@xxxxxxxxxx 
href="">amibroker@xxxxxxxxxxxxxxx 
Sent: Sunday, July 28, 2002 12:36 
AM
Subject: RE: [amibroker] //MAMA & 
FAMA from ehlers.dll in new AB

I'm 
using Yahoo data...see the attached

<FONT face=Tahoma 
size=2>-----Original Message-----From: Stefan Bondorowicz 
[mailto:stefan@xxxx]Sent: Saturday, July 27, 2002 
12:24 PMTo: <A 
href="">amibroker@xxxxxxxxxxxxxxxSubject: 
RE: [amibroker] //MAMA & FAMA from ehlers.dll in new 
AB
<SPAN 
class=584322319-27072002>With QuickAFL disabled I have just displayedBDH 
correctly from my TC2000 database.
<SPAN 
class=584322319-27072002> 
<SPAN 
class=584322319-27072002>Stefan

<FONT face=Tahoma 
size=2>-----Original Message-----From: Nurudin Kaba 
[mailto:n.kaba@xxxx]Sent: 27 July 2002 
23:19To: amibroker@xxxxxxxxxxxxxxxSubject: RE: 
[amibroker] //MAMA & FAMA from ehlers.dll in new 
AB
<FONT face=Arial color=#0000ff 
size=2>It still has problems displaying the chart and the MAMA and FAMA 
lines for Exchange Traded Fund "BDH" and others...I'm using AB 
4.07.3
<FONT face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=2>Thanks

<FONT face=Tahoma 
size=2>-----Original Message-----From: Stefan Bondorowicz 
[mailto:stefan@xxxx]Sent: Saturday, July 27, 
2002 12:03 PMTo: amibroker@xxxxxxxxxxxxxxxSubject: 
RE: [amibroker] //MAMA & FAMA from ehlers.dll in new 
AB
<SPAN 
class=406390119-27072002>Hi
<SPAN 
class=406390119-27072002> 
<SPAN 
class=406390119-27072002>I have just had a look at it.  Makesure 
that you have Level 0 and middle set in indicator settings.  Also 
it looks as if you will have to deselect QuickAFL as with this enabled 
when moving between symbols the Level 0 seems to be 
lost.
<SPAN 
class=406390119-27072002> 
<SPAN 
class=406390119-27072002>Stefan

<FONT face=Tahoma 
size=2>-----Original Message-----From: Nurudin Kaba 
[mailto:n.kaba@xxxx]Sent: 27 July 2002 
22:33To: amibroker@xxxxxxxxxxxxxxxSubject: RE: 
[amibroker] //MAMA & FAMA from ehlers.dll in new 
AB
<FONT face=Arial color=#0000ff 
size=2>the elders.dll posted by ...there is a sample in the readme 
file...it works on some symbols but not others...

<FONT face=Tahoma 
size=2>-----Original Message-----From: Tomasz Janeczko 
[mailto:amibroker@xxxx]Sent: Saturday, July 27, 2002 
12:30 AMTo: amibroker@xxxxxxxxxxxxxxxSubject: 
Re: [amibroker] //MAMA & FAMA from ehlers.dll in new 
AB
Hello,
 
What formula are you using?
Try adding SetBarsRequired( 1000, 0 ); to your 
formula
Best regards,Tomasz Janeczkoamibroker.com
<BLOCKQUOTE 
>
----- Original Message ----- 
<DIV 
>From: 
Nurudin 
Kaba 
To: <A 
title=amibroker@xxxxxxxxxxxxxxx 
href="">amibroker@xxxxxxxxxx 

Sent: Saturday, July 27, 2002 
6:39 AM
Subject: RE: [amibroker] 
//MAMA & FAMA from ehlers.dll in new AB

<FONT face=Arial color=#0000ff 
size=2>Yup...but it does work on other stocks...just some will 
give you what you experienced...try other 
stocks...

<FONT 
face=Tahoma size=2>-----Original Message-----From: 
nkis22 [mailto:nkishor@xxxx]Sent: Friday, July 
26, 2002 4:41 PMTo: <A 
href="">amibroker@xxxxxxxxxxxxSubject: 
[amibroker] //MAMA & FAMA from ehlers.dll in new 
ABIn the most recent release of AB, my 
MAMA & FAMA fromehlers.dll don't work. There is no error 
but the chart looks"hung high in the ceiling"Any one 
else with the same 
problem?nandYour use of Yahoo! 
Groups is subject to the <A 
href="">Yahoo! Terms of 
Service. Your use of Yahoo! 
Groups is subject to the <A 
href="">Yahoo! Terms of 
Service. Your use of Yahoo! 
Groups is subject to the <A 
href="">Yahoo! Terms of 
Service. Your use of Yahoo! 
Groups is subject to the <A 
href="">Yahoo! Terms of 
Service. Your use of Yahoo!Groups 
is subject to the Yahoo! 
Terms of Service. Your use ofYahoo! 
Groups is subject to the <A 
href="">Yahoo! Terms of Service. 
Your use of Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service. 
Your 
use of Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service.