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

[amibroker] Re: How to refer to a custom formula in a system test?



PureBytes Links

Trading Reference Links

I wasn't really trying to trade the equity curve, just testing out a 
portfolio-level sell-stop.  Now that I've got it set up so I can test 
it, the sell-stop does look like it degrades performance, at least at 
the 5% level.

Just FYI, what I'm working on is trading more-volatile portfolios 
(small cap stocks) based on broad-index price and volume signals.  
It's definitely worth looking into, IMO.


Luck,

Sebastian 

--- In amibroker@xxxxxxxxxxxxxxx, eric paradis 
<thechemistrybetweenus@xxxx> wrote:
>
> sebastian, I tried to use this for your equity. Doesnt
> work out though, youll find it probably impeds your
> system performance.
> I havent been able to find a way to trade my equity
> curve profitably.
> 
> Sell= IIf (Equity() * 1.13 <
> HHV(Ref(Equity(),-1),100),1,0);   
> 
> 
> --- sebastiandanconia <sebastiandanconia@xxxx>
> wrote:
> 
> > Dan, I appreciate the effort, and if that crossover
> > indicator was all 
> > I needed I'm sure it would work as you say. 
> > Thank-you, and I'll 
> > store away the idea for the future.:)
> > 
> > Unfortunately, what I really need is access to the
> > values of the 
> > custom index I created, as if it was another ticker
> > symbol.  In fact, 
> > I want to create a few more custom indices,
> > representing different 
> > stock portfolios.
> > 
> > In case I've been unclear about what I'm doing and
> > why, I want to be 
> > able to run a portfolio-level system test where I
> > refer to the 
> > portfolio equity in a "sell" rule, i.e., "sell the
> > entire portfolio 
> > if the equity falls by -%5 from its peak."  My
> > thinking was that if I 
> > could re-create the portfolio as an index OUTSIDE of
> > the system test 
> > and refer to it using "FOREIGN" I could avoid coding
> > that was over my 
> > head, and circular references.
> > 
> > 
> > Luck,
> > 
> > Sebastian
> > 
> > 
> > 
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "Dan Clark"
> > <dan_public@xxxx> wrote:
> > >
> > > Sebastian,
> > > 
> > >  
> > > 
> > > Hi.  A simple function might do the trick.   Below
> > is a function 
> > that I
> > > created that you can try out.  Copy this into a
> > text file and save 
> > it as
> > > some good sounding file name.  For example,
> > "CrossHHV.afl".   Save 
> > it to the
> > > "..\AmiBroker\Formulas\Systems\" folder.  
> > Contents of CrossHHV.afl 
> > (before
> > > using include file) should look like:
> > > 
> > >  
> > > 
> > > function CrossHHV()
> > > 
> > >    {
> > > 
> > >    RetValue = Cross(Ref(HHV(C, 20), -1)*.95, C);
> > > 
> > >  
> > > 
> > >    return RetValue;
> > > 
> > >    }
> > > 
> > >  
> > > 
> > > Sell = CrossHHV();
> > > 
> > > Filter = Sell;
> > > 
> > >  
> > > 
> > > AddColumn(HHV(C, 20), "HHV(H, 20)", 1.2);
> > > 
> > > AddColumn(Ref(HHV(C, 20), -1), "Ref(HHV(H, 20),
> > -1)", 1.2);
> > > 
> > > AddColumn(Ref(HHV(C, 20), -1)*.95, "Ref(HHV(H,
> > 20), -1)*.95", 1.2);
> > > 
> > > 
> > > 
> > > 
> > > 
> > > Open up the AA window, Pick "CrossHHV.afl", and
> > click "Explore".   
> > You will
> > > see all symbols that meet that criteria.
> > > 
> > >  
> > > 
> > > Assuming that works, try using an include file. 
> > An include file is 
> > nothing
> > > more than an AFL file that contains custom
> > functions and procedures 
> > that you
> > > create.  Typically, you store it in the folder
> > > "..\AmiBroker\Formulas\Include\".   To use the
> > functions, you would 
> > add to
> > > chart or exploration\backtest code: "#include" +
> > file name.  For 
> > example, if
> > > your include file was named, "ABFunctions.afl, you
> > would add this 
> > to your
> > > charts, explorations, etc:
> > > 
> > >  
> > > 
> > >             #include <ABFunctions.afl>; 
> > > 
> > >  
> > > 
> > > So, create a file called "ABFunctions.afl" in the
> > > "..\AmiBroker\Formulas\Include\" folder.   Now,
> > move ONLY the 
> > CrossHHV
> > > function code ONLY to the "ABFunctions.afl" file. 
> > The contents of 
> > the
> > > "ABFunctions.afl" file should look like: 
> > > 
> > >  
> > > 
> > > function CrossHHV()
> > > 
> > >    {
> > > 
> > >    RetValue = Cross(Ref(HHV(C, 20), -1)*.95, C);
> > > 
> > >  
> > > 
> > >    return RetValue;
> > > 
> > >    }
> > > 
> > >  
> > > 
> > > Now make sure that the CrossHHV.afl file has been
> > modified.   It 
> > should look
> > > like this (after using the include file):
> > > 
> > > #include <ABFunctions.afl>;
> > > 
> > >  
> > > 
> > > Sell = CrossHHV();
> > > 
> > > Filter = Sell;
> > > 
> > >  
> > > 
> > > AddColumn(HHV(C, 20), "HHV(H, 20)", 1.2);
> > > 
> > > AddColumn(Ref(HHV(C, 20), -1), "Ref(HHV(H, 20),
> > -1)", 1.2);
> > > 
> > > AddColumn(Ref(HHV(C, 20), -1)*.95, "Ref(HHV(H,
> > 20), -1)*.95", 1.2);
> > > 
> > >  
> > > 
> > > Now, when you execute the CrossHHV.afl file, the
> > code in the 
> > ABFunctions.afl
> > > will be "included" in the CrossHHV.afl and you can
> > execute the 
> > function.
> > > This is a convenient way of reusing code.
> > > 
> > >  
> > > 
> > > I hope this helps.
> > > 
> > >  
> > > 
> > > Regards,
> > > 
> > >  
> > > 
> > > Dan.
> > > 
> > >   _____  
> > > 
> > > From: amibroker@xxxxxxxxxxxxxxx
> > [mailto:amibroker@xxxxxxxxxxxxxxx] 
> > On Behalf
> > > Of sebastiandanconia
> > > Sent: Friday, November 25, 2005 2:59 PM
> > > To: amibroker@xxxxxxxxxxxxxxx
> > > Subject: [amibroker] Re: How to refer to a custom
> > formula 
> === message truncated ===
> 
> 
> 
> 	
> 		
> __________________________________ 
> Yahoo! Mail - PC Magazine Editors' Choice 2005 
> http://mail.yahoo.com
>






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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 other support material please check also:
http://www.amibroker.com/support.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/