Norgate Data Norgate Data
 

RightEdge Usage

Watchlists

RightEdge simulations are performed against watchlists. Watchlists can be created and managed in NDU or directly within RightEdge through the Watchlist Library.

Show illustration on how to use the "Russell 3000 Current & Past" watchlist

Indicators, Dividends and Security Information

Making use of Historical Index Constituents

In the declaration area of the derived class of MySymbolScriptBase, add the following code:

	// Define class for index constituents
	NorgateData.Integration.RightEdge.IndexConstituentTimeSeries indexConstituent;

In the Startup() method override, you need to instantiate the IndexConstituentTimeSeries indicator class as follows:

	indexConstituent = new NorgateData.Integration.RightEdge.IndexConstituentTimeSeries("Russell 3000");

Either the index name (eg. "Russell 3000") or the index symbol ("$RUA") can be specified. Details of the Historical Index Constituent coverage can be found in the Data Content Tables.

In the NewBar method, you can check to see whether the stock was in the index on the current bar, by incorporating a very simple condition into your buy signal:

	&& indexConstituent.Current == 1

Determining when a US stock was listed on a major exchange

Some US stocks have had periods where they were not listed by a major exchange and only tradeable as OTC/Pink Sheet stocks.

In backtesting, you can elect to only trigger a trade if the stock was listed on a major exchange (NYSE, Nasdaq, NYSE American, NYSE Arca, Cboe BZX, IEX) on the signal date by using the class NorgateMajorExchangeListedTimeSeries as follows:

In the declaration area of the derived class of MySymbolScriptBase, add the following code:

	// Define class for index constituents
	NorgateData.Integration.RightEdge.NorgateMajorExchangeListedTimeSeries majorExchangeListed;

In the Startup() method override, you need to instantiate the IndexConstituentTimeSeries indicator class as follows:

	majorExchangeListed = new NorgateData.Integration.RightEdge.NorgateMajorExchangeListedTimeSeries();

In the NewBar method, you can check to see whether the stock was in the index on the current bar, by incorporating a very simple condition into your buy signal:

	&& majorExchangeListed.Current == 1

Referencing Distributions/Dividends

In your "Price & Volume Adjustment" settings, you can remove the effect of any distributions/dividends received by adjusting the price and volume on a proportional basis. This methodology simulates re-investing the dividend on the day prior to the ex-date and mirrors the methodology used in Total Return indices. To change this setting, click Tools > Options > Data Store > Setup and select "Capital reconstructions, special distributions and ordinary cash dividends".


If you would prefer to track the dividends separately or use a different adjustment method, you can use the following Indicators -

In the declaration area of the derived class of MySymbolScriptBase, add the following code:

	NorgateData.Integration.RightEdge.DividendTimeSeries dividends;
	NorgateData.Integration.RightEdge.PortfolioFunctions portfolioFunctions;

In the Startup() method override, you need to instantiate the DividendTimeSeries indicator class as follows:

	dividends = new NorgateData.Integration.RightEdge.DividendTimeSeries();
	portfolioFunctions = new NorgateData.Integration.RightEdge.PortfolioFunctions();

In the NewBar method, you can incorporate a dividend entitlement into your account with:

	#region addDividendsToAccount
	portfolioFunctions.AddDividendToAccount(dividends.Current, SystemData, PositionManager, OpenPositions);
	#endregion

Your portfilio will be adjusted according to the dividend received. This will show as an Interest trade in your Trade List:



To adjust your stops by the amount of the dividend entitlement, add the following code:

#region adjustTargetAndStopForDividend
// If the price data is not adjusted for all types of dividends then you may want to adjust your price target/stop loss levels
// to take into account any dividend received.

// Note: This is unable to adjust Ratios (%) trailing profit targets/stops.  If you use Ratios targets/stops
// we suggest that you convert Ratios to a specific price target, and recalculate it each day, then use
// these routines afterwards to adjust the stops.		
if (dividends.Current > 0) 
{
	foreach(Position pos in OpenPositions)
	{
		int direction;
		if (pos.Type == PositionType.Long) 
		    direction = 1;
		else
		    direction = -1;
		
		// Adjust target price if set
		if (pos.ProfitTargetType == TargetPriceType.AbsolutePrice ||
		    pos.ProfitTargetType == TargetPriceType.RelativePrice)
		        pos.SetProfitTargetPrice(pos.ProfitTarget - (direction*dividends.Current));
		// Adjust stop loss price if set
		if (pos.StopLossType == TargetPriceType.AbsolutePrice || 
		    pos.StopLossType == TargetPriceType.RelativePrice)
		        pos.SetStopLoss(pos.StopLoss - (direction*dividends.Current),pos.StopLossType);
	}
}
#endregion

Referencing Security Information

The following Symbol properties are built into RightEdge and automatically populated by the Norgate Data plugin, and can be queried within your code using:

Symbol.<property>
PropertyC# TypeDescription
AssetClass
AssetClass enumType of Security (Stock, Future, Index etc.)
Exchange
StringThe Exchange where the security trades
Currency
Currency EnumCurrency used to quote the security
ExpirationDate
DateTimeFinal day of trading for an expired/delisted stock
Sector
StringLevel 1 (Economic Sector) for stocks
Industry
StringLevel 4 (Industry) for stocks
ContractType
ContractType enumFor options, defines whether the contract is a call or a put
TickSize
DoubleThe mininum tick increment for a futures contract
TickValue
DoubleThe value of each tick in terms of the Profit/Loss that occurs when you trade one contract
Margin
DoubleFor futures, the initial margin required to open a position of 1 contract. For spot FX, this is shown by default as a 2% leverage.
ShortMargin
DoubleSame as Margin

For additional metadata for each security, add the following code to the declaration area of the derived class of MySymbolScriptBase, :

	NorgateData.Integration.RightEdge.SecurityInfo norgateSecurityInfo;

Then, in the Startup method override, you need to instantiate the Security Information class as follows:

	norgateSecurityInfo = new NorgateData.Integration.RightEdge.SecurityInfo();

The following Security Information methods are available for querying:

MethodC# TypeDescription
SecondLastQuotedDate
DateTimeSecond last bar of trading for any delisted/expired security
For example usage see Note (1)
BusinessSummary
StringSummary of the company's operations
BusinessSummaryLastUpdate
StringDate when the Business Summary was last updated
FinancialSummary
StringSummary of the company's most recent reported financials
WebSite
StringWeb site of company
Domicile
StringCountry of Domicile
AssetId
IntegerUnique identifier of securities
Classification
StringReturns the classification for the given classification scheme
ClassificationAtLevel
StringReturns the classification and level for the given classification scheme
ClassificationName
StringReturns the classification name for the given classification scheme
ClassificationNameAtLevel
StringReturns the classification name and level for the given classification scheme
ClassificationDescription
StringReturns the detailed description of the classification, given a classification scheme
ClassificationDescriptionAtLevel
StringReturns the detailed description and level of the classification, given a classification scheme
CurrentIndustryIndexSymbol
StringReturns the symbol for the industry index applicable to the given security
For example usage see Note (2)

Notes:

(1) To obtain the SecondLastQuotedDate, you would use the following:
DateTime slqd = norgateSecurityInfo.SecondLastQuotedDate(Symbol.Name);

Supported classification schemes include ThomsonReutersBusinessClassification, GICS, NorgateDataFuturesClassification and NorgateDataCashCommoditiesClassification.


(2) 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 CurrentIndustryIndexSymbol method as follows:

string indexsymbol = norgateSecurityInfo.CurrentIndustryIndexSymbol(Symbol.Name," < index family > ", < level > ,"< index type >");
where: For example, to determine the S&P 1500 Level 4 (Sub-Industry) price return index applicable to the current symbol, you would use:
string indexsymbol = norgateSecurityInfo.CurrentIndustryIndexSymbol(Symbol.Name,"$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 be empty.

Referencing Fundamental Data

A method is provided in norgateSecurityInfo to query the most recently reported fundamental data.
double? a = norgateSecurityInfo.Fundamentals(Symbol.Name,"<fundamentalfield>");

Further information on the fundamental fields are shown here.

Referencing the Original Unadjusted Close

If your trading system needs to reference the original unadjusted closing price of a security, you can use the following -

In the declaration area of the derived class of MySymbolScriptBase, add the following code:

	NorgateData.Integration.RightEdge.OriginalCloseTimeSeries originalClose;

In the Startup() method override, you need to instantiate the DividendTimeSeries indicator class as follows:

	originalClose = new NorgateData.Integration.RightEdge.OriginalCloseTimeSeries();

In the NewBar method, you can reference the original unadjusted close with:

	originalClose.Current
For example, you could add a condition into your buy formula to only trade stocks that close above $2 with:
	&& originalClose.Current > 2

Referencing the AUX1 Field

For stocks, the AUX1 field contains the Turnover (i.e. the total $ amount traded).
For continuous futures, the AUX1 field contains a number (format "YYYYMM") that indicates the underlying contract that was used for the prices on that date.

In the declaration area of the derived class of MySymbolScriptBase, add the following code:

NorgateData.Integration.RightEdge.Aux1TimeSeries aux1;
In the Startup() method override, you need to instantiate the Aux1TimeSeries indicator class as follows:
aux1= new NorgateData.Integration.RightEdge.Aux1TimeSeries();
In the NewBar method, you can reference aux1 with:
aux1.Current