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

[amibroker] Re: Non Linear Optimising



PureBytes Links

Trading Reference Links


The powers of d=2/(sqrt(5)+1) will give the Fib ratios.
This is a way to change a linear otimization to an actual Fib one.
Example:
d=2/(sqrt(5)+1);
n=Optimize("n",5,-5,5,1);
H1=ValueWhen(PeakBars(H,5)==0,H);
L1=ValueWhen(TroughBars(L,5)==0,L);
y=d^n*(H1-L1);
Buy=Cross(C,L1+y);Sell=Ref(Buy,-3);
For unrelated numbers you could use VarSet() and then VarGet() 
functions.
Dimitris

--- In amibroker@xxxxxxxxxxxxxxx, "see_change007" <cvt@xxxx> wrote:
> 
> Cool,  thanks For that Nigel. I Must be starting to get the hang of 
> AB now. Even if I wouldn't have thought of that , I can  understand 
> the logic. :)
> 
> If I want to use that thinking to optimise  a series of unrelated 
> numbers ( which is my main aim  )  , could I assign those numbers 
to 
> represent the Nth expressions of a series and then optimize using  
> that series.
> 
> If so , any ideas how to code that.
> 
> See Change 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, Nigel Rowe <rho@xxxx> wrote:
> > On Mon, 18 Oct 2004 13:56, see_change007 wrote:
> > > Tomaz
> > >
> > > Is it possible to optimize using non linear steps ?
> > >
> > > I have several variables which I want to do a "mega 
optimization"
> > > for.  For each varaible I have several levels which I'm 
> interested in
> > > testing in relation with the others, but there isn't a 
consistent
> > > linear step between the values for each variable.
> > >
> > > Can you set up the optimization to do this ?
> > >
> > > Also thought people might want to optimize on other non linear 
> series
> > > like fibs.
> > >
> > > See Change
> > 
> > The Optimize() function only does linear steps.  If you need non-
> linear, 
> > convert optimize's linear output to whatever non-linear function 
> you need.
> > 
> > Eg.
> > 
> > function fib(n) {
> > 	// return the n'th Fibonacci number.  
> > 
> > 	// This function is good on amibroker up to n==32, when 
> rounding errors 
> > 	// start to accumulate and the correct answers have more than 
> 6 digits.
> > 	// (AB only has about 6 digits precision.)
> > 
> > 	// the constants in the return statement are
> > 	//  3.2360679 == 1 + sqrt(5);
> > 	// -1.2360679 == 1 - sqrt(5);
> > 	//  2.2360679 == sqrt(5);
> > 
> > 	n = int(n);
> > 	return int((3.2360679^n - -1.2360679^n) / (2^n * 2.2360679));
> > }
> > 
> > fibn = fib(Optimize("Fibonacci", 1, 1, 10, 1));
> > 
> > Will set fibn to 1,1,2,3,5,8,13,21,34,55 for each optimise step.
> > Then do whatever you want with the first 10 fibonacci numbers.
> > 
> > Cheers,
> > 	Nigel
> > 
> > -- 
> > 	Nigel Rowe
> > 	rho@xxxx





------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/