Australian (ASX) Stock Market Forum

Amibroker FAQ

I don't use looping code very often so I'm not sure I can follow the structure of your code very well. What exit strategy are you trying to code?
 
When I run a portfolio back test I get a list of trades in the results window like it's run an individual back test. (see pic) From what I have read I should only be seeing one line in the results window with the ticker <portfolio> Is that correct? Why isn't my portfolio back test showing portfolio results? Any ideas? Thanks.
 

Attachments

  • PortBacktest.jpg
    PortBacktest.jpg
    161.6 KB · Views: 9
In the Automatic Analysis window click on Settings button. Then click on Report tab. Next to "Result list shows:" click either "Detailed log" or "Summary". I'm guessing the Results list is currently set to "Trade list".
 
When I run a portfolio back test I get a list of trades in the results window like it's run an individual back test. (see pic) From what I have read I should only be seeing one line in the results window with the ticker <portfolio> Is that correct? Why isn't my portfolio back test showing portfolio results? Any ideas? Thanks.

If you want the portfolio summary as in my screen-shot then you have to change the setting in "report" -> "result list show".
 

Attachments

  • untitled.png
    untitled.png
    28.9 KB · Views: 1
When I run a portfolio back test I get a list of trades in the results window like it's run an individual back test. (see pic) Thanks.

I notice your report shows additional columns beyond "scale in/out". My column selection does not have the same beyond this such as "initial risk". Can you tell how these additional columns are arrived at please? Thanks.
 
In the Automatic Analysis window click on Settings button. Then click on Report tab. Next to "Result list shows:" click either "Detailed log" or "Summary". I'm guessing the Results list is currently set to "Trade list".
Right you are captain. Thank you.
 
I don't use looping code very often so I'm not sure I can follow the structure of your code very well. What exit strategy are you trying to code?

Well for the exit strategy I'm using two variables:

1) First target - double my stop loss, 50% of position closed
2) Trailing stop - after first target is hit, stop loss moves to open price while trailing stop is equated to SAR()
 
Hi folks

I have a question in regards to objective function define by Howard in his book - I don't quite get what it is. Can someone provide an explanation or maybe a simple example.

Thanks in advance
 
Just a quick question.

Wish to click on a pane within a window and send the indicator to be analysed scanned. Can it be done without having to manually go to charts tab, locate indicator and right click and select, analysis.

Cheers
 
Just a quick question.

Wish to click on a pane within a window and send the indicator to be analysed scanned. Can it be done without having to manually go to charts tab, locate indicator and right click and select, analysis.

Cheers

One way would be to right click on the chart then select "edit formula". This opens the formula in the indicator builder window. You should have a button with a quotation mark on it that says "analysis" when you hover the mouse over it. Click that and the indicator formula will be loaded into the Automatic Analysis window. You'll need to make sure that the indicator code also includes code for scanning/exploration or backtest depending on what you wish to do.

I don't think it's less clicks this way but saves the hassle of searching through the charts tab for your indicator. There may be other ways, I'm still on my first coffee, the brain doesn't kick in until coffee number 2.... ;)
 
Greetings --

What page of what book?

What do you need help understanding?

Thanks,
Howard

Sorry for ambiguity in my question Howard.

The book I was referring to is "Quantitative Trading Systems". There isn't any specific page for my question, my question was rather general - what is an objective function? I understood that it is some sort of criteria that one picks as a cornerstone but that's about it..I'm missing a point :eek:? Or should I just keep reading the book and that point will be evaluated further in the text?

Thanks in advance
 
Hi Andruha --

An objective function is a metric used to allow comparison of alternatives. It is sometimes called a fitness function.

If you run several backtests for a given trading system, with each backtest being different in some way -- such as different lengths for moving averages -- the results of the tests will be different. As you look at the test statistics (compound rate of return, trading frequency, drawdown, etc), you will be able to sort the results into an order from best to worst according to your own preferences. The objective function is the formula that incorporates your preferences and computes a single numeric value for each of the alternatives. The one with the highest objective function is the one you prefer.

Quantitative Trading Systems discusses objective functions in several places, beginning with Chapter 4, page 49.

The very important point is this --

In order to perform statistical tests of validation on a trading system, there must be a sequence of trades that have made on data that was not used during the development of the system. One excellent way of doing this automatically is the walk forward test. When a walk forward test is performed, a lot of alternatives are tested using a data period called the in-sample data. The best is chosen and used to test a data period that follows the in-sample period and is called the out-of-sample period. The process continues for several steps, each time moving the dates forward. See Chapter 20, page 261ff. The objective function is used to rank the alternatives at each step and to determine which is best. If you have selected / designed an objective function that reflects your preferences, then the best alternative is the one at the top of the list. That is the one that AmiBroker, or whatever trading system development platform you are using, will use for the out-of-sample test.

Thanks for listening,
Howard
 
Simple way to optimize a strategy; PerA = Optimize("PeriodA", 3, 2, 10, 1);

No spin.
 
my question was rather general - what is an objective function? I understood that it is some sort of criteria that one picks as a cornerstone but that's about it..

Howard's already answered your objective function question so I wont add to that but will mention a thread on the AB user's list last year that had some great discussion regarding walk forward analysis. (follow the thread links at the bottom of the page)

http://www.mail-archive.com/amibroker@yahoogroups.com/msg44083.html
 
Howard's already answered your objective function question so I wont add to that but will mention a thread on the AB user's list last year that had some great discussion regarding walk forward analysis. (follow the thread links at the bottom of the page)

http://www.mail-archive.com/amibroker@yahoogroups.com/msg44083.html

Hi Andruha --

An objective function is a metric used to allow comparison of alternatives. It is sometimes called a fitness function.

If you run several backtests for a given trading system, with each backtest being different in some way -- such as different lengths for moving averages -- the results of the tests will be different. As you look at the test statistics (compound rate of return, trading frequency, drawdown, etc), you will be able to sort the results into an order from best to worst according to your own preferences. The objective function is the formula that incorporates your preferences and computes a single numeric value for each of the alternatives. The one with the highest objective function is the one you prefer.

Quantitative Trading Systems discusses objective functions in several places, beginning with Chapter 4, page 49.

...

Thanks for listening,
Howard

Thanks for your help guys - really good explanation by Howard. I haven't got to the part about walk forward testing yet, but I'll be there soon. It's good to have an author of the book on this forum - the original creator can clarify so much with little effort :).

Thanks for the link Cap - I'll check it out when I get home tonight :p:.

One more question before I stop bothering AB gurus for sometime - assuming that I have a few "preferences" (i.e. expectancy, avg. winner, avg. loser) how does one define (in mathematical sense) an objective function (which, as per Howard explanation, is a single number encompassing all preferences)? Or does AB does it automatically and you just have to tell it which preferences you pick?

Thanks in advance
 
One more question before I stop bothering AB gurus for sometime - assuming that I have a few "preferences" (i.e. expectancy, avg. winner, avg. loser) how does one define (in mathematical sense) an objective function (which, as per Howard explanation, is a single number encompassing all preferences)? Or does AB does it automatically and you just have to tell it which preferences you pick?
Thanks in advance

You are able to define/code your own custom metric in your code then add it to the optimization target settings for performing a walk forward run. In the settings window in Automatic Analysis window click on the "walk forward" tab. You'll see a drop down menu next to "optimization target". You can use one of the predefined metrics or add your own (make sure it's identical to the metric you define in your code).

Personally I've found CAR/MDD as a target metric works well for both systems I trade although both are fairly robust anyway and have been traded live for many years which I guess is the ultimate form of walk forward testing ;)

The link below is a search for "custom metric" in the Amibroker user's group. Should be plenty in there to keep you entertained for a while :)

http://www.google.com.au/search?hl=...rebytes+amibroker&aq=f&aqi=&aql=&oq=&gs_rfai=
 
Top