Australian (ASX) Stock Market Forum

AmiBroker Tips and Tricks

@CNHTractor you can try this code, @Trav. code slightly modified for Norgate (NDU)

@Skate, thanks for that code. Yes it gets me closer to @trav but there is a difference in that @trav exploration is at a sector level, eg $XSJ, $XMJ, etc whilst your code is at the Index level $XJO.

When I run your code in an exploration I get the followingUntitled.png

Whereas with @trav the exploration is
upload_2020-6-12_6-22-50-png.104655

When I run the backtest this is the result Untitled.png

So I guess to emulate @trav I need to get back to the Sector level.

Thanks again for any insights.
 
I emailed Norgate to query the difference between people have the .au suffix and other not ( that's me ) below is the response

When NDU was first released, clients who subscribed to both US and AU stocks were given the the ".au" country suffix to avoid symbol overlap. Clients who only subscribed to AU stocks did not have the suffix. When we released v4.0.8.33 of NDU in October 2019 the ".au" country suffix became the default for all new subscribers to Australian stocks (regardless of a US stocks subscription).

As you subscribed prior to that date your NDU database does not employ the ".au" suffix although you can request for us to add it to your account if you want.
 
I emailed Norgate to query the difference between people have the .au suffix and other not ( that's me )

https://www.aussiestockforums.com/posts/1068787/

@Trav. I made reference in "qldfrog-weekly-skate-inspired-system" thread on the 20th April 2020, "not so long ago" but I realise not all members read @qldfrog thread. It's worth repeating the differences here for readers of this thread.

Addendum for Norgate Data users
Heads Up - about 18 months ago Norgate made the (.AU suffix) mandatory for all new subscribers of Australian data to avoid support issues. Older subscribers don't have a suffix & changing subscriptions can also raise an issue without you noticing the change in data format.

1. Old Subscribers to NDU = $XAO (old data feed format)
2. New Subscribers to NDU = $XAO.au (new data feed format)

Pad & Align
Make sure the correct data format matches.

Also, I made a follow-up post here
https://www.aussiestockforums.com/posts/1069294/

Premium Data
"Norgate's old legacy format" (MetaStock format) you are using the correct format for the All Ordinaries "XAO".

The problem with a bit of history
If you subscribed to (NDU) both Australian + US stocks originally you would have had a (.AU) suffix. If you were an Australian-only subscriber then there would be no (.AU suffix). This optional suffix arrangement resulted in causing an issue, especially when a (AU+US) subscriber dropped a US subscription then all of their Australian stocks lost their suffix. It broke various watchlists that had been created, it also broke the formulas that were relying on a suffix being present. So to overcome this problem about 18 months ago Norgate made the (.AU) suffix mandatory for all new subscribers of Australian data to avoid the confusion.

Using Norgate Data (NDU) instead of Premium Data
With AmiBroker significantly-enhanced capabilities Norgate Data (NDU) capitalises on this by adding additional features well beyond those in Premium Data, so it pays to migrate over.

There is a catch (with regards to historical data)
There is one very important difference, with my original Premium Data I purchased historical data separately. NDU works as a subscription-only model and historical data cannot be purchased separately. The historical data is in the old legacy format (MetaStock format) meaning, they are not compatible.

Skate.
 
Maybe email them to get a quick answer

I have had a response from Norgate. Richard Dale advises
It should be showing the .au suffix there - it looks like we have a bug in that area.

For now, you should manually add ".au" to the end. We'll develop a fix and test it over the next week or so, and I'll let you know when that is released.

I have altered the 2 lines of code by adding +".au" the lines being

Code:
SectorIndexImported = Foreign(NorgateIndex +".au","C"); // Brings in sector index name XEJ, XMJ etc
and
Code:
AddtextColumn( NorgateIndex+".au", "Index")

I am now getting the same exploaration as @trav :)
 
@CNHTractor good work mate.

I think I will wait a few weeks and hopefully Norgate fix the bug then I might swap over to the new format as it will make it easier for us to swap some code.
 
I am coding a trailing stop. At this stage I have the following code:
Code:
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN("EMA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
 
 
 Buy = C > EMA( P, Periods );
 Sell = C < EMA( P, Periods );
 
Buy = ExRem( Buy, Sell ); // Removes additional buy signals
Sell = ExRem( Sell, Buy ); // Removes additional sell signals

//Stale Stop
StaleStop = ROC(C,13)<0;

// data to plot the ribbon
Plot( 0.55, /* defines the height of the ribbon in percent of pane width */  "Ribbon",
  IIf( StaleStop , colorYellow, colorGrey40 ), /* choose color */
    styleOwnScale|styleArea|styleNoLabel, -1.0, 49);

SetForeign( "$XAO.au", True , True ); // I've used this for the new Norgate Updater (NDU) format
MAfilter = MA( C, 100 ); // 100 week lookback period
IndexBuyfilter = C > MAfilter; // Index Filter = ON: When the close is greater than the 100 week simple moving average the Index Filter is ON [trailing stop set to 20%] + [buy + sell signals generated]
IndexSellfilter = C < MAfilter; // Index Filter = OFF: When the close is less than the 100 week simple moving average the Index Filter is OFF [shortens trailing stop to 10%] + [only sell signals generated]
RestorePriceArrays( True ); // Restores original price and volume arrays after the call to SetForeign.

SetTradeDelays( 1, 1, 1, 1 ); // Trade delays FALSE, the delay is in the array


ts1 = 20; // Trailing stop one = set at 20% when the Index Filter is TRUE
ts2 = 10; // Trailing stop two = reduces to 10% when the Index Filter is FALSE
ts = IIf( indexbuyfilter , ts1 , ts2 ); // If the Index Filter is TRUE use (ts1) set at 20%, if the Index Filter is FALSE use (ts2) settings reduce Trail Stop to 10%

ApplyStop( stopTypeTrailing , stopModePercent , ts , exitatstop = 2 ); // Apply Stop = [ts] Trailing Stop [exitatstop = 2] means check High-Low prices but exit NEXT BAR on regular trade price.


highsinceBuy = HighestSince( Buy, High);
stoplevel = highsinceBuy  * (100-ts)/100;
Plot( stoplevel, "Trailing Stop", colorAqua, styleLine );
Plot( highsinceBuy, "highsinceBuy", colorBrightGreen, styleDashed );
//Plot(HI, "100 week High", colorTurquoise, styleDashed);



PlotShapes( Buy*shapehollowUpArrow, colorWhite, 0, Low, -20 ); // Displays Buy up arrow on the signal bar
PlotShapes( ( Sell > 0 ) * shapeDownArrow, Coloryellow, 0, High, -40 ); // Displays Sell down arrow on the signal bar
PlotShapes( Ref( Buy, -1 ) * shapeHollowSquare, colorWhite, 0, O, 0, 0 ); // Displays a white square on the buy bar
PlotShapes( Ref( Sell, -1 ) * shapeHollowCircle, colorYellow, 0, O, 0, 0 ); // Displays a yellow circle on the sell bar

This gives me the following chart:
Chart.png
What I would like to do is to have the trail stop line stop at the sell signal and then recommence at the next buy signal.

I would welcome any guidance on how to adjust my code to reflect the break.
 
Righto I'm back with another piece of useless information for the AmiBroker users :rolleyes:

One of favourite sites is Market Index which I find very useful to check out the latest announcements for stocks that I am interested in and you can link that directly to which code you have a chart open on to the web research panel....confused :confused: well let me try to explain a bit better with pictures

1 - I run a scan and a stock is suggested - in this case BVS

View attachment 104015

2 - I click on the stock and it opens in my chart window

View attachment 104016

3 - I want to view the latest announcements
a) I select New Web Research and Market Index web page is displayed with BVS already selected​

View attachment 104017

View attachment 104018


What .... how did that happen .... Lets have a look see o_O

4 - Select the following.......Tools - Customize - Web Pages
a) Delete the other pre loaded rubbish.....(well that is up to you)
b) add the following​
View attachment 104019

Now if you are still confused just put me on ignore and carry on....:D:D:D

Hi @Trav. This is a great tip. I'm a big fan of Market Index and having it "integrated" into AB like this is great. I've gone one step further and also use this to "integrate" my broker into AB in the same way. Much easier for me to flick between charts, explores and my broker to enter and exit trades. Wish you could use alternative browsers in the web research instead of Explorer. One thing that has been annoying me about AB is that I can't get the analysis and web research tab to auto re-open when I start AB--charts no problem will re-open but not analysis and web research tabs. Any ideas how to do this?
 
@MovingAverage I am glad that you have found something useful mate.

I can help you with the Analysis window now and will investigate the Web research tab.

- Create new project -
- Open Analysis Window - File / New / Analysis
- Setup your defaults - AFL formula / Filter Settings / Scan dates etc
- File / Save As / Analysis_Batch.apx
- Create new Batch File that opens up on startup
- File / New / Batch
- Insert Actions as per below ( change paths to suit )​

upload_2020-7-10_17-0-24.png

- Open the schedule task ( Clock ) and configure as you would like it

upload_2020-7-10_17-13-27.png

The above loads my Norgate Data Updater which is optional

Some info here - http://www.amibroker.com/guide/h_batch.html

Hopefully you can have a go with the above, if you have any troubles let me know and we can figure it out.

Good Luck
 
Quick question, might be a repeat as i i ubt i am the only one:
When i open amibroker, i always open 2/3 analysis files apx..googling it was not very helpful, more exactly positive
Is there a way to save a setup.
As an IT guy, this is actually mindblowing that this is not present by default.shoukd have been from start and definitively by now more than a decade later
Saving user workspaces is basic ABC functionality.
Any way around?
Do you always reopen, reset windows as per wishes etc?
Many thanks
As for the answer, add a request aka join the queue, google search demonstrate how useful this has NOT been..very disappointing there
 
@MovingAverage I am glad that you have found something useful mate.

I can help you with the Analysis window now and will investigate the Web research tab.

- Create new project -
- Open Analysis Window - File / New / Analysis
- Setup your defaults - AFL formula / Filter Settings / Scan dates etc
- File / Save As / Analysis_Batch.apx
- Create new Batch File that opens up on startup
- File / New / Batch
- Insert Actions as per below ( change paths to suit )​

View attachment 105809

- Open the schedule task ( Clock ) and configure as you would like it

View attachment 105812

The above loads my Norgate Data Updater which is optional

Some info here - http://www.amibroker.com/guide/h_batch.html

Hopefully you can have a go with the above, if you have any troubles let me know and we can figure it out.

Good Luck

Cheers. I'll give your suggestion a go.
 
Is there a way to save a setup

I think that I might have lost a little in the translation from French to English but are you looking to have different layouts of charts in your workspace for each system.

If so maybe create some layouts as per below so when clicked they open up the appropriate charts for each system

upload_2020-7-11_10-18-5.png
 
Quick question: Is there a way to save a setup.

@qldfrog an alternative solution to the one @Trav. has just given you. Now if I understand your question correctly, how to save a setup - let me explain the procedure that I carry out as I switch between strategies in a heartbeat.

Procedure to save a setup
(1) Load your [AFL] in a new analysis window & (2) when you have the "Analysis setting" as desired - navigate to the [menu bar] select [File] then select [Save as...] press “Save”. The "Analysis window project file" (APX) gets saved when you press “SAVE”, its that simple.

Important
Create a [New Folder] & rename it [APX folder] meaning all your (APX) files are in their own folder.

Make a shortcut on the menu bar
Another way of opening recently opened Analysis projects quickly is going to [File] - [Recent Files].

A better alternative
Place a shortcut to your (APX) files on the menu bar. How?, Via Tools - Customize - Commands - File - now you can drag and drop "Recent Files" to the menu bar to have quicker access to your (APX) files. I've renamed "Recent files" to [Exlpore] & [Hybrid Explore] or whatever name that has meaning to you. The (APX) files will automatically accumulate when a new (APX) file is opened.

From the menu bar
Open the (APX) directly from the menu bar drop-down list to load your (AFL) with all the preset settings & they should give you a pick list as below:
DailyQFDuc.apx
WeeklyQFDuc.apx
DailyVolatility.apx
SkateSystem.apx

How to place a shortcut of the (APX) files to the menu bar
Have a read here as it's explained succinctly: https://forum.amibroker.com/t/open-apx-file-from-an-already-open-analysis-window/7571 If I have missed the premise of the question the procedure might be helpful to someone else.

Skate.
 
@qldfrog an alternative solution to the one @Trav. has just given you. Now if I understand your question correctly, how to save a setup - let me explain the procedure that I carry out as I switch between strategies in a heartbeat.

Procedure to save a setup
(1) Load your [AFL] in a new analysis window & (2) when you have the "Analysis setting" as desired - navigate to the [menu bar] select [File] then select [Save as...] press “Save”. The "Analysis window project file" (APX) gets saved when you press “SAVE”, its that simple.

Important
Create a [New Folder] & rename it [APX folder] meaning all your (APX) files are in their own folder.

Make a shortcut on the menu bar
Another way of opening recently opened Analysis projects quickly is going to [File] - [Recent Files].

A better alternative
Place a shortcut to your (APX) files on the menu bar. How?, Via Tools - Customize - Commands - File - now you can drag and drop "Recent Files" to the menu bar to have quicker access to your (APX) files. I've renamed "Recent files" to [Exlpore] & [Hybrid Explore] or whatever name that has meaning to you. The (APX) files will automatically accumulate when a new (APX) file is opened.

From the menu bar
Open the (APX) directly from the menu bar drop-down list to load your (AFL) with all the preset settings & they should give you a pick list as below:
DailyQFDuc.apx
WeeklyQFDuc.apx
DailyVolatility.apx
SkateSystem.apx

How to place a shortcut of the (APX) files to the menu bar
Have a read here as it's explained succinctly: https://forum.amibroker.com/t/open-apx-file-from-an-already-open-analysis-window/7571 If I have missed the premise of the question the procedure might be helpful to someone else.

Skate.
Much thanks, with shortcuts will be quite workable
 
Quick question, might be a repeat as i i ubt i am the only one:
When i open amibroker, i always open 2/3 analysis files apx..googling it was not very helpful, more exactly positive
Is there a way to save a setup.
As an IT guy, this is actually mindblowing that this is not present by default.shoukd have been from start and definitively by now more than a decade later
Saving user workspaces is basic ABC functionality.
Any way around?
Do you always reopen, reset windows as per wishes etc?
Many thanks
As for the answer, add a request aka join the queue, google search demonstrate how useful this has NOT been..very disappointing there

I feel your frustration. When I first started using Amibroker it usually opened with a particular layout with a range of index windows and formats. After fiddling with it now resets the itself to a clean format on restart. I now have to re apply my default saved layout on startup.

From what i can gleen The presentation layouts and formats are affected by settings in Layers, Layouts and formulas... and probably other functions I've yet to stumble across.

This is my first weekend free in a few months so I'm going to get stuck into it again along with some systems kindly provided by Skate. I'll probably loose more hair in the process. :)
 
I think that I might have lost a little in the translation from French to English but are you looking to have different layouts of charts in your workspace for each system.

If so maybe create some layouts as per below so when clicked they open up the appropriate charts for each system

View attachment 105846
ideally open both a set of 4 layouts and as well 4 apx...
I am so surprised to NOT see this as default facility:
in Windows .Net just a matter of storing of a Configuration object even as a blob and saving/loading , very basic ;
wonder why not implemented and everyone trying to find works around ..yes we can survive but if every user start its session by redoing these steps, this is a MUST HAVE fct , not a wish...
Thanks all for your work arounds
 
Top