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

Re: [amibroker] Fibonacci



PureBytes Links

Trading Reference Links

Hi ....
 
 I have Commented two lines of code.... Now the Afl shall give the desired result...
 

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////

_SECTION_BEGIN

("Fibonacci");

//Date: 12-January 2002 by Thomas Zmuck

//thomas.zm@aon.at

Offset =

5; //use two sheets: one with 5 and another with 7, or maybe other offset value

Avgmov = Offset*

MA(abs(ROC(C,1)),20);

per =

LastValue(Avgmov);

x=

Cum(1); Range = 0.01;

PS =

TroughBars(L,per,1) == 0;

xa =

LastValue(ValueWhen(PS,x,1));//x from last trough

Ya =

LastValue(ValueWhen(PS,L,1));//y (Low) last trough

PR =

PeakBars(H,per,1) == 0;

xb =

LastValue(ValueWhen(PR,x,1));//x from last peak

Yb =

LastValue(ValueWhen(PR,H,1));//y (High) last peak

Trough_ReTest =

abs((L/ya)-1)<Range;

Peak_ReTest =

abs((H/yb)-1)<Range;

Trough_Cross =

Cross(ya,C);

Peak_Cross =

Cross(C,yb);

//UP = upSwing DN = downSwing

UP = xb>xa;

//upSwing

DN = xa>xb;

//DownSwing

RT23_6 =

IIf(UP,yb-(yb-ya)*0.236,IIf(DN,ya+(yb-ya)*0.236,-1e10));

RT38_2 =

IIf(UP,yb-(yb-ya)*0.382,IIf(DN,ya+(yb-ya)*0.382,-1e10));

RT50_0 =

IIf(UP,yb-(yb-ya)*0.500,IIf(DN,ya+(yb-ya)*0.500,-1e10));

RT61_8 =

IIf(UP,yb-(yb-ya)*0.618,IIf(DN,ya+(yb-ya)*0.618,-1e10));

RT78_6 =

IIf(UP,yb-(yb-ya)*0.786,IIf(DN,ya+(yb-ya)*0.786,-1e10));

RT=

IIf

(UP,-100*(yb-L)/(yb-ya),

100

*(H-ya)/(yb-ya));//Retracement_Value

InZone = C<yb & C>ya;

//use it for filter to receive only signals that are in in the Retracement zone.

Buy

= Trough_ReTest OR peak_Cross;

Sell

= Peak_ReTest OR trough_Cross;

Filter

= 1;

AddColumn

(RT,"RT%");

AddColumn

(Trough_ReTest,"TR-Test",1.0);

AddColumn

(Peak_ReTest,"PK-Test",1.0);

AddColumn

(Trough_Cross,"TR-Cross",1.0);

AddColumn

(Peak_Cross,"PK-Cross",1.0);

//

AddColumn(CdDoji()OR CHammer(),"Candle",1.0);

Plot

(C,"C",1,64);

Plot

(IIf(x>xa,ya,-1e10),"Bottom",colorBrown,1+8);

Plot

(IIf(x>xb,yb,-1e10),"Top",colorBrown,1+8);

xab =

IIf(xb>xa,xb,xa);

//Retracements

Plot

(IIf(x>=xab+1,RT23_6,-1e10),"23,6% Retr.",5,1);

Plot

(IIf(x>=xab+1,RT38_2,-1e10),"38,2% Retr.",5,1);

Plot

(IIf(x>=xab+1,RT50_0,-1e10),"50,0% Retr.",colorBlue,1);

Plot

(IIf(x>=xab+1,RT61_8,-1e10),"61,8% Retr.",colorYellow,1);

Plot

(IIf(x>=xab+1,RT78_6,-1e10),"78,6% Retr.",colorYellow,1);

GraphXSpace

=
0.5;

//

Plot(Gauss2ord(C,5),"M5",4,1);

GraphXSpace

= 1.5;

Title

=
Name()+" per = "+WriteVal(per,1.0) +" Close = "+WriteVal(C,1.2)+ " ("+WriteVal(ROC(C,1),1.2)+"%)"+" Current Correction = "+WriteVal(RT,1.0)+"%";

_SECTION_END

();
Best Regards,
 
pondy

On Mon, Aug 4, 2008 at 11:20 PM, Ara Kaloustian <ara1@xxxxxxxxxx> wrote:

Hi Pondy,
 
Thanks for the response .....
 
I was asking what else do you need to run the code, because this code calls a couple of functions that are external ... so there is either a DLL or an include file associated with this ...
 
any idea?
 
A
----- Original Message -----
From: pondy
Sent: Thursday, July 31, 2008 1:26 AM
Subject: Re: [amibroker] Fibonacci

Hi Ara Kaloustian,
 
                  Fibonacci code written by Thomas Zmuck in 2002
 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
_SECTION_BEGIN("Fibonacci");
//Date: 12-January 2002 by Thomas Zmuck
//thomas.zm@xxxxxx
Offset = 5; //use two sheets: one with 5 and another with 7, or maybe other offset value
Avgmov = Offset*MA(abs(ROC(C,1)),20);
per = LastValue(Avgmov);
x=Cum(1); Range = 0.01;
PS = TroughBars(L,per,1) == 0;
xa = LastValue(ValueWhen(PS,x,1));//x from last trough
Ya = LastValue(ValueWhen(PS,L,1));//y (Low) last trough
PR = PeakBars(H,per,1) == 0;
xb = LastValue(ValueWhen(PR,x,1));//x from last peak
Yb = LastValue(ValueWhen(PR,H,1));//y (High) last peak
Trough_ReTest = abs((L/ya)-1)<Range;
Peak_ReTest = abs((H/yb)-1)<Range;
Trough_Cross = Cross(ya,C);
Peak_Cross = Cross(C,yb);
//UP = upSwing DN = downSwing
UP = xb>xa;//upSwing
DN = xa>xb;//DownSwing
RT23_6 = IIf(UP,yb-(yb-ya)*0.236,IIf(DN,ya+(yb-ya)*0.236,-1e10));
RT38_2 = IIf(UP,yb-(yb-ya)*0.382,IIf(DN,ya+(yb-ya)*0.382,-1e10));
RT50_0 = IIf(UP,yb-(yb-ya)*0.500,IIf(DN,ya+(yb-ya)*0.500,-1e10));
RT61_8 = IIf(UP,yb-(yb-ya)*0.618,IIf(DN,ya+(yb-ya)*0.618,-1e10));
RT78_6 = IIf(UP,yb-(yb-ya)*0.786,IIf(DN,ya+(yb-ya)*0.786,-1e10));
RT=
IIf(UP,-100*(yb-L)/(yb-ya),
100*(H-ya)/(yb-ya));//Retracement_Value
InZone = C<yb & C>ya;//use it for filter to receive only signals that are in in the Retracement zone.
Buy = Trough_ReTest OR peak_Cross;
Sell = Peak_ReTest OR trough_Cross;
Filter = 1;
AddColumn(RT,"RT%");
AddColumn(Trough_ReTest,"TR-Test",1.0);
AddColumn(Peak_ReTest,"PK-Test",1.0);
AddColumn(Trough_Cross,"TR-Cross",1.0);
AddColumn(Peak_Cross,"PK-Cross",1.0);
AddColumn(CdDoji()OR CHammer(),"Candle",1.0);
Plot(C,"C",1,64);
Plot(IIf(x>xa,ya,-1e10),"Bottom",colorBrown,1+8);
Plot(IIf(x>xb,yb,-1e10),"Top",colorBrown,1+8);
xab = IIf(xb>xa,xb,xa);
//Retracements
Plot(IIf(x>=xab+1,RT23_6,-1e10),"23,6% Retr.",5,1);
Plot(IIf(x>=xab+1,RT38_2,-1e10),"38,2% Retr.",5,1);
Plot(IIf(x>=xab+1,RT50_0,-1e10),"50,0% Retr.",colorBlue,1);
Plot(IIf(x>=xab+1,RT61_8,-1e10),"61,8% Retr.",colorYellow,1);
Plot(IIf(x>=xab+1,RT78_6,-1e10),"78,6% Retr.",colorYellow,1);
GraphXSpace = 0.5;
Plot(Gauss2ord(C,5),"M5",4,1);
GraphXSpace = 1.5;
Title = Name()+"     per = "+WriteVal(per,1.0) +"     Close = "+WriteVal(C,1.2)+ " ("+WriteVal(ROC(C,1),1.2)+"%)"+"      Current Correction = "+WriteVal(RT,1.0)+"%";
_SECTION_END();
 
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
             
Best Regards,
 
pondy
 
 

 
On Thu, Jul 31, 2008 at 9:15 AM, Ara Kaloustian <ara1@xxxxxxxxxx> wrote:

I amlooking at some Fibonacci code written by Thomas Zmuck in 2002.
 
File name is "INX - NASDAQ Fibonacci" .... ( I think that is the original name, but not sure)
 
It seems to use some functions that are not part of AB. Anyone familiar with what is needed to run the code?
 
Tx
 
Ara




--
Best Regards,

pondy




--
Best Regards,

pondy
__._,_.___

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___