AmiBroker - much more than just ordinary technical analysis software

exploration
Tags: #<Tag:0x00007fb3e0294b40>

#1

AmiBroker is so versatile, that it allows users without IT background or sophisticated programming skills, achieve very interesting results. Let me show you an example of using newly introduced ( AmiBroker 6.17 ) functions: InternetOpenUrl() and InternetReadString(). I haven’t seen any implementations of these functions yet. They opened a wide area of application. Now we can easily combine in one AFL data coming from technical and fundamental analysis and news flow from many different sources. I show two examples of using AmiBroker for Web scraping (data extraction). Who would guess that Amibroker is really good for that? :wink: Instead of using specialized software (or in addition to it) everyone can quite easily extract any data from a web page. An RSS like news stream can be created from web pages which does not provide this functionality. Downloading a html code, processing it and displaying the results usually takes fractions of seconds. The limiting factor here is the responsiveness of the server hosting a web page. No unnecessary information, no ads (much less processor overhead) - just raw data that someone needs. Usually you don’t even have to download the whole html code - you can stop at the line which contains the last information you need. Here I present the data collected from one of many investment forums and two investment newspapers’ web pages. Thanks to the auto-repeat function, data can be downloaded/updated regularly and user can be notified about new messages, articles etc. by an email, SMS, speech synthesis or in any other way. A very useful feature for a news-trader like me :slight_smile: I still use specialized software to extract data from more sophisticated news sources which requires logging and authentication but AmiBroker became a great and a very light tool for most typical uses.

The results are presented using AddRow() - another interesting function which was introduced not long time ago. I only wish it could be possible to color/highlight some rows so they can stand out from others (similar to AddColumn() and AddTextColumn()). Maybe Tomasz considers expanding AddRow() function in the future. In this case I used “#” and “-” in a separate column to mark the newest messages.

First example. The source: Forum. Extracted data presented in Exploration output:


Second Example. The sources: PB and Parkiet Data extracted from two sources combined and presented in one Exploration output:


Because @Tomasz wrote in some other post, that “only 1 person per 100 sends something else than complaints and his batteries are running out” I wanted to show that there are many users who appreciate his hard work, dedication and the great software he creates.

I hope we see some other examples from other users soon :wink:

ps. This is my first post on the new Discourse forum and I think it is a great place for exchanging views and seeking other users’ help.

Best regards - Miłosz


Data extraction from website
Buttons Hunter - The Game for AmiBroker 6.25
Web scraping / data extraction problem
String output in Exploration (i.e. percent sign)
#2

Great post Milosz :slight_smile:

I’ve had a break from trading for a few months but have been back coding again the last couple of weeks and have been very excited by some of the new functions and changes in Amibroker since I’ve been away. The only limits are our imagination :slight_smile:


#3

Wow! Really impressive. Thanks a lot for sharing and spreading the word about AB and replenishing batteries :slight_smile: I appreciate that you took the time to compose all those examples to present them here.
Keep it up Miłosz!


#4

Considering there are 15000 Yahoo (soon to be Forum) subscribers the number
of complains I see is minuscule. It is only the occasional emotional
response that puts them in the limelight.

It is human nature to ask for more or disagree, this is what “discourse” is
all about.

However, there ought to be a category where we can post positive comments
and/or share special accomplishments. Perhaps something like “Why I use
Amibroker”, “My Amibroker Edge” or “How I use Amibroker”. Negativism should
be banned.

Happy trading,
Herman (happy user)


#5

2 posts were merged into an existing topic: Editing of old posts and missing ‘like’


Editing of old posts and missing 'like'
#6

Good point Herman, Amibroker is among the best software when it comes to crunching price data numbers and not only for someone that knows how to use this software the question if he can accomplish certain things with it becomes which is the shortest and fastest way of doing it.
Its also possible that “SpinTrader” the name that you use in the forum comes from the fact that it makes your head spin when you thing about the many possibilities in which you could accomplish the same thing and you don’t know which path to take - it happens to me also :))
I don`t think negativism should be banned I believe it only comes from lack of knowledge in using Amibroker, I think it will disappear almost completely with this forum.

Amibroker is great, thank you Tomasz


#8

Thank you for the kind words :slight_smile:

If someone would like to study in more details AddRow() function - which was used in the examples above, he/she can visit this thread: link and find even more information and AFL example codes here: link These tutorials were created by @fxshrat

I also recommend visiting this thread: [link] (http://amibrokerforum.proboards.com/thread/100/achievable-using-tiny-bit-imagination) (created by @fxshrat ) for more examples showing what is achievable in Amibroker. It is a really good source of inspiration.

ps. I wonder how can I edit my first post? I can’t find any EDIT options or a little pencil icon which enables editing…

EDIT : I can edit this post, but not the first one.


Editing of old posts and missing 'like'
#9

Agreed. Negativism should be discouraged. I’ve posted regularly on another forum (Aussie Stock Forums as Captain Black) in the Amibroker section but have been posting there less and less because of the negative tone in the “General Chat” area of the forum. Hopefully we can keep this forum on a positive note.

In that spirit I’ve changed my avatar to a picture of one of my Labradors with his holiday hat on. No-one could be negative about a cute dog :slight_smile:


#10

4 posts were split to a new topic: Editing of old posts and missing ‘like’


#11

It would be great if it was possible to insert clickable links/hyperlinks - leading to web pages, to the exploration output (especially those utilising AddRow() function) - similar to implemented in AmiBroker 6.08 clickable links in AFL editor.

In the case above, those links - when clicked, would open (in the default web browser’s new tab) a web page with the full article/message etc. I don’t know if it’s possible, but this feature would be really useful. I may submit it to the Feedback Centre. Maybe @Tomasz considers implementing it in the future :slight_smile:


Editing of old posts and missing 'like'
#12

I may add it in the future. I am more likely to add features when useful purpose is demonstrated as you did.


#13

@Tomasz it is great to hear it :slight_smile: Of course I understand, that you are an extremely busy person and if you were to implement 10-20% of users’ suggestions, you wouldn’t have time to sleep :wink: For that reason I always try do my best and find a solution, making use of the tools that are already available to me…

I was thinking yesterday what can I do now to make possible the things that I mentioned above and came up with an idea to merge an Exploration output with a chart pane (the chart pane is in Floating mode). The result is a hybrid which gives me much more flexibility:

I added a pane with clickable buttons - one button for each row. This solution is possible thanks to GuiButton() functions introduced in AmiBroker 6.21 (March 2017). After clicking one of the buttons, a new tab is opened in a web browser (Firefox in my case) with the coressponging article/content. Opening a link in a web browser is possible thanks to ShellExecute() function. It is not mentioned in the documentation, that it is able to open content in a web browser, but it works. For example:

Besides I am able to mark (with color circles in this case) some rows which should attract my attention.

The communication between the Analysis window (Exploration) and a chart pane, is possible thanks to Static variables:

StaticVarSet() and StaticVarGet()
StaticVarSetText() and StaticVarGetText()

It is not an ideal solution, because exploration output window and the chart pane are not really merged and if someone has couple of them, moving them around is not quite handy - especially taking into account, that only charts are saved in the Layouts. I will have to rearrange everything each day in the morning, after restarting the system. To avoid that I used to use hybernation mode, but nowadays in the era of SSD drives, it is not recommended as it shortens the SSD’s lifespan …

Of course this whole solution can be fully implemented in a chart (without the Analysis window) and I may create such solution, but Exploration seems just custom made/tailored for such things and it would be a pity not to use it for that. If you consider some of my suggestions, in the future such solutions probably won’t be necessary and become more accessible and popular among other users :wink:

All in all - I came up with my solution yesterday in the evening, implemented it tooday and it works really well. You made it possible by implementing Internet functions - which I appreciate very much :slight_smile:

Regards

Miłosz


Notifyflag param of GuiButton function
#14

@Milosz Great showcase of imagination and skill. Appreciated!

BTW: ShellExecute() opens pretty much anything. URLs can be opened directly:

ShellExecute("http://www.amibroker.com", "", "" );

that call would open amibroker.com site in the default browser. And that:

ShellExecute("mailto:amibroker@yahoogroups.com", "", "" );

would open default mail program to send the message.


#15

As a follow-up to my previous post - two more examples of combining Exploration output with charts in floating mode. Because I use Explorations a lot and “A picture is worth a thousand words” I tried to create a hybrid solution with mini charts which allow to quickly sift through many Symbols. The charts are very small, but contain enough information to attract attention to selected items. The first example shows mini charts that fit in a single line (19 pixels height):


The second example shows bigger charts (2 lines -> 38 pixels height). Although they are still relatively small, they allow to present much more data. Apart from the price itself, they display support/resistance levels and notifications when these levels have been crossed (green or orange highlight of the Symbol’s name). Additionally we can easily spot places with volume spikes. Only areas with volume n times bigger than average are grayed:

Checking if support or resistance levels have been reached/crossed, utilizes solution presented by @Tomasz in his article:
http://www.amibroker.com/kb/2007/05/14/how-to-detect-the-study-crossover-for-multiple-symbols-with-use-of-scan/

To make this hybrid light I perform most time-consuming calculations in Exploration code. I fill Static variables and use StaticVarGenerateRanks() to get a list of Symbols to be displayed in chart(s) and sort Symbols the same way in which sorting is performed after Exploration is finished. In charts’ code I use StaticVarGetRankedSymbols() to display charts in a proper order. I don’t use SetForeign() in charts to make the formula light (in exploration SetForeign is not needed by the definition). Charts are created using GfxFunctions. By default they are updated only after exploration is performed ( because they are meant to be a part of exploration :wink: ) but can be updated much more often (for example every x minutes or every x seconds).

The charts are not part of analysis window, so moving this solution around is not quite handy and the setup needs to be restored after each AmiBroker restart but in general it functions very well. Probably it’s impossible, but it would be great if the user could add “chart areas x pixels width” to the exploration output, just like he adds standard columns :wink: This would be the most universal solution and would open enormous possibilities of presenting exploration results. If it’s not feasible - even being able to dock a chart to Analysis window (or some parts of it) so that they stick together would be something. That being said, I would like to point out, that I am very excited, that even now - without the features on my wishlist, AmiBroker is extremely flexible and gives users almost unlimited possibilities :slight_smile:

Regards - Miłosz


Passing an Array to StaticVarGenerateRanks
#17

This time I would like to present another solution showing how flexible AmiBroker is. My goal was also to draw some users’ attention to a couple of newly implemented features which I find really useful.

At first glance it may look similar to the solution presented in my first post in this thread, but the main difference is that it is a chart based solution - not an exploration. For this reason it offers much more possibilities of presenting the results and interaction with the displayed content:

PBParkietChart2
(Right mouse click to show picture in its original size)

This AFL can extract data not only from the two main web pages: PB and Parkiet (with investment related articles’ titles, teasers and links to full content - like the one from my first post) but also from n subpages containing those full articles. In this case data might be extracted from (1+1+12+12) = 26 web pages. Selected articles are displayed on demand.

I have been already planning to replace some of my explorations with chart based solutions, but below (recently introduced features) made it possible and really effective:

  • AB 6.26 GuiButton/GuiCHeckBox/GuiToggle/GuiRadio support new events: MouseEnter (64 or notifyMouseEnter) and MouseLeave(128 or notifyMouseLeave) which detect hovering without need for constant refreshes. I must say - it works great (zero unnecessary refreshes) and we can fully adjust/customize in what circumstances each button is trigerred by combining different notify events. We can choose between any combination of: notifyClicked, notifySetFocus, notifyKillFocus, notifyHitReturn, notifyEditChange, notifySelChange, notifyMouseEnter, notifyMouseLeave.

  • AB 6.25/6.26 Gui keyboard navigation enabled (you can tab between controls and use arrows to navigate control groups such as radio boxes)

Those features allow to easily display additional content when the mouse pointer is hovering over some buttons or when the button clicked or selected using keyboard tab or arrows. This gives many ways of interacting with the displayed content and navigating through rows and columns of the displayed text - similar to the exploration output. I’m not saying that similar results couldn’t have been achieved earlier, but usually required constant and frequent refreshes. Now regular refreshes aren’t required at all, which makes it very CPU friendly - take a look at the refreshes counter in the upper right corner of the animated gif - not even a single unnecessary refresh :wink:

PBPChart11
(Right mouse click to show picture in its original size)

This solution is very light because the web pages are visited only when the “Explore” button is clicked or every n seconds when “Auto-Repeat” is checked. Each set of data is extracted only once (when it appears on the web page for the first time) and stored in static variables for later use. So if no new titles/teasers are present on these two main web pages, the code doesn’t open/extract any other html content from the subpages. In cases of all other refreshes, the chart only displays data already stored in static variables.

Some other functions used:

  • Status( “RedrawAction” ) - returns 0 (zero) for regular refreshes, and 1 for refreshes triggered via RequestTimedRefresh().

  • GfxDrawImage() to display 2 small logos im BMP format (loading and drawing BMP files is even 10 times faster than PNG)

Because it is a chart based solution, I can benefit from it’s all advantages. Apart from the obvious ones (almost unlimited graphics possibilities) charts are saved in the layout, each chart has it’s own unique ID which makes possible using separate Parameters window for each chart, I have full control of how often or in what circumstances the code (or some parts of it) are executed - for example data extraction can take place in some randomly changing intervals (in this case I made use of some solutions which I worked out coding Buttons Hunter - The Game for AmiBroker 6.25 :wink: ).

In general the main disadvantage of using chart instead of exploration is the fact that Analysis window uses all available CPUs/cores to execute formulas in many threads in parallel, providing significant speed ups in typical situations. This should be taken into account. But in this particular application, formula’s execution time (when data is extracted) is almost identical to my first solution (exploration) - because it was by default running in one thread only (it’s a specific case - I’m not performing calculations on multiple symbols from AB database but extracting content from the outside of AB).
https://www.amibroker.com/guide/h_newanalysis.html

Summing up, I really appreciate the newly implemented features which allow someone like me (an amateur coder) creating such interesting and useful (at least for me) applications. I encourage other users to take the full advantage of the latest version of AmiBroker :slight_smile:

Regards - Miłosz


Full Name in MDI Tabs?
GfxSetZOrder and GfxSetOverlayMode
#18

Great stuff Milosz.
-S


#19

Those mini graphs are very well done. I use this feature in another tool and I agree they would be very nice in exploration output.


#20

Hii ,Molosz

I am very much impress with exploration with mini charts.
I would like to know how to do it., Please can you post details how to do ?