Cross-indicator references
You can read the output of another indicator with Indicator.Output. The referenced definition is inlined before compilation, so there is no runtime cost and no dependency on the other indicator being loaded on the chart.
J := KDJ.J; // default arguments (9, 3, 3)
DIF := MACD.DIF(5, 34, 5); // explicit arguments
FAST := "RSI.RSI1(6)"; // the quoted form works too
SIG: IF(J < 20 AND DIF > 0, 1, 0), COLORSTICK;The argument list must sit immediately after the reference with no space, so an expression such as MACD.DIF * (A + B) is never misread as a call. Arguments must be plain numbers. Referencing the same indicator with different arguments expands it more than once, each into its own private variables.
| Indicator | Outputs (default arguments) |
|---|---|
MACD | DIF, DEA, MACD — (12, 26, 9) |
KDJ | K, D, J — (9, 3, 3) |
RSI | RSI1, RSI2, RSI3 — (6, 12, 24) |
CCI | CCI — (14) |
BOLL | BOLL, UB, LB — (20) |
WR | WR1, WR2 — (10, 6) |
BIAS | BIAS1, BIAS2, BIAS3 — (6, 12, 24) |
ATR | MTR, ATR — (14) |
DMI | PDI, MDI, ADX, ADXR — (14, 6) |
OBV | OBV, MAOBV — (30) |
TRIX | TRIX, MATRIX — (12, 9) |
ROC | ROC, MAROC — (12, 6) |
MTM | MTM, MAMTM — (12, 6) |
PSY | PSY, PSYMA — (12, 6) |
VR | VR, MAVR — (26, 6) |
Only these definitions are referenceable: they are pure formula scripts with no drawing calls and no external data dependency. Draw statements inside a referenced indicator are dropped during inlining — you get the numbers, not the graphics.