Australian (ASX) Stock Market Forum

Amibroker FAQ

I'm trying to do a backtest on particular sectors in the US stocks database. For some reason when i specify the sector, it just tells me there are no symbols to test, even if i specify the NYSE, or the S&P500, etc...

Can, sectors things like 'health care', ' utilities' and the like.

NYSE is an exchange, S&P500 is an index .....

Maybe you have a db config issue some other settings problem.

There should be a drop down in the selection box showing what sectors you can pick,
 
Can, sectors things like 'health care', ' utilities' and the like.

NYSE is an exchange, S&P500 is an index .....

Maybe you have a db config issue some other settings problem.

There should be a drop down in the selection box showing what sectors you can pick,

From PD support...

Try removing the Sector filter.
We are no longer populating the 2-level Sectors/Industries in AmiBroker. Instead, the GICS and ICB fields are now being populated to all 4 levels.

Will have a play now...
 
If I was going to learn a programming language, such as C, C#, C++ etc, which would best compliment .AFL ?
I thought I read somewhere that .afl was most like C++, but not sure where I read that.

Cheers.
 
If I was going to learn a programming language, such as C, C#, C++ etc, which would best compliment .AFL ?
I thought I read somewhere that .afl was most like C++, but not sure where I read that.

Cheers.

From another forum....

So although it looks like C it is way more easy than C. What is single operator in AFL (like array addition) involves many line of code in C plus memory allocation/deallocation (and keeping track on all that). SIMPLICITY OF USE plus compactness of code is the paramount design decision. That's why arrays in AFL are automatically managed, have size that automatically refers to "visible" area, so you can simply add arrays with single + operator. With general purpose C language with "normal" arrays you would need to manage memory for arrays by yourself, alignment (if size differs which elements to add), looping (you need to perform calculations on individual elements of array). (maybe you don't know but in C and there are no built-in dynamic arrays, only fixed compile-time size is supported, and dynamic array is implemented via pointers and explicit memory allocation malloc/free)

As for "matrix" operations - that this does not belong to the definition of any general purpose language.

There are no "matrix" operations in any popular general purpose language C/C++/Java/JScript/Basic/Pascal. In C/C++ even scalar trigonometric operations like sin( x) or string concatenation are NOT part of the language.

The language itself defines:
a) syntax
b) basic arithmetic operators + precedence working on primitive types only (scalar integer and/or float)
c) flow control (conditional execution, loops)
d) structural concepts (variables/functions/procedures/structures/objects)
e) some miscellaneous stuff like run-time type info, exception handling etc.

And that's it.

Anything more is supplied by LIBRARIES. In C there is a library for basic string manipulation (such as concatenation - strcat) or floating point. The same with any high-level stuff like matrices - this is the area which is implemented by EXTERNAL libraries (not part of the language).
Libraries in AFL can be provided by:
a) #include - the AFL code implementing features via functions
b) AmiBroker Development Kit - allowing to write extensions (functions) as a DLL in any compiled language.
c) JScript/VBScript d) any external COM object http://www.amibroker.com/guide/a_aflcom.html

This covers any imaginable application and any imaginable need you may have.
.
.
.

Best regards,
Tomasz Janeczko
amibroker.com

From a forum member...

AFL has syntax similar to C language and JScript. On top of that it adds native array operations.
 
If I was going to learn a programming language, such as C, C#, C++ etc, which would best compliment .AFL ?
I thought I read somewhere that .afl was most like C++, but not sure where I read that.

Cheers.

Hi Abyss --

While none of the programming languages are directly applicable to increasing your skill using AmiBroker, learning more about how computers work and how computer scientists think does help. In particular, once you know how computers work (memory, cpu, hard disk, the fetch-execute cycle, etc), learning about data structures and algorithms is very helpful. I highly recommend Allen Downey's book, "Think Python: Thinking Like a Computer Scientist." You can buy a printed copy, or download a free e-book:
http://www.greenteapress.com/thinkpython/

Dr. Downey has several other excellent books, also both free and printed.

Beyond those, look at the on-line educational materials available through Coursera (as a start -- there are others). They provide university level courses in data structures, algorithms, programming, logic, etc, etc.
https://www.coursera.org/

Best regards,
Howard
 
Thank you Howard, much appreciated.

When is your next book due for release? I'm probably over due to go back and read your other books again and try and pick up a bit more of what your putting down in those books :banghead: << reversing mr headbanger here would be appropriate in my case. I admit to not being your best advertisement, " could do a lot better and distracts easily" were familiar quotes on my reports.....I can just imagine some of the quotes after I left school, but lets move on from there shall we.:frown:

Abyss
 
Thank you Howard, much appreciated.

When is your next book due for release?

Abyss

Hi Abyss, and all --

If things stay on schedule, the new book should be available about May, 2014.
http://www.quantitativetechnicalanalysis.com/

But I have several other projects with firm deadlines that might cause the book to be delayed.

Among them is preparation for the ATAA Conference, Melbourne, May, 2014.
http://www.ataa.com.au/conference-overview.html

I will be making two presentations. They roughly divide into the development of trading systems and the management of trading.

Part I has some new material that I think will be interesting to all traders, with an emphasis on systematic traders. This description comes from the Conference website:
The trading system development presentation will discuss measuring success, issue selection, the two components of a trading system (the model and the data), identification of patterns that precede profitable trades, in-sample data analysis, out-of-sample system testing, and methods for validation.

Part II has more new material -- a new, original, unique, and effective method for dynamically determining the maximum safe position size. This presentation applies to all traders, discretionary as well as systematic.
The trading management presentation will discuss a new and unique Bayesian approach that continually monitors system performance, determines risk of drawdown, assesses the personal risk tolerance of the trader, computes the maximum safe position size, and estimates profit potential. It includes techniques for determining the health of a system, readjusting the system as necessary, and deciding if and when to take it offline before serious loss of trading capital.

I spoke at the 2009 ATAA Conference, which was also held in Melbourne. Everything about that conference was excellent. I am looking forward to this one which I expect to be outstanding. I am impressed with the qualifications of the speakers and the appropriateness of their topics. I am looking forward to many excellent presentations. And to renewing friendships with many of the members of this forum whom I met and have corresponded with.

Best regards,
Howard
 
Hello all. I was hoping that I could get some opinions on an AFL that I created. Is this a data snooping bias? In other words, is it triggering trades on information in the future that it should not yet know? I'm backtesting it and getting so-so results, but before I build on it, I just wanted to make sure. "a" and "b" are just simple crossover criteria not shown here.

---

Buy = a AND (H!=O) AND TimeNum() > 093000 AND TimeNum() < 150000;
Sell = b AND (L!=O) OR TimeNum() >= 155000 AND TimeNum() <= 160000;

BuyPrice = ValueWhen(Buy,O,1);
SellPrice = ValueWhen(Sell,O,1);

Buy = Ref(Buy,-1);
Sell = Ref(Sell,-1);

---

Thank you so much.
 
Kfink, looks like they are all on holiday, but have you tried, - /formula editor/tools/code check and profile/ ?
It tells you whether the program thinks you may have a future leak. Not sure if thats the definitive answer as to whether it has a leak or not, I did ask that question before but didnt get an answer.

Can anyone point me in the right direction here please;

I have set up an IB acct and connected to their data via amibroker ( very impressed with how easy that was actually, a credit to AB ).
I can access US tickers easily when I type them in, but how do I connect to ASX tickers?
I have subscribed to ASX data ( at least I went through the motions to the best of my knowledge at the time).
Also, do I have to manually input every ticker again and set up watch lists that I want to monitor when I log in to IBs data?

Thanks for your time.
 
Equivolume chart

I feel that I am in the wrong place, I need assistance in obtaining the code for the attachment. I am an AB user. I have the above indicator, that is the top chart. I am looking for the bottom chart indicator. The above indicator "EquiVolume" can be obtained from the AB site, it was written by a A. Pipa.

Thanks in advance,
Ian
 

Attachments

  • 04 EquiVolume.png
    04 EquiVolume.png
    26.5 KB · Views: 133
Re: Equivolume chart

I feel that I am in the wrong place, I need assistance in obtaining the code for the attachment. I am an AB user. I have the above indicator, that is the top chart. I am looking for the bottom chart indicator. The above indicator "EquiVolume" can be obtained from the AB site, it was written by a A. Pipa.

Thanks in advance,
Ian

http://www.amibroker.com/library/detail.php?id=1433
 
Re: Equivolume chart

Hello,

I have been to the above site previously, and the above pane is OK, it is the bottom pane, I am unsuccessful in obtaining. The above pane consists of OHLC and Volume, resulting in the various thickness in the bars.

I guess that the bottom pane would be similar, GFX low graphics, bars minus the OHLC. I am enclosing an attachment of a chart without the bottom indicator. My eyes are used to seeing the Volume at the bottom. If someone can provide the code for the bottom pane, I will be most grateful. Here goes !!


ANZ.jpg
 

Attachments

  • 04 EquiVolume.png
    04 EquiVolume.png
    26.5 KB · Views: 121
Can anyone point me in the right direction here please;

I have set up an IB acct and connected to their data via amibroker ( very impressed with how easy that was actually, a credit to AB ).
I can access US tickers easily when I type them in, but how do I connect to ASX tickers?
I have subscribed to ASX data ( at least I went through the motions to the best of my knowledge at the time).
Also, do I have to manually input every ticker again and set up watch lists that I want to monitor when I log in to IBs data?

Thanks for your time.

I have resolved the above for anyone else looking for the answer theres a post in this forum

https://www.aussiestockforums.com/forums/showthread.php?t=19540
 
Howdy! This is my first post here. I've been struggling with this bit of code for a while now, and could use a hand from you seasoned experts.

Above each peak and below each trough, I want to plot three lines of text. I am able to do so with some simple code using the PlotText function.

I am having a hard time with setting the specific locations. Especially with logarithmic charts. The plottext function only seems to accept the y location in price format, which can be all over the place depending on your zoom level and linear/log scale.

See screenshot:
amibroker.png

I was able to set the number of pixels as a spacer and convert it to price using code similar to this:

Code:
yrange = Status("axismaxy") - Status("Axisminy");
prange = Status("pxchartbottom") - Status("pxcharttop");
toplabelmargin = 0;
bottomlabelmargin = 0;

px = 25;
ypos3 = (px*yrange)/prange + High[i] + (toplabelmargin*yrange)/prange;

And this works ok for linear scales, but not for log scales. I haven't yet figured a way to get this to work.

Any help would be appreciated. Thanks!

Steve
 
Hi,
Any ideas whats wrong with this buy/sell code, It buys and sells just fine without the "< BuyLevel & > SellLevel"
statements added at the cross of "value 4" and "trigger", though not at the level required, but the system wont buy or sell with those statements added. I've tried different variations but to no avail.

Your help would be much appreciated thanks!

///////
Value4 = 2 * ( WMA( Value3, WMA_Length ) - 0.5 );
Trigger = Ref( Value4, -1 );

BuyLevel = Optimize ("BuyLevel", -1.0, -1.0, 0, 0.1 );
SellLevel = Optimize ("SellLevel", 0.8, 0, 1.0, 0.1 );

BuySignal = Cross(Value4, Trigger);
SellSignal = Cross(Trigger,Value4);

Buy = BuySignal < BuyLevel;
Sell = SellSignal > SellLevel;
 
Hi,
Any ideas whats wrong with this buy/sell code, It buys and sells just fine without the "< BuyLevel & > SellLevel"
statements added at the cross of "value 4" and "trigger", though not at the level required, but the system wont buy or sell with those statements added. I've tried different variations but to no avail.

Your help would be much appreciated thanks!

///////
Value4 = 2 * ( WMA( Value3, WMA_Length ) - 0.5 );
Trigger = Ref( Value4, -1 );

BuyLevel = Optimize ("BuyLevel", -1.0, -1.0, 0, 0.1 );
SellLevel = Optimize ("SellLevel", 0.8, 0, 1.0, 0.1 );

BuySignal = Cross(Value4, Trigger);
SellSignal = Cross(Trigger,Value4);

Buy = BuySignal < BuyLevel;
Sell = SellSignal > SellLevel;

Buysignal and Sellsignal are conditions that return true or false!
 
Thanks Trash,

Then why doesnt this buy/Sell with the "< BuyLevel" included in the statement?
Any suggestions to get this to buy/Sell at the buy/sell levels? Works fine without the level statements

////
Value4 = 2 * ( WMA( Value3, WMA_Length ) - 0.5 );
Trigger = Ref( Value4, -1 );

BuyLevel = Optimize ("BuyLevel", -1.0, -1.0, 0, 0.1 );
SellLevel = Optimize ("SellLevel", 0.8, 0, 1.0, 0.1 );

Buy = Cross (Value4, Trigger) < BuyLevel;
Sell = Cross (Trigger, Value4) > SellLevel;
////
 
OK, this works;

Buy = Cross (Value4, Trigger) <= BuyLevel;
Sell = Cross (Trigger, Value4) >= SellLevel;


Any ideas why that is please ?
 
It seems you don't understand what I'm talking about.

Cross function is bool. It is either true or false. True is equal to 1 and false is equal to 0. It does not return anything else. So to add < > to that and set additional buy an sell levels makes no sense.

Explain what do you wanna do.
 
Top