Australian (ASX) Stock Market Forum

Amibroker FAQ

Hi.

I recall using a piece of code which gave me the volatility of stocks in my explorations. It enabled me to sort my results and filter out stocks that were unlikely to move much.


It was only a couple of lines long. I think I got it from one of Nick Radge's books. Adaptive Analysis.

Does anybody have this code or something similar? Thanks
 
I use Premium Data and sometimes when I run an exploration for n last quotation (1) the present day quotation doesn't appear. The day before quote appears but the chart displays the present day quotations from my EOD Final download. I have tried running the maintenance tool but no diff.

Anyone have this issue?
 
I use Premium Data and sometimes when I run an exploration for n last quotation (1) the present day quotation doesn't appear. The day before quote appears but the chart displays the present day quotations from my EOD Final download. I have tried running the maintenance tool but no diff.

Anyone have this issue?

No, check your code or upload a reproducible example. Or perhaps you have pad&align enabled and reference symbol has missing last quote.
 
No, check your code or upload a reproducible example. Or perhaps you have pad&align enabled and reference symbol has missing last quote.
That is it thank you. The pad & align symbol did not have the most recent quote.
 
Can anyone please explain these figures to me?

I just wanted to add the parabolic trailing stop with an initial stop below the low of the first day of a gap. I can optimize acceleration factors later on and I wanted to enter after the close/next day open. However not sure what all the figures and functions in the photos below do?

Thanks in advance

sar1.jpgsar2.jpgsar.jpg
 
Hi Darkhorse --

Explain what?

The program is a complete example of use of looping code to implement a trailing exit. The code has been written for clarity (not necessarily efficiency).

What would help? An explanation of an assignment statement? Of a for loop? Of an if-then-else statement? Of a test for equality? Those are all in the book you have photocopied, in the "Introduction to AmiBroker" book, and in the tutorial materials on the AmiBroker website.

There is no alternative. Everyone developing trading systems must be a competent programmer and a competent mathematician / statistician.

If this code is too complex, use the chandelier trailing exit that can be implemented in a single line -- see the last line on page 102.

But that does not reduce the need to understand how to plan, program, test, and validate a trading system.

Best regards,
Howard
 
Howard for example for LBDAYS its been optimized but what exactly are the number combinations reffering to in the bracket.

Im ok at mathematics, failed stats a few times at uni and have no programming skills. I can understand equations. I guess ill have to focus harder.

Ive read a third of the book and thought I should start trying to implement some of the stuff.

To my suprise ive gotten further than expected.

Anyway Howard, im sure ill figure it out. Thanks for the feedback.

Best wishs

Patrick
 
It is all in the manual called Amibroker User Guide - Optimise - Define optimisation variable.

My use of optimise is to find the sweet spot for that particular part of historical data. In real time the results will unlikely be the same since there are many variables that make up a price.

Premium Data is compatible with Amibroker and an EOD download from your computer with their downloader is how you get the data. (to answer your p.m.)
 
Hi Darkhorse --

Optimize is described in detail in the "Introduction to AmiBroker" book. Begin on page 511.

And in Exercise 8 of Chapter 3. Begin on page 91.

Read, read, read.

Best,
Howard
 
Thamks Howard. Im going to re - read the book from the beginning. I think things will be much more clearer now that ive familiarized myself with the program abit (it was very clear already by the way).

Ive already produced a system with a 13% annual return and 23% risk adjusted return. I can easily increase the exposure by adding one more complete index list, with only a 23% max DD and 40% win rate. It doesnt have many rules, but seems to good to be true. Most likely sample bias or one of many errors outlined in your books.

Have to go back and re read and test it, then test it on out of sample data. To be honest I manually tweaked alot of the parameters till I got the highest value, hence its probably curve fitted?

Anyway thanks Howard and im glad this book was written.

Parrick
 
I'm completely new to amibroker and most of it's functions. But is there a way to record the buy price? e.g. Don't sell price is higher than the price bought?
 
e.g. Don't sell price is higher than the price bought?

Do you mean that you don't wanna sell as long as price is higher then price at buy?
Sure it is possible to always sell in loss.
tongue.gif

Here it always sells 5 ticks below price at buy.
ay9A7Pi.png

Anyway if you look for stop loss then you may either use ApplyStop or loop.
 

Attachments

  • ay9A7Pi.png
    ay9A7Pi.png
    103.7 KB · Views: 1
What about mixing that with another system.

e.g. Sell: Open is less than movingAverage AND Open is greater than buyprice.

Something kinda opposite to applystop. Don't stop until conditions are met.
 
What about mixing that with another system.

e.g. Sell: Open is less than movingAverage AND Open is greater than buyprice.

Something kinda opposite to applystop. Don't stop until conditions are met.
Someone can help you but you have to be more accurate with the orders you want. Supply all of the buy and sell criteria and it can be done for you to get you started.
 
What about mixing that with another system.

e.g. Sell: Open is less than movingAverage AND Open is greater than buyprice.

Something kinda opposite to applystop. Don't stop until conditions are met.

Sure, below in the pic you can see a sample result. It may run fine in an uptrend but then there is that one single trade that wipes out all of it again.
eU0HoXu.png
 

Attachments

  • eU0HoXu.png
    eU0HoXu.png
    135.6 KB · Views: 1
Anyone know how to determine the daily high of an instrument and then figure out when it occurred (date/time)?

HHV function just gives me the highest value.
I use TimeFrameGetPrice( "H", inDaily, 0 ) to get the daily high, but I have no clue how to extract when that occurred.

Any help is appreciated.
 
Anyone know how to determine the daily high of an instrument and then figure out when it occurred (date/time)?

HHV function just gives me the highest value.
I use TimeFrameGetPrice( "H", inDaily, 0 ) to get the daily high, but I have no clue how to extract when that occurred.

Any help is appreciated.

For example use Exploration

Code:
Dh = TimeFrameGetPrice( "H", inDaily, 0 );
Filter = H == DH;
AddColumn( DH, "Day_High", 1.4, colorGreen, colorDefault, 80 );
 
Anyone know how to determine the daily high of an instrument and then figure out when it occurred (date/time)?

HHV function just gives me the highest value.
I use TimeFrameGetPrice( "H", inDaily, 0 ) to get the daily high, but I have no clue how to extract when that occurred.

Any help is appreciated.

Hi Waterbottle --

See if the ValueWhen function is what you are looking for.

http://www.amibroker.com/guide/afl/valuewhen.html

Best,
Howard
 
Hi Waterbottle --

See if the ValueWhen function is what you are looking for.

http://www.amibroker.com/guide/afl/valuewhen.html

Best,
Howard

Hi Howard,

I have used the valuewhen function but the output data is disorganized and sometimes incorrect. I am using the following AFL code with the Explore utility:
Code:
Filter=1; 
AddColumn(O,"Open", 1.6); 
AddColumn(H,"High", 1.6); 
AddColumn(L,"Low", 1.6); 
AddColumn(C,"Close", 1.6); 
/*AddColumn(V,"Volume",1.0); 
AddColumn(OI,"Open Interest",1.0); */

AddColumn(TimeFrameGetPrice("H",inDaily,0), "HHV", 1.6);
AddColumn(ValueWhen(TimeFrameGetPrice("H",inDaily,0)==H, DateTime()), "Date/Time", formatDateTime);

The have set the Explore utility on a 5-min periodicity under 'General settings' as I want the result to return which 5 min bar the daily high had occurred on.

This is an example of the output data:
example.png

From the example above, it seems as though the DateTime() function is waiting for the Explore utility to actually reach the correct bar before it prints the correct data. I am not sure why it is doing this when it should already have the correct data when it compared the High array to the TimeFrameGetPrice array.

How can I fix this?

Cheers
 
Top