NORGATE DATA

 

AmiBroker Usage

Database Settings

Database settings allow the user to configure the data, with options provided for:
Date Padding Date Padding options
Price AdjustmentPrice Adjustment options
To check the existing settings, or to change them, click File > Database settings > Configure.

Database Maintenance & Automation

Database Maintenance
Automating Database Maintenance
Automating the Database Plugin Settings in Batch Mode

Indicators & Functions

Indicators/Functions
Making use of Historical Index Constituents
Referencing the Original Unadjusted Close and Volume
Accessing Dividends
Accessing Fundamentals
Accessing Sector/Industry Classification
Business and Financial Summary
Determining the Industry Index Symbol for the Current Security


Database Maintenance & Automation

Database Maintenance

Database maintenance serves to:

When the Norgate Data plugin detects that any maintenance is required, you will see the message "MAINT" at the bottom right on the AmiBroker taskbar in the plugin status box -


If the MAINT message is shown, RIGHT CLICK on the plugin status box. A window will pop up, showing the progress of the maintenance routine.



Once the routine has completed, the box colour will turn to green and the plugin status box will change to "OK".



Database Maintenance can be run at any time, whether the message box shows MAINT or not, by right-clicking the plugin status box. For example, if you accidentally delete a symbol from the AmiBroker database, then running Database Maintenance will restore it.

If you create or modify a Watchlist in NDU's Watchlist Library, Database Maintenance must be run so that AmiBroker can pick up the new list or refresh the existing list.

Automating Database Maintenance

In AmiBroker v6.20 and above, you can use the Batch Processor feature (File > New > Batch > Insert) to:

  1. call the NDU Trigger utility to run a background data update in NDU, and/or
  2. run the Database Maintenance
The batch settings for a "default" NDU installation would be as follows (if you installed NDU to a non-standard directory you will need to adjust as required):

ActionParameter
Execute and Wait
c:\Program Files\Norgate Data Updater\bin\NDU.Trigger.exe UPDATE CLOSE WAIT
Data Plugin Command
NorgateDatabaseMaintenance

After adding the batch commands, it would look something like this:



If desired, you can then use AmiBroker's Scheduler (Tools > Scheduler), to run this Batch at your preferred time(s).

If you only want the Database Maintenance to run when the MAINT message is shown, use the following Data Plugin Command instead:

NorgateDatabaseMaintenanceIfRequired

Automating the Database Plugin Settings in Batch Mode

The NorgateData plugin settings for Date Padding and Price & Volume Adjustment can be configured via the Batch Processor feature in AmiBroker v6.20 and above, prior to running any scans or backtests by using the following Data Plugin commands:

NorgateSetPadding=None
NorgateSetPadding=MarketDays
NorgateSetPadding=AllWeekDays
NorgateSetPadding=CalendarDays
NorgateSetPriceAndVolumeAdjustment=None
NorgateSetPriceAndVolumeAdjustment=CapitalReconstructions
NorgateSetPriceAndVolumeAdjustment=CapitalReconstructionsAndSpecialDistributions
NorgateSetPriceAndVolumeAdjustment=All




Indicators & Functions

Indicators/Functions

To use any of the Norgate-provided functions, you will need to add the following line to the top of any AFL file you use for scanning/backtesting/indicator plots.

#include_once "Formulas\Norgate Data\Norgate Data Functions.afl"
Show full list of Indicators/Functions

Making use of Historical Index Constituents

To determine whether a stock was in a particular index on a given date, use the function NorgateIndexConstituentTimeSeries by adding it to your "Buy" condition:

AND NorgateIndexConstituentTimeSeries("index symbol or index name")
where the index symbol is $DJI (Dow Jones Industrial Average), $RUA (Russell 3000) and so on.

The index symbol or index name must be wrapped in "quotes". For example:

AND NorgateIndexConstituentTimeSeries("S&P 500")

If you wish to stipulate membership of one index but not of another, use (for example) -

AND NorgateIndexConstituentTimeSeries("$XAO") AND NOT NorgateIndexConstituentTimeSeries("$XTO")

When using the NorgateIndexConstituentTimeSeries function to run a back-test against a particular index, we recommend referencing the Watch List that contains the current and past constituents for that index (specify this Watch List in the Analysis Filter window). This will provide a faster result than running the test against all symbols.

Note: You will need either a Platinum or Diamond level package subscription to access Historical Index Constituents, as only these packages include delisted stocks.

Referencing the Original Unadjusted Close and Volume

Depending on your plugin configuration settings for Price & Volume Adjustment, the price and volume data will be adjusted to account for the effect of capital events and dividends.

If your trading system needs to reference the original unadjusted closing price of a security, use the function shown below.

oc = NorgateOriginalCloseTimeSeries();

Likewise, if you need to reference the unadjusted volume, use:

ov = NorgateOriginalVolumeTimeSeries();

Accessing Dividends

The Aux2 field shows any dividends that have not been accounted for in the price data by the "Price Adjustment" method. If all types of dividends and distributions have been accounted for, and you still wish to view a dividend entitlement for a particular day, you can use the following function to determine whether there was a dividend entitlement on that day:

NorgateAllDividendsTimeSeries(dividend type)
Dividend Type can be one of:

If there are multiple dividends on any given day, they will be summed.

This indicator may be useful for detecting dividend timing or simply as a visual indicator on a chart to show that a dividend entitlement occurred on a particular day.

Accessing Fundamentals

AmiBroker has a number of in-built data fields related to fundamentals, as described here which are populated by Norgate and can be accessed by the in-built GetFnData function.

Norgate also provides a wider range of fundamental fields (some companies have up to 140 fundamental fields). To access this data, call the following function

NorgateFundamentals(fundamental_field)

For example, to determine the most recently reported trailing twelve month payout ratio you would incorporate the following into your formula:

ttmpr = NorgateFundamentals("ttmpayrat");

Fundamental data is often released after the fact ("delayed") and does not always relate to the date of the current price bar. More information on this topic can be found here.

In order to determine the date that the fundamental data applies to, you can use the following functions:

For example, to see the date to which the trailing twelve month payout ratio relates to, use:

ttmprdate = NorgateFundamentalsDate("ttmpayrat");

Accessing Sector/Industry Classification

Functions in this area can be used to reveal the classification ID, the classification name or the classification description for a given stock under a supported classification scheme.

Please note: Not all stocks are necessarily classified.

Supported classification schemes are -

The following examples refer to TRBC:

trbccode = NorgateClassification("TRBC");
trbc = NorgateClassificationName("TRBC");
trbcdescription = NorgateClassificationDescription("TRBC");

For NASDAQ:AAPL this would return -

To obtain a classification at a different level, you can use NorgateClassificationAtLevel, NorgateClassificationNameAtLevel and NorgateClassificationDescriptionAtLevel. Detailed descriptions are typically only available at the lowest level of the classification. For example, to obtain the 2nd level of the TRBC classification you would use:

trbccodeAtLevel2 = NorgateClassificationAtLevel("TRBC",2);
trbcAtLevel2 = NorgateClassificationNameAtLevel("TRBC",2);
trbcdescriptionAtLevel2 = NorgateClassificationDescriptionAtLevel("TRBC",2);

For NASDAQ:AAPL this would return -

Business and Financial Summary

There are several functions related to Business and Financial summaries of companies such as NorgateBusinessSummary(), NorgateBusinessSummaryLastUpdate(), NorgateFinancialSummary(), NorgateClassificationName(<classification scheme>) and NorgateClassificationDescription(<classificationscheme>).

One useful place to display this information is AmiBroker's Interpretation window (the Interpretation window appears if it is ticked under the AmiBroker > Window menu).

Norgate has pre-built a formula to add these business summaries to the Interpretation window. To incorporate this formula file, right click anywhere on a price chart, select "Edit formula .." and then copy/paste the following code so as to append it after the formula:

#include_once "Formulas\Norgate Data\Business and Financial Summary.afl"

For example, here is the Business and Financial Summary for NYSE:GE

Determining the Industry Index Symbol for the Current Security

If you would like to retrieve the industry index symbol for the current security (for instance, to find other stocks with the same industry classification), you can use the NorgateCurrentIndustryIndexSymbol function as follows:

indexsymbol = NorgateCurrentIndustryIndexSymbol("<index family>", <level> ,"<index type>");
where:
<index family> can be $SPX, $SP1500, $XJO or $XKO.
<level> is an integer from 1 to 4
<indextype> is either PR (price return) or TR (total return)

For example, to determine the S&P 1500 Level 4 (Sub-Industry) price return index applicable to the current symbol, you would use:
indexsymbol = NorgateCurrentIndustryIndexSymbol("$SP1500",4,"PR");
If the current symbol has no applicable classification or there is no industry index present at the given level, then indexsymbol in the example above will have no value.