A composite symbol is defined by a mathematical expression where other symbols are used as variables. On TrendSpider, composite symbols must always start with the equality sign =, e.g. =SPY.CHG / QQQ.CHG or =1 / ^EURUSD.
When you define a composite symbol, you basically define a formula which will be applied to every candle on your chart. In case you are using composites involving asset types which have different trading sessions, the composite values will only be defined for time stamps where all of the base symbols involved have candles.
Composite charts can have all the indicators, chart patterns, and other TA tools applied, just like all the other charts on TrendSpider. Composite symbols are supported wherever other symbols are supported: you can see them on charts, you can backtest on them, you can use them in Compare or Relative Strength indicators, you can create alerts on them, etc. A few exceptions are listed in the Limitations section below.
Operations Supported
Mathematical operations supported are: +, -, /, *, (, ), %, ^. Ternary operator condition ? if_true : if_false is supported, too. You can use up to 9 unique symbols in a composite expression. Composites can involve any asset type TrendSpider supports. Please note that if you're using cryptos in your composites, then you must also specify the exchange name (see the Limitations section below).
Some symbols do have operation signs (like ^) as their natural part, so for the purpose of simplicity, please always use space to separate your math operators from symbols. I.e., do prefer =AAPL.CHG / SPY.CHG over =AAPL.CHG/SPY.CHG.
In case you're browsing a composite chart using a chart type which illustrates OHLC, these values are defined as follows:
open: result of the operation applied to "open" of every symbol involvedhigh: first, result of the operation applied to "high" of every symbol involved is computed. next, the resulting "high" is defined asmax of (open, high, low, close)low: first, result of the operation applied to "low" of every symbol involved is computed. next, the resulting "low" is defined asmin of (open, high, low, close)close: result of the operation applied to "close" of every symbol involved
Using Particular Data Points in Composites
You can refer to particular data points of charts in your composites. I.e., a composite of =SPY / QQQ is an OHLC chart computed according to the rules above. But a composite of =SPY.O / QQQ.O is a Line chart (means each candle only has 1 data point) where each value is equal to "open of SPY divided by open of QQQ". Here's a list of data points you can refer to:
.O: open price.H: high price.L: low price.C: close price.V: volume.CHG: change%, defined as(close - prevClose) / prevClose.ACHG: absolute change%,abs((close - prevClose) / prevClose).SIZE: contract unit for Futures. I.e.,HOJ24.SIZEis 42,000, as per the contract specification
You can also refer to values of previous candles by adding [N], where N is the number of candles back. This works for symbols and for any of the data points above: AAPL.C[5] is the close of AAPL 5 candles ago, so =AAPL.C - AAPL.C[5] is the price change over the last 5 candles. The first N candles of such a chart are left empty, since there is no earlier data for them.
Functions
Functions compute a value over the last length candles. In every function below, expression can be any formula (including other functions), and length is a number of candles, a whole number from 1 to 100. Function names must be written in uppercase.
MA(expression, length): average value.SMA()andAVG()are the sameSUM(expression, length): sum of valuesMIN(expression, length): lowest valueMAX(expression, length): highest valueSTDEV(expression, length): standard deviation, the same one used in Bollinger BandsMIN(value1, value2, ...): lowest of the values given, i.e.=MIN(AAPL.C, AAPL.O)returns a line series where each point is the lowest of Open and Close. Also can be called as a trailing function=MIN(AAPL.L, 20), which will return "the lowest low over the last 20 candles"MAX(value1, value2, ...): highest of the values given, i.e.=MAX(AAPL, MSFT, 0). Also supports a different form,=MAX(AAPL.H, 20)
Examples
Here are some examples of composites explained. Please note that these don't necessarily make sense from the standpoint of trading, they are just illustrations of what's doable:
=SPY/QQQis an OHLC chart illustrating prices of SPY divided by prices of QQQ.=(META + GOOG + MSFT + NFLX + AAPL) / 4is an average price for FAANG. Like a basic custom index.=(META + GOOG * 3 + MSFT + NFLX + AAPL) / 6is an average price for FAANG but GOOG will be weighted 3 times more than other constituents of this list.=META.ACHG / SPY.ACHGis a ratio between change% of META and change% of SPY. I.e., if applied to a Daily chart, that would illustrate relative strength of META against SPY. Any time this value is above 1, META is outperforming SPY (in terms of price change% at a given candle).=ES1!.V / ES2!.Vis a ratio of Volume on the next ES contract vs Volume on a contract after next.=(AAPL.C * 2 + AAPL.O + AAPL.H + AAPL.L) / 5is a Weighted Close price for AAPL.=BINANCE:^ETHBTC / BINANCE:^LTCETHillustrates how much BTC one LTC costs on Binance in case you first trade ETH for BTC and then buy LTC for ETH.=1 / BINANCE:^LTCBTCwill give a value almost equivalent to the previous example.=(SPY.CHG > 0 ? 1 : 0) + (QQQ.CHG > 0 ? 1 : 0)would return 0 if neither SPY nor QQQ are green; it will return 1 if one is green and one is not, and it will return 2 if both are green.=SPY.C / SPY.C[10] - 1is the performance of SPY over the last 10 candles.=MAX(AAPL.H, 20)is the highest high of AAPL over the last 20 candles.=MA(AAPL / SPY, 20)is a 20-candle moving average of the AAPL to SPY ratio.=(AAPL / MSFT - MA(AAPL / MSFT, 20)) / STDEV(AAPL / MSFT, 20)is a z-score of the AAPL to MSFT ratio, showing how far the ratio is from its recent average.=AAPL.V / SMA(AAPL.V, 20)relative volume of AAPL=SMA(AAPL.C - AAPL.C[1], 20)average price change over the last 20 candles
Limitations of Composite Symbols
- You can't use more than 9 base symbols within a composite
- The computed Composite symbols never have the volume series
- If you're using cryptos in your composites, then you must also specify the exchange name. I.e.,
=BINANCE:^ETHBTC / BINANCE:^LTCETH, not=^ETHBTC / ^LTCETH - Annotations on composites are sensitive to whitespaces in a formula. I.e., if you paint lines on
=SPY/QQQthen they will work, but if you open=SPY / QQQthen you won't see them. If you go back to=SPY/QQQ, your lines will be there. - Composite charts don't receive any real time updates. Think of them as snapshot data generated at the moment when you have requested it. It uses real time data, but simply receives no updates after generated. If you need to see the updated data, you'll have to refresh the chart.
- Composite symbols have their trading session defined as "24/7, UTC time zone"
- Functions can't look back more than 100 candles. Composites using functions or
[N]lookbacks only start once enough earlier candles are available
What went wrong? (Optional)