I have been using Amibroker for a while and love its flexibility and speed. Off-late i realized the research i do to develop a strategy is not well documented/structured. So when i go back to it , it takes some time to understand what i did . Wanted to ask experienced guys in the forum how do they document the research..also is there anything similar to jupyter notebook kind of thing for amibroker..where i could make blocks of code and document them better ?
@akshay.gupta55, as I recently wrote in another post, the Formula Editor Code Snippets could help to organize and reuse "code blocks".
You can classify them in categories, add a description and also use a shortcut to quickly paste them in your new formula.
Although it is probably not the tool you had in mind, I think it can still be a simple and useful tool for tracking and documenting the blocks of code you use most frequently.
Yeah code snippets is one good way...was thinking if some way similar to creating Notebooks exist ?
My 2 cents. Learn how to comment your code, no matter what programming language. It should read like a book. That way when you go back to it, it will tell you what you are doing, where you left off, what needs to be done and things to try. There are books written on how to structure and comment code, but I'm sure you can search the university of YouTube as well.
As far as documenting the strategy itself, you could write a word doc for each one, use a dictating speech to text engine, file them away and reference that file in your AFL for further reading etc.
I did not know this existed. This will be very useful for me.
Oh and before I get someone posting that all these things (3D optimizations, metrics, equity curves, etc) are all available in AB, yes I am aware of that, and I have been using them for years. What the OP asked about was a research tool similar to Jupyter Notebook. What I have done isn't anything new, it's just a process I went through to allow me to do my backtesting and optimization in Amibroker (since I much prefer it as a backtester than Python alternatives), yet record my research and results in Jupyter Notebook. I'm sure with a level of expertise higher than mine, someone could have written everything in afl to get a similar result, but at my level, it was easier to do things this way and it fits my purpose (since I am already familiar with Jupyter Notebooks).
I came across this topic 2 weeks ago as I had a similar question. What I was doing before was just copying and pasting graphics in a Word document or Excel file and trying to organize things like that. After 5 years going back to these documents is painful and so much information gets lost.
What I have done in the last 2 weeks goes along the lines of something like this:
Learnt project files in AB work and created a project file to deal with each project I am working on and sometimes for each sub-project within a project. This helps me avoid the problem I was always having before of knowing exactly what backtester settings and start end dates I had. This would always lead to different results and drive me crazy.
In AB into my backtests I have included afl code that will write the a custom equity curve into a composite ticker.
I adapted an afl code that would export that ticker as a CSV file. For my optimizations I use the AB command to export the results as a CSV file.
I then start a Jupyter Notebook and reference the project and its location on my computer, so I don't forget what project I am referring to.
I wrote a python package with a bunch of functions that will have 2 main purposes:
A. Plot 3D optimizations and contour plots from CSV files (first changing to pandas dataframe, then using matplotlib).
B. Compare 2 different equity curves by plotting profits, drawdowns, market exposure, number of trades, annual profit by year, etc. Then spitting out a table comparing the metrics for each system.
Within the notebook I just call reach function and it spits out the plots and tables I want. This helps me optimize any parameters I want over an IS period, then carry out a validation check of the final equity curve against a base system (either what I am currently trading, or a benchmark, etc).
Since this is all I basically do with my analysis with AB, this fits my purposes.
Coding is not my specialty (I would call my AB skills mediore and python skills even worse) and it took me 2 solid weeks of work to put this together. So in that way it was much harder than I would have hoped. But reading back over the 5 steps I just wrote, it was actually easier in a way than I expected as well. I used the AB forum to figure out how to do some things, stack exchange and google for python issues I came up against. I borrowed some code snippets that were available on the web and took some from code I had purchased years and years ago.
Anyway, I just thought I could outline my process here, and it might be helpful to someone. Good luck!
I think I've figured out a way (at least for my own purposes) to link Amibroker and Jupyter Notebooks using the AmiPy plugin and Python nbformat module. I've explained it as best I can in this post: