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

[amibroker] Re: Trade Series Matrix Using C++



PureBytes Links

Trading Reference Links

Thinking a little further on this.

Unless there is a need for advanced matrix operations 'psuedo 
matrices', using arrays with limited AFL matrix operations, would be 
sufficient for AB needs (arrays are faster and maintain backward 
compatibility?).

For advanced users the first phase would be the power version and the 
method used would only store the core metrics with speed in mind (2, 
3 or maybe 4 datapoints, as persistent arrays, depending on the 
objectives) and only calculate one metric, on the fly, from them i.e. 
the user defined objective function.

All performance metrics would be derived from the core metrics and 
therefore able to be calculated in AFL so they would be fully 
transparent to users.

Default metrics could be built-in and rendered as tables etc, at 
phase II, for the benefit of newcomers, but as their skill and 
interest develops they could then easily drill down to the code 
behind the metric.

Obviously the trade matrices are a precursor to advanced Portfolio 
Management in Phase III (RalphVince, MSA Analyser, van Tharp, 
McDonnell, MonteCarlo Simulation or whatever takes the users fancy).

For my own use I intend to go right past phase II and implement my 
own Portfolio Manager (based on a compilation of my own work and the 
work of people like RalphVince .... I am still working in the 
background on BiNomial Simulation and if I am happy with it I will 
use it in Phase III).

Part of the rational, behind the idea, is that the time value 
(processing) in the backtesting is saved, while the time value in 
producing performance metrics is disposable (because the latter has a 
lesser timevalue, the metrics of interest are based on subjective 
choices and they change dynamically as new data arrives).

I think it is a good idea but I am not 100% certain about it, not 
being a mathematician or programmer.

I am becoming a little frustrated with AB (perhaps I am outgrowing 
it) and the Portfolio Backtester is a good example of one place where 
that frustration is focussed.

I have three ways I can go with it:

- send it to AB as a suggestion (which is why I need feedback)
- implement my own backtester within AB (use a DLL?) ... maybe keep 
it private or publish it with open source code (possibly I would do 
that via a team effort)
- go to an existing open source charting project with my ideas
- intitiate my own open source charting project

Since I am biased to open source, and therefore my ideas/code would 
be in the public domain anyway, I have no reason not to share it with 
AB and the AB community. 

If it is not a good idea then nothing is lost.


--- In amibroker@xxxxxxxxxxxxxxx, "brian_z111" <brian_z111@xxx> wrote:
>
> There was some recent discussion about the need to learn more than 
one 
> language to use AB.
> 
> Just wondering if C++ Matrices could be used to store and reference 
> trades, instead of Object Orientated Progamming, to make things 
easier.
> 
> C++ includes containers that can be considered matrices (such as 
arrays 
> and, in the Standard Library, vectors, lists, and maps) OR open 
source 
> C++ Matrix libraries are available.
> 
> 
> Would it be possible to:
> 
> - nominate buy/sell/buyprice etc in the first phase of backtesting
> - run backtest over the sample space (limit space as defined in 
setting)
> - store trades P & L as % in binary files
> - store time in trade (binary)
> - store entry bar OR time (binary- only needed to display arrows on 
> chart)
> 
> Storing trades in binary form would be very fast (stored as a trade 
> matrix).
> All metrics can be calculated from % P & L plus time in trade as 
> required so Money Management only needs to be applied in the second 
> phase, if required.
> Only the trade matrices need to be saved, with the backtest 
settings 
> (also binary), for future reference, instead of the BT reports.
> 
> In the second phase performance metrics could be calculated as 
required 
> by referencing the matrix entries, either in total or as sub 
matrices.
> 
> Matrix functions could be included in AFL and the advanced 
backtester 
> would use them to reference the trades to create equity curves and 
> custom or default reports on demand (no need to re-run backtests 
for 
> custom reports OR when adding/deleting columns from a report).
> 
> It might also be possible that trade P & L, and time in trade, 
could be 
> stored in one 32 bit byte thereby save processing time (the 
separate 
> pieces of info could be unpacked into the trade matrix and the time 
in 
> trade matrix when required).
> 
> Happily, the trade matrices could be rendered as tables, with rows 
and 
> columns for visual reference/charting etc, which is much more 
intuitive 
> than referencing the Trade Object as we do at the moment.
> 
> The matrices could use a full range of Matrix operations or just 
some 
> of the basics for the AFL version e.g. referencing individual 
trades by 
> matrix M * N notataion (I don't know much about matrix maths so it 
is 
> up to the maths people to comment on possible uses for advanced 
matrix 
> maths functions).
> 
> 
> When data is added to the DB, or the sample range extended, 
backtesting 
> could commence from the time of the last closed trade and then add 
new 
> trades to the matrix (this would save time by avoiding the need to 
> repeat backtests).
> 
> It is also a very nice format for exporting to Excel or advanced 
stats 
> packages like R or Matlab :-)
> 
> Does anyone esle have any thoughts on the subject?
>



------------------------------------

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL 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

*********************************
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

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