1. Home
2. ThinkorSwim Indicators
3. Recession And Bull Run Indicator for ThinkorSwim

# Recession And Bull Run Indicator for ThinkorSwim

This indicator tries to predict a period of recession (bearish) and expansion (bullish) based on the Unemployment Level.

The data is released each month by the Bureau of Labor Statistics (BLS). This bureau reports its findings to bring attention to the current economic conditions.

The report also presents information about employment trends in the labor market.

## Recession And Bull Run Indicator for ThinkorSwim

```# Indicator Name: Recession And Bull Run
# Version: 1.0.0
# Developer: Melvin C.
# URL: https://thinkscript101.com/recession-bull-run-indicator-thinkorswim/
def low_ema = ExpAverage(Close("UNEMPLOY:FRED"),5);;
def high_ema = ExpAverage(Close("UNEMPLOY:FRED"),21);;
def a = If(IsNaN(low_ema), a[1], low_ema);
def b = If(IsNaN(high_ema), a[1], high_ema);
def cross = ((102 * b[1]) - (22 * a[1])) / 80;
def warning_true = a[2] < b[2] and a >= b;
def bullrun = a >= b and a[2] > a;
plot bear = if warning_true then high else double.nan;
plot bull = if bullrun then low else double.nan;
bear.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
bear.SetDefaultColor(Color.Cyan);
bull.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
bull.SetDefaultColor(Color.White);
```

Usage: Apply this indicator to your SPX/SPY monthly chart.

One word of caution, though:

The Unemployment Level is only updated on a monthly basis. This implies that the indicator won’t always reflect the current market condition.

However, if you backtest the indicator, you’ll see that it has a good track record of accurately calling both bull runs and recessions months in advance.

Happy testing!

## Unlock the Power of ThinkorSwim

Get the latest news and updates on TD Ameritrade, ThinkorSwim indicators, thinkScript tutorials, and trading strategies delivered straight to your inbox every week.

We don’t spam! Unsubscribe at anytime.