First, another thanks to
those who offered up ways to handle string manipulations; the techniques are
used here.
Second, a BEANS.afl is
attached (and uploaded to the official AFL library for those who did not see the
attachment).
This code will display a
list of your holdings and associated statistics about those holdings using gfx
commands to create a columnar Title; it is applied as an indicator and does not
use the AA window. There are comments on use and some of the steps in the
code.
Third, and the
challenge. I am unable to see, within the code construction approach I
used, how to calculate an average buy price when one's holdings include two or
more of the same symbol purchased on different days. If you are interested
and look within the code, you will see how the code cycles through the list of
holdings and develops the stats for each holding. How to save intermediate
results for several positions and calculate an average price escapes me.
If anyone has a suggestion, I would be most grateful.
An associated minor problem
is this: the way I chose to display lines of code using gfx commands makes it
inconvenient to alter the order of the various columns of data. It can be done
of course, but only with some tiresome manual recoding. Not a big deal
because once done, it is complete. But for learning purposes, I would like
to know another way of displaying the data. I realize most (all?) of you
have better things to do with your time. Nonetheless, you may learn
something from some of the code, and you might find it useful or at a minimum,
entertaining to flex your coding muscles. Recall the various concise
suggestions on how to handle the string manipulations which resulted from the
original question.
What else might this module
calculate and display to make it more useful?
Thanks,
Ken
PS: this is called a BEANS
module because many of us from the FastTrack world used, at one time, a support
program which included a BEANS module. After you entered your holdings
into an initialization file, it would calculate statistics for nightly viewing
after updating. This program became unusable (or limited) when the
FastTrack database was recently changed to hold more data. Hence this
BEANS.afl.
__._,_.___
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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
__,_._,___
Attachment:
Description: Binary data
|