Fundamental

Fundamental ( int fundamentalType, String symbol, Any period, String priceType);

Default values:

symbol: getSymbol() period: "<current period>" priceType: "<current type>"

Description

This function is generalization of fundamental functions, i.e. it returns the specified price for the chosen symbol, aggregation period, and price type.

This function should be used with one of the Fundamental Type constants to perform as the corresponding fundamental function. For more information about these constants, see the Fundamental Type constants section.

You can use both Aggregation Period constants and pre-defined string values (e.g. Day, 2 Days, Week, Month, etc.) as valid parameters for the aggregation period. The full list of the pre-defined string values can be found in the Referencing Secondary Aggregation article.

Valid parameters for the price type are: LAST, ASK, BID, and MARK.

Note that for non-Forex symbols, the last three are only supported on intraday charts with time interval not greater than 15 days.

Input parameters

Parameter Default value Description
fundamentalType - Defines fundamental value to be returned. This parameter accepts Fundamental Type constants.
symbol current symbol Defines symbol for which the fundamental value is returned.
period current aggregation Defines aggregation period for which the fundamental value is returned.
priceType current price type Defines the type of value to be returned: Last, Ask, Bid, or Mark.

Example

declare lower;

input price = FundamentalType.CLOSE;
input relationWithSecurity = "SPX";

def price1 = Fundamental(price);
def price2 = Fundamental(price, relationWithSecurity);

plot Relation = if price2 == 0 then Double.NaN else price1 / price2;
Relation.SetDefaultColor(GetColor(1));

This script exemplifies usage of the Fundamental function in the Symbol Relation study.