PureBytes Links
Trading Reference Links
|
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 in a
system test?
>
>
>
> Dan, I'm not sufficiently knowledgeable about this to know the
> difference between a coded function and a complete indicator, LOL!
>
> In the custom indicator/index I created, I want to be able to refer
> to it in a system-test just as I would with RSI(), MACD(),EMA(),
> etc. As a specific example, I'd like to know when the current
index
> value sells off by 5% from its 20-day HHV, referring to it along
the
> line of this:
>
> Sell=Cross(Ref(HHV("My Custom Index",20),-1)*.95,"My Custom Index");
>
> I didn't use AddtoComposite because I didn't think it would give me
> the weighting method I wanted (equal dollar amounts in each
security
> instead of simply adding the stock price of each security). (Maybe
> I've got that wrong, too?)
>
> I don't really "get" #include yet (like anyone else, some concepts
> come easy and some come hard). Is #include what I should
concentrate
> on to get what I want, do you think?
>
>
> Luck,
>
> Sebastian
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Dan Clark" <dan_public@xxxx>
wrote:
> >
> > Sebastian,
> >
> >
> >
> > When you said ".when I created a custom indicator, I could refer
to
> it and
> > use it.", are you referring to a coded function or a complete
> indicator
> > (like an MA)?
> >
> >
> >
> > If the former, you can create functions and add them to an
include
> file.
> > Then you would use "#Include" with the file name in a chart of
> > scan/exploration. For example, if you stored your functions in
> the file
> > "ABFunctions.afl", this is text you would add to the top of your
> chart AFL
> > to refer to the indicator:
> >
> >
> >
> > #include <ABFunctions.afl>
> >
> >
> >
> > If to the latter, you can create an indicator, save it to an AFL
> text file
> > and then add it to a chart. Typically, these custom indicator
> files are
> > saved to ".\Amibroker\Formulas\Custom\". They would then appear
> in the
> > "Charts\Custom" list ("View --> Charts").
> >
> >
> >
> > Regards,
> >
> >
> >
> > Dan.
> >
> >
> >
> >
> >
> >
> >
> > _____
> >
> > From: amibroker@xxxxxxxxxxxxxxx
[mailto:amibroker@xxxxxxxxxxxxxxx]
> On Behalf
> > Of sebastiandanconia
> > Sent: Friday, November 25, 2005 10:44 AM
> > To: amibroker@xxxxxxxxxxxxxxx
> > Subject: [amibroker] How to refer to a custom formula in a system
> test?
> >
> >
> >
> > I created the index referred to in this post:
> >
> > http://finance.groups.yahoo.com/group/amibroker/message/90273
> >
> > ...as a custom indicator so that I could refer to it in a system
> > test. (AddtoComposite couldn't get me where I wanted to go.) In
my
> > old Metastock software, when I created a custom indicator I could
> > simply refer to it and use it, but I haven't found a way to do
this
> > with Amibroker. I did a search on the Amibroker.com discussion
> boards
> > site and there have been inquiries about this, but with no
answers.
> >
> > Does this capability exist, or if not, is there a relatively easy
> > workaround? TIA.
> >
> >
> > Luck to all,
> >
> > Sebastian
> >
> >
> >
> >
> >
> >
> >
> > 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
> >
> >
> >
> > * Visit your group "amibroker
> > <http://groups.yahoo.com/group/amibroker> " on the web.
> >
> > * To unsubscribe from this group, send an email to:
> > amibroker-unsubscribe@xxxxxxxxxxxxxxx
> > <mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?
subject=Unsubscribe>
> >
> > * Your use of Yahoo! Groups is subject to the Yahoo!
> > <http://docs.yahoo.com/info/terms/> Terms of Service.
> >
> >
> >
> > _____
> >
>
>
>
>
>
>
> 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
>
>
>
>
>
>
> SPONSORED LINKS
>
>
> Investment
> <http://groups.yahoo.com/gads?
t=ms&k=Investment+management+software&w1=Inves
>
tment+management+software&w2=Real+estate+investment+software&w3=Invest
ment+p
>
roperty+software&w4=Software+support&w5=Real+estate+investment+analysi
s+soft
> ware&w6=Investment+software&c=6&s=200&.sig=_XXUzbE9l5lGlZNcMu4KNQ>
> management software
>
> Real
> <http://groups.yahoo.com/gads?
t=ms&k=Real+estate+investment+software&w1=Inve
>
stment+management+software&w2=Real+estate+investment+software&w3=Inves
tment+
>
property+software&w4=Software+support&w5=Real+estate+investment+analys
is+sof
>
tware&w6=Investment+software&c=6&s=200&.sig=5_sgDczz3ArKGMtJ9tFSJA>
estate
> investment software
>
> Investment
> <http://groups.yahoo.com/gads?
t=ms&k=Investment+property+software&w1=Investm
>
ent+management+software&w2=Real+estate+investment+software&w3=Investme
nt+pro
>
perty+software&w4=Software+support&w5=Real+estate+investment+analysis+
softwa
> re&w6=Investment+software&c=6&s=200&.sig=_N6zcwefgp4eg5n6oX5WZw>
property
> software
>
>
> Software
> <http://groups.yahoo.com/gads?
t=ms&k=Software+support&w1=Investment+manageme
>
nt+software&w2=Real+estate+investment+software&w3=Investment+property+
softwa
>
re&w4=Software+support&w5=Real+estate+investment+analysis+software&w6=
Invest
> ment+software&c=6&s=200&.sig=MJ2jP31F3n64RDZkDadU8w> support
>
> Real
> <http://groups.yahoo.com/gads?
t=ms&k=Real+estate+investment+analysis+softwar
>
e&w1=Investment+management+software&w2=Real+estate+investment+software
&w3=In
>
vestment+property+software&w4=Software+support&w5=Real+estate+investme
nt+ana
>
lysis+software&w6=Investment+software&c=6&s=200&.sig=GmF8PlAJASx0wrSaX
5-Zlw>
> estate investment analysis software
>
> Investment
> <http://groups.yahoo.com/gads?
t=ms&k=Investment+software&w1=Investment+manag
>
ement+software&w2=Real+estate+investment+software&w3=Investment+proper
ty+sof
>
tware&w4=Software+support&w5=Real+estate+investment+analysis+software&
w6=Inv
> estment+software&c=6&s=200&.sig=aMgGsKT4w29dMAYUzQUKzg> software
>
>
>
> _____
>
> YAHOO! GROUPS LINKS
>
>
>
> * Visit your group "amibroker
> <http://groups.yahoo.com/group/amibroker> " on the web.
>
> * To unsubscribe from this group, send an email to:
> amibroker-unsubscribe@xxxxxxxxxxxxxxx
> <mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe>
>
> * Your use of Yahoo! Groups is subject to the Yahoo!
> <http://docs.yahoo.com/info/terms/> Terms of Service.
>
>
>
> _____
>
------------------------ 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/
|