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

[amibroker] Re: overhaul to AutoOpttools



PureBytes Links

Trading Reference Links

Hi Steve,

Just a little help to get me going. Applying the example in this 
message to the following formula does not seem to work (I receive as 
bestrange always the first number filled in behind factor):

bestequity = 0;
bestrange = 0;
prevCl= Ref(Close,-1);

// optimization loop

for( factor = 0.05; factor < 0.5; factor ++ )
{

Buy = Cross( Close, prevCl+prevCl*Factor/100 );
Short = Cross(prevCl-prevCl*Factor/100, Close);

 Le = LastValue( Equity() );

  if( Le > bestequity )
  {
   bestequity = Le;
   bestrange = factor;
 }
}

factor = bestrange;

Buy = Cross( Close, prevCl+prevCl*Factor/100 );
Short = Cross(prevCl-prevCl*Factor/100, Close);
Cover=0; Sell=0;

Filter = BarIndex() == BarCount - 1;
ApplyStop(stopTypeProfit,2,57,0);
Equity(1);

AddColumn( bestrange, "Best range" );

AddColumn( Equity(), "Best Equity" );

I can't see where there is the critical difference with the example 
formula.
Willem Jan


--- In amibroker@xxxxxxxxxxxxxxx, "Steve Dugas" <sjdugas@xxxx> wrote:
> Hi William,
> 
> Yes, since all the real work is done in the DLL, it would have to be
> modified. I would need to add code to calculate your StochRSI for 
each
> optimization step and then test them all to find the best one. But, 
the DLL
> was written before TJ added looping ability to AFL - you can now do 
this
> yourself for your own indicators right in AFL. I have pasted an 
example by
> TJ below showing how to do this, and I added the plot statements to 
show how
> you can plot the results.
> 
> Steve
> 
> ---------------------------------------------
> 
> Yes it is possible to perform optimization using for loop inside 
exploration
> code:
> 
> Sample code follows, it runs optimization inside for loop and 
reports only
> THE BEST
> result. It should be run usign "EXPLORE". The code in fact runs 
several
> backtests inside 'for' loop and notes the best result and best 
parameter
> range.
> bestequity = 0;
> bestrange = 0;
> 
> // optimization loop
> 
> for( range = 12; range < 40; range ++ )
> {
> 
>   Buy = Cross( Close, EMA( Close, range ) );
> 
>   Sell = Cross( EMA( Close, range ), Close );
> 
>  Le = LastValue( Equity() );
> 
>   if( Le > bestequity )
>   {
>    bestequity = Le;
>    bestrange = range;
>  }
> }
> 
> range = bestrange;
> 
> Buy = Cross( Close, EMA( Close, range ) );
> 
> Sell = Cross( EMA( Close, range ), Close );
> 
> Filter = BarIndex() == BarCount - 1;
> 
> AddColumn( bestrange, "Best range" );
> 
> AddColumn( Equity(), "Best Equity" );
> 
> Plot( Equity(), "equity", colorRed, styleLine);
> Plot( EMA( Close, range ), "Opt EMA", colorBlue,
> styleLine|styleLeftAxisScale);
> Plot( Close, "close", colorBrightGreen, 
styleLine|styleLeftAxisScale);
> 
> 
> ----- Original Message -----
> From: "willem1940" <w.j.a.struyck@xxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Sunday, June 15, 2003 3:22 PM
> Subject: [amibroker] Re: overhaul to AutoOpttools
> 
> 
> > You just post an impressive amount of work and someone wants more.
> > Ths time it is me. I would like to try the tool on intraday 
futures.
> > In principle this should work but the results sofar are not very
> > impressive; will have to d some more work on proper settings.
> > However I would like to try the tool on the custom system (based 
on
> > StochRSI) I use for my future trade. Is it possible to modify the
> > tool in order to work with custom buy and short signals or does 
this
> > require work in the *.dll file (something I have no knowledge of).
> >
> > Willem Jan
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "Steve Dugas" <sjdugas@xxxx> 
wrote:
> > > That is great Herman, maybe you will discover and teach me a few
> > things about them! I will look forward to hearing anything you may
> > care to post. Thanks for your interest!
> > >
> > > Steve
> > >   ----- Original Message -----
> > >   From: Herman van den Bergen
> > >   To: amibroker@xxxxxxxxxxxxxxx
> > >   Sent: Sunday, June 15, 2003 4:02 AM
> > >   Subject: RE: [amibroker] overhaul to AutoOpttools
> > >
> > >
> > >   Thank you steve, btw; you don't babble at all, your concept is
> > quite interesting! I am probably one of those "system guys" who 
want
> > to OOS and look at historical performance. Also; I am more an
> > experimental coder than a trader...
> > >
> > >   I'll have to do some experimenting with your indicators, this
> > will take some time :-) thank you again for introducing an
> > interesting concept.
> > >
> > >   herman
> > >
> > >     -----Original Message-----
> > >     From: Steve Dugas [mailto:sjdugas@x...]
> > >     Sent: Saturday, June 14, 2003 8:47 PM
> > >     To: amibroker@xxxxxxxxxxxxxxx
> > >     Subject: Re: [amibroker] overhaul to AutoOpttools
> > >
> > >
> > >     Hi Herman,
> > >
> > >     Thank you for the kind words  : - )
> > >
> > >     Actually, these weren't really designed for out-of-sample
> > testing, but I think you could do it with a little extra work. I
> > suppose a little background is probably in order - At the present
> > time I am a discretionary trader, and I concentrate on what is
> > happening now - I really dont even check to see how these 
indicators
> > would have performed in the past. Since they are optimized over 
the
> > time period you select, I assume they would have their ups and 
downs
> > when the same values are used for other time periods. I have only
> > been doing TA for about 2 or 3 years now, and when I started, I 
spent
> > the first year or so backtesting, using and trying to combine all 
the
> > popular indicators, but was generally disappointed with the 
results -
> > I'm sure you know the story - works on some stocks but not others,
> > take a closer look at the good ones and find out the same system
> > would have failed miserably the year before, big drawdowns vs.
> > mediocre returns, stock's personality suddenly changes, etc... I
> > never did find a system I really liked, so rather than continue 
down
> > that road, I decided to try a different approach - concentrate on
> > what each individual stock is doing now, and try to be as "tuned 
in"
> > as possible to any changes in behavior.
> > >
> > >     So I came up with these self-optimizing indicators. I think 
the
> > important thing to know about them is that they continually
> > reoptimize themselves as new data is added, so you can see changes
> > happening in real time. They do not just carry yesterday's 
optimized
> > value forward (well, they can do that if you want, but I dont use
> > them that way, and I probably wouldn't expect to see very good
> > results). This daily reoptimization is actually a double-edged 
sword -
> >  it is good to stay on top of things, and know that you are seeing
> > the latest, best result for each indicator and each stock, but on 
the
> > other hand it is possible that they can change without warning 
(i.e. -
> >  today's 5 period MA can become tomorrow's 10 period MA) and you 
may
> > suddenly find yourself on the wrong side of the trade. While it is
> > theoretically possible for this to happen at any time I guess, in
> > practice it does not actually seem to happen very often. But then
> > again I have only been using them for a few months, and I also 
spend
> > a lot of time running the included Explorer code to try and
> > identify "friendly" stocks. I have actually been doing pretty well
> > with them, but if you are a "system" guy who backtests your code
> > against 5 or 10 years of data, you may not feel very comfortable 
with
> > them. Of course, you could always select the entire data range as
> > your test period, and automatically get the best parameters for 
each
> > stock/indicator, but I really dont know offhand whether the 
return,
> > drawdown etc would be any good or not.
> > >
> > >     OK, I have babbled long enough, I will try to answer your
> > question... : - )
> > >
> > >     Yes, I think you could use these with AB's backtester to 
test
> > on any range of data, but not without a little work. The code for
> > each indicator calls the DLL, which sets AFL variables containing 
the
> > optimal parameters for your test period. You can access these
> > variables in AFL, and use AB's backtester to test any data range, 
but
> > you would need to add the backtester code you want to use and 
plug in
> > the parameter variables. For example:
> > >
> > >     buy = cross( close, ma( close, OptParam1Val));
> > >
> > >     You would also want to make sure the backtester Settings and
> > the settings at the top of the AFL for the indicator you are 
testing
> > are set to match as closely as possible. I actually thought about
> > adding this code to all the indicators at one time, but decided 
not
> > to bother until I was ready to use it...maybe I will add it soon.
> > Meanwhile, if you decide to do this, I will be happy to help you 
in
> > accessing  the variables, etc,  if you are having any trouble. 
Just
> > let me know!
> > >
> > >     Best Wishes,
> > >
> > >     Steve
> > >       ----- Original Message -----
> > >       From: Herman van den Bergen
> > >       To: amibroker@xxxxxxxxxxxxxxx
> > >       Sent: Saturday, June 14, 2003 5:31 PM
> > >       Subject: RE: [amibroker] overhaul to AutoOpttools
> > >
> > >
> > >       Thank you Steve, some relly nice work!
> > >
> > >       I have not used any of your auto opt tools before... could
> > you explain how one would go about performing an out of simple 
test?
> > Is that possible? Or are the signal always optimized?
> > >
> > >       many thanks for a very interesting contribution!
> > >
> > >       Herman.
> > >         -----Original Message-----
> > >         From: Steve Dugas [mailto:sjdugas@x...]
> > >         Sent: Saturday, June 14, 2003 3:32 PM
> > >         To: amibroker
> > >         Subject: [amibroker] overhaul to AutoOpttools
> > >
> > >
> > >         Hi All,
> > >
> > >         I have made some changes to AutoOptTools, and posted the
> > new version if anyone can use it. Picture attached. The main 
changes
> > are:
> > >
> > >         1. Fixed a bug that caused the plotted indicators to
> > disappear at times ( actually, they didnt disappear, just 
defaulted
> > to the background color if certain conditions weren't met).
> > >
> > >         2. added volume histogram in the background.
> > >
> > >         3. added black triangles that automatically point to
> > beginning and end of selected test period.
> > >
> > >         4. added color-sensitive up/down arrow to last bar to 
tell
> > instantly if indicators are currently long or short. (usually 
wasnt
> > hard to tell, but on occasion it could be)
> > >
> > >         5. moved some statistics and other info from the main
> > screen and the title to the interpretation window.
> > >
> > >         6. added a couple of new statistics to the title.
> > >
> > >         7. now has 2 include files - for leading and lagging
> > indicators (seems to give better results).
> > >
> > >         8. updated the help file - I left out a couple of things
> > the 1st time.
> > >
> > >         Best Wishes,
> > >
> > >         Steve
> > >
> > >
> > >         Send BUG REPORTS to bugs@xxxx
> > >         Send SUGGESTIONS to suggest@xxxx
> > >         -----------------------------------------
> > >         Post AmiQuote-related messages ONLY to:
> > amiquote@xxxxxxxxxxxxxxx
> > >         (Web page: 
http://groups.yahoo.com/group/amiquote/messages/)
> > >         --------------------------------------------
> > >         Check group FAQ at:
> > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > >
> > >         Your use of Yahoo! Groups is subject to the Yahoo! 
Terms of
> > Service.
> > >
> > >
> > >
> > >       Send BUG REPORTS to bugs@xxxx
> > >       Send SUGGESTIONS to suggest@xxxx
> > >       -----------------------------------------
> > >       Post AmiQuote-related messages ONLY to:
> > amiquote@xxxxxxxxxxxxxxx
> > >       (Web page: 
http://groups.yahoo.com/group/amiquote/messages/)
> > >       --------------------------------------------
> > >       Check group FAQ at:
> > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > >
> > >       Your use of Yahoo! Groups is subject to the Yahoo! Terms 
of
> > Service.
> > >
> > >
> > >
> > >     Send BUG REPORTS to bugs@xxxx
> > >     Send SUGGESTIONS to suggest@xxxx
> > >     -----------------------------------------
> > >     Post AmiQuote-related messages ONLY to:
> > amiquote@xxxxxxxxxxxxxxx
> > >     (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > >     --------------------------------------------
> > >     Check group FAQ at:
> > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > >
> > >     Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> > Service.
> > >
> > >
> > >         Yahoo! Groups Sponsor
> > >
> > >
> > >
> > >   Send BUG REPORTS to bugs@xxxx
> > >   Send SUGGESTIONS to suggest@xxxx
> > >   -----------------------------------------
> > >   Post AmiQuote-related messages ONLY to: 
amiquote@xxxxxxxxxxxxxxx
> > >   (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > >   --------------------------------------------
> > >   Check group FAQ at:
> > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > >
> > >   Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> > Service.
> >
> >
> >
> > Send BUG REPORTS to bugs@xxxx
> > Send SUGGESTIONS to suggest@xxxx
> > -----------------------------------------
> > Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > --------------------------------------------
> > Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> >
> > Your use of Yahoo! Groups is subject to 
http://docs.yahoo.com/info/terms/
> >
> >
> >


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/ySSFAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

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