Australian (ASX) Stock Market Forum

Amibroker FAQ

Can someone help me with a custom column for a backtest please?

I want to see the holding time in bars (rather than days).

Thanks.
 
Finally bit the bullet and paid for Amibroker and premiumdata.net. I have downloaded the data but I did not realise that options were downloaded as well. Is there any way to delete the options?
 
Finally bit the bullet and paid for Amibroker and premiumdata.net. I have downloaded the data but I did not realise that options were downloaded as well. Is there any way to delete the options?

Just delete the ETOs folder. Also delete the Warrants folder if you don't want them too.
i.e. delete C:\Trading Data\Stocks\ASX\ETOs

Click the Update button.

Then in AmiBroker run Tools->ASX-PremiumData which will remove them from within AmiBroker.
 
Hi guys

could someone point me in the right direction, i have a mean reversion strategy that can produce alot of signals on any given day, but only a handful will get filled. i want to simulate in a backtest the results if i only put orders in for the top 20 signals rated by their ROC. at the moment i have ranked the signals and the top ones get filled first, but say for instance the top 15 get filled and the ones ranked 15-20 dont meet my limit order then the remaining positions in my portfolio will get filled by stocks ranked outside the top 20, but i dont want this too happen i would only want to hold 15

Thanks
 
Hi guys

could someone point me in the right direction, i have a mean reversion strategy that can produce alot of signals on any given day, but only a handful will get filled. i want to simulate in a backtest the results if i only put orders in for the top 20 signals rated by their ROC. at the moment i have ranked the signals and the top ones get filled first, but say for instance the top 15 get filled and the ones ranked 15-20 dont meet my limit order then the remaining positions in my portfolio will get filled by stocks ranked outside the top 20, but i dont want this too happen i would only want to hold 15

Thanks

Something like this?

SetOption("MaxOpenPositions", 15 );
Positionscore = ROC(C,1); // make sure only to buy at close, otherwise use Ref(ROC(C,1),-1)
Buy = ROC(C,1)>x; // limit here with x.
 
Something like this?

SetOption("MaxOpenPositions", 15 );
Positionscore = ROC(C,1); // make sure only to buy at close, otherwise use Ref(ROC(C,1),-1)
Buy = ROC(C,1)>x; // limit here with x.

my portfolio is still max 20 positions but if 15 or 18 or 7 positions hit their limit order the next day i dont want the remaining spots in my portfolio filled by stocks ranked outside the top 20. i am trying to simulate only entering the top 20 orders into my broker
 
Requesting help..

I sent an email to Amibroker help concerning a problem I have.

THE PROBLEM
1. I Trade a weekly strategy - When I run a Backtest for BUY and SELL signal on a Friday Night after the Australian Securities Exchange (ASX) closes
2. The Backtest results on Friday night displays the opening price on the start of the week and not the CLOSING price at the end of Trade on Friday.

WHAT I PREFER TO HAPPEN

1. The Backtest report on Friday night to DISPLAY the CLOSING price on Friday for any BUY or SELL results.

AMIBROKER'S ANSWER TO ME..
Since this feature was built in DAILY periodicity tests in mind, with weekly periodicity, now the program reads CLOSE price, but one week ago from the underlying data (so it would actually be Monday close in such case and that’s where this reading comes from).

Incorrect price Capture.JPG

MY QUESTION
Is there a work around so that the Backtest Scans use the closing price of Friday (the end of the week) to calculate the BUY and SELL positions to be placed before the opening on Monday?

skate
 
AMIBROKER'S ANSWER TO ME..
Since this feature was built in DAILY periodicity tests in mind, with weekly periodicity, now the program reads CLOSE price, but one week ago from the underlying data (so it would actually be Monday close in such case and that’s where this reading comes from).

What feature?
Are you using time frame functions?

Perhaps you should upload some dummy project file for people to know what you are talking about since no one is able to look over your shoulders. "What is a project file?" Read here http://amibrokerforum.proboards.com/thread/57/analysis-project-files-apx
 
I guess by "feature" you are referring to "Add artificial future bar".
Well then uses time frame functions looking from daily to weekly.
 
I guess by "feature" you are referring to "Add artificial future bar".
Well then uses time frame functions looking from daily to weekly.

Hi Trash

You are correct, "Add artificial future bar" is the feature I'm talking about as I need this function to display the BUY/SELL signal for Monday.

The time frame function wasn't a suggestion from AmiBroker Help Desk to overcome my concern and thinking about time frame function it makes perfect sense. After reading about the function it's beyond me to apply it to my code correctly.

I would be very appreciative if you would be able to supply me the line of code so that AmiBrokers calculations incorporate Fridays closing price INSTEAD of the closing price in an earlier time frame.

skate
 
Requesting help..

I sent an email to Amibroker help concerning a problem I have.

THE PROBLEM
1. I Trade a weekly strategy - When I run a Backtest for BUY and SELL signal on a Friday Night after the Australian Securities Exchange (ASX) closes
2. The Backtest results on Friday night displays the opening price on the start of the week and not the CLOSING price at the end of Trade on Friday.

WHAT I PREFER TO HAPPEN

1. The Backtest report on Friday night to DISPLAY the CLOSING price on Friday for any BUY or SELL results.

AMIBROKER'S ANSWER TO ME..
Since this feature was built in DAILY periodicity tests in mind, with weekly periodicity, now the program reads CLOSE price, but one week ago from the underlying data (so it would actually be Monday close in such case and that’s where this reading comes from).

View attachment 65061

MY QUESTION
Is there a work around so that the Backtest Scans use the closing price of Friday (the end of the week) to calculate the BUY and SELL positions to be placed before the opening on Monday?

skate

The Sell signal for IFN is correct because of the ApplyStop in your code. It is set for a trailing stop of 10%. The weekly high for IFN is 0.455. Therefore the trailing stop level is 0.455 - 10% which is 0.4095. The low of the bar was 0.405 which is less than the trailing stop level and therefore a Sell is triggered.

From the Applystop function reference:
ExitAtStop = 2 - check High-Low prices but exit NEXT BAR on regular trade price.
 
The Sell signal for IFN is correct because of the ApplyStop in your code. It is set for a trailing stop of 10%. The weekly high for IFN is 0.455. Therefore the trailing stop level is 0.455 - 10% which is 0.4095. The low of the bar was 0.405 which is less than the trailing stop level and therefore a Sell is triggered.

From the Applystop function reference:

Thanks, I now understand...

skate.
 
Hello all.

I'm trying to develop a couple of systems where I exit on the Friday - or the last trading day of the week.

I seem to be having trouble with the timeframe expand etc to get the exits that I want - given the occasional public holiday etc.

The entries are based on daily bars. These don't have indicators attached to them for now.

Is there some basic structure to the code that will solve my problem. Rather than holding until the following week? Because all the tutorials focus on using multi timeframe indicators for entries and exits, rather than multi time frame bars themselves.

Cheers,
Chops.
 
Hello all.

I'm trying to develop a couple of systems where I exit on the Friday - or the last trading day of the week.

I seem to be having trouble with the timeframe expand etc to get the exits that I want - given the occasional public holiday etc.

The entries are based on daily bars. These don't have indicators attached to them for now.

Is there some basic structure to the code that will solve my problem. Rather than holding until the following week? Because all the tutorials focus on using multi timeframe indicators for entries and exits, rather than multi time frame bars themselves.

Cheers,
Chops.

G'day Chops,

I'm probably misunderstanding your question but if your entry is based on daily bars then to exit on a Friday you would also exit using daily bars with the following:

Code:
sell = dayofweek() == 5; // sell on Friday

https://www.amibroker.com/guide/afl/dayofweek.html

Your reference to timeframe functions is what makes me think I'm misunderstanding your question?
 
That's correct.

But because of public holidays etc. I'm getting holding periods that are longer than what I want.

e.g. 8-9 days rather than 3-4 days.

So, to eliminate the errors caused by the Friday holidays, I'm trying to use the close price on the weekly bar. Rather than dayofweek() ==5.

Does that make sense?
 
That's correct.

But because of public holidays etc. I'm getting holding periods that are longer than what I want.

e.g. 8-9 days rather than 3-4 days.

So, to eliminate the errors caused by the Friday holidays, I'm trying to use the close price on the weekly bar. Rather than dayofweek() ==5.

Does that make sense?

One way to force a sell on a Thursday would be to set up a file of Friday public holiday dates and include it in your formula. Set one of your sell conditions to loop through the dates and use an iif statement to either sell on Thursday if the date matches a Friday holiday date or sell on Friday on any other date.

There's not a big number of Friday holidays each year (Good Friday & Xmas day this year) so wouldn't take much setting up depending on how long your testing period is.
 
That's correct.

But because of public holidays etc. I'm getting holding periods that are longer than what I want.

e.g. 8-9 days rather than 3-4 days.

So, to eliminate the errors caused by the Friday holidays, I'm trying to use the close price on the weekly bar. Rather than dayofweek() ==5.

Does that make sense?

What kind of holidays are you talking about since there are not many holidays on Friday?

As for US and UK holidays those can be translated to a general code working for every year there is so there is no need to make a lengthy list for each and every year (though latter one is a basic step that would work too).
 
One way to force a sell on a Thursday would be to set up a file of Friday public holiday dates and include it in your formula. Set one of your sell conditions to loop through the dates and use an iif statement to either sell on Thursday if the date matches a Friday holiday date or sell on Friday on any other date.

There's not a big number of Friday holidays each year (Good Friday & Xmas day this year) so wouldn't take much setting up depending on how long your testing period is.

Yeah. I was hoping not to have to do that, but I will concede defeat.

What kind of holidays are you talking about since there are not many holidays on Friday?

As for US and UK holidays those can be translated to a general code working for every year there is so there is no need to make a lengthy list for each and every year (though latter one is a basic step that would work too).

It's mainly the good Friday that seems to be the problem. As any other can be screened out with a code that works for each year.

But if anyone has already done that leg work, that'd be awesome, and save me some time.
 
Top