- Symbols/formulas:
- P/E of S&P 500: SP500_PE_RATIO_MONTH
- Central-bank liquidity: USCBBS+JPCBBS/USDJPY+CNCBBS/USDCNY+EUCBBS/USDEUR+GBCBBS/USDGBP
- Yield curve inversion: US10Y-US03MY
- UNRATE (US Unemployment Rate)
- JTSJOL (US Non-farm job openings)
- JTSLDL (US Layoffs and Discharges)
- JTSQUR (US Quits). Less recession risk if this is rising maybe?
- JTSQUR (US Job Quits). Similar to previous one.
- JTSQUR (US Employment-Population Ratio). Less recession risk if this is rising maybe?
- USGD (US Government Debt)
- USCPI (US CPI)
- SAHMCURRENT (Sahm Rule Recession Indicator)
- USREC (US NBER Recessions)
- USHMI (US NAHB Housing Market Index, National Association of Home Builders)
- ALTSALES (US Autos and Light Truck Sales)
- USBCOI (US PMI (Purchase Managers Index) from ISM)
- VIX (Volatility Index)
- BAMLH0A0HYM2 (ICE BofA US High Yield Option-Adjusted Spread). US "junk bond spread" that measures financial stress.
- RRPONTSYD (US FED: ON RRP: Overnight Reverse Repurchase Agreements). Will be non-zero during periods of very high liquidity among large banks.
- WALCL for "FED Total Assets"
- USOIL for WTI prices
- UKOIL for Brent prices
- commodities:
- XCUUSD Copper
- SOYBNUSD Soybeans
- WHEATUSD Wheat
- CORNUSD Corn
- SUGARUSD Sugar
- ALUMINIUM (ticker at IG)
Discontinued symbols (LIBOR is not longer used):
- SEHPI for Swedish Housing Price Index (Value Guard)
- TEDRATE (TED Spread, diff between "risk free T-Bills and EuroDollar Futures as measured by LIBOR". Shows risk in interbank contracts. A measure of financial stress)
- Indicators:
- "US Recessions" or "US Recesion Indicator"
PineScript:
- ctrl-click function to see docs
- scripts begin with one of:
indicator("my indicator")
strategy("my strategy")
library("my library")
- "x = 1" declares a new variable and "x := 1" overrides the value of an existing variable
- the value "na" is like null/unset, for example "plot(na)" plots nothing (at least one plot() call is mandatory)
- indicator script runs once per bar
- if you prefix a variable declaration with "var" it becomes persistent (saved between bars)
- log.error("hello world" + str.tostring(x))
- myBoolSetting = input.bool(title="My bool setting", defval=false)
- my setting confirm=true on a setting, it becomes a mandatory input whenever indicator is added to chart
// draw yellow "x" above price candles where the cagr of last 10 bars are above 20
lookback = 10
cagrVal = ta.cagr(entryTime = time[lookback], entryPrice = close[lookback], exitTime = time, exitPrice = close)
plot(cagrVal, "cagr", display=display.data_window)
plotshape(cagrVal > 20, force_overlay = true, color = color.yellow)
// plot shaded blue area between price low/high
l = plot(low)
h = plot(high)
fill(h, l, color=color.new(color.blue, 85))
// Green bgcolor whenever MA50 crosses over MA200, and red background when MA50 crosses below MA200
//@version=6
indicator("My script", overlay=true)
ema1 = ta.ema(close, 50)
ema2 = ta.ema(close, 200)
plot(ema1, color=color.orange)
plot(ema2, color=color.green)
bgcolor(ta.crossover(ema1, ema2) ? color.green : na)
bgcolor(ta.crossunder(ema1, ema2) ? color.red : na)
// Example strategy that buys/sells on EMA50/200 crossovers
//@version=6
strategy("EMA50/EMA200 Crossover", overlay=true, initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
ema50 = ta.ema(close, 50)
ema200 = ta.ema(close, 200)
plot(ema50, color=color.new(color.blue, 0), title="EMA 50")
plot(ema200, color=color.new(color.orange, 0), title="EMA 200")
if (ta.crossover(ema50, ema200))
strategy.entry("Long", strategy.long)
if (ta.crossunder(ema50, ema200))
strategy.close("Long")