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

[amibroker] A solution to my custom index problem.



PureBytes Links

Trading Reference Links

One of the problems I was having with AddToComposite was something a 
little screwy.  After running the scan, the composite equity number I 
was getting was way off of what it should have been.

Here's the code I originally used in my scan, that got me the wrong 
equity (I didn't include the rest of the code because it's long and 
not pertinent.  It's upthread a couple of posts):

Indexpr=Abaxpr + Babypr + Epexpr + Jdaspr + Mrgepr + Nwrepr + Osurpr 
+ Petspr + Rnowpr + Scurpr;

AddToComposite(Close, "~MyIndex", "X" );

AddToComposite( 1, "~MyIndex", "I" );

buy = 0; // required by scan mode

graph0 = Foreign( "~MyIndex", "C" )/Foreign( "~MyIndex", "I" );


Here's the code I'm using that's giving me the correct equity:

Indexpr=Abaxpr + Babypr + Epexpr + Jdaspr + Mrgepr + Nwrepr + Osurpr 
+ Petspr + Rnowpr + Scurpr;

AddToComposite(Indexpr/16, "~MyIndex", "X" );

Buy = 0; // required by scan mode

Graph0 = Foreign( "~MyIndex", "C" );


Why the Indexpr needs to be divided by 16, I have no idea.  In 
reading the manual (yes, I do try to puzzle things out myself) there 
was a reference to the number 16, "atcFlagEnableInExplore = 16 - 
allow running AddToComposite in exploration mode", and on a wild, 
desperate hunch I plugged it in and suddenly everything looked right.

So now I've got it to work and I can duplicate it as many times as I 
need to, which is great, I just don't understand why it works.:)

Thanks for all the assistance.  Although I have the solution I was 
looking for, if anyone can explain how I got there (the "dividing by 
16" business) I'd be interested to hear about it, just out of 
curiousity.


Luck to all,

Sebastian
   





------------------------ 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/