DarklyEnergized

Dark Energy Divergence Oscillator

DarklyEnergized 已更新   
The Dark Energy Divergence Oscillator (DEDO)

What makes The Universe grow at an accelerating pace?
Dark Energy.
What makes The Economy grow at an accelerating pace?
Debt.
Debt is the Dark Energy of The Economy.

I pronounce DEDO "Deed-oh", but variations are fine with me.

Note: The Pine Script version of DEDO is improved from the original formula, which used a constant all-time high calculation in the normalization factor. This was technically not as accurate for calculating liquidity pressure in historical data because it meant that historical prices were being tested against future liquidity factors. Now using Pine, the functions can be normalized for the bar at the time of calculation, so the liquidity factors are normalized per candle, not across the entire series, which feels like an improvement to me.

Thought Process:

It's all about the liquidity. What I started with is a correlation between major stock indices such as SPX and WRESBAL , a balance sheet metric on FRED

After September 2008, when QE was initiated, many asset valuations started to follow more closely with liquidity factors. This led me to create a function that could combine asset prices and liquidity in WRESBAL , in order to calculate their divergence and chart the signal in TradingView.

The original formula:
First, we don't want "non-QE" data. we only want data for the market affected by QE .
So, find SPX on the day of pre-QE: 1255.08 and subtract that from the 2022 top 4818.62 = 3563.54

With this post-QE SPX range, now you can normalize the price level simply by dividing by the range = ( SPX -1255.08)/3563.54)
Normalization produces values from 0 to 1 so that they can be compared with other normalized figures.

In order to test the 0 to 1 normalized SPX range measure against the liquidity number, WRESBAL , it's the same idea: normalize it using the max as the denominator and you get a 0 to 1 liquidity index:
( WRESBAL /4276000000000)

Subtract one from the other to get the divergence:
(( WRESBAL /4276000000000)-(( SPX -1255.08)/3563.54))*10

x10 to reduce decimal places, but this option is configurable in DEDO's input settings tab.

Positive values indicate there's ample liquidity to hold up price or even create bullish momentum in some cases. Negative values mean price levels are potentially extended beyond what liquidity levels can support.

Note: many viewers of the charts on social media wanted the values to go down in alignment with price moving down, so inverting the chart is what I do with Option + I. I like the fact that negative values represent a deficit in liquidity to hold up price but that's just me.

Now with Pine Script and some help from other liquidity focused accounts on TradingView , I was able to derive a script that includes central bank liquidity and Reverse Repo liquidity drain, all in one algorithm, with adjustable settings.

Central bank assets included in this version:
-JPY (Japan)
-CNY (China)
-UK (British Pound)
-SNB (Swiss National Bank)
-ECB (European Central Bank )

Central Bank assets can be adjusted to an allocation % so that the formula is adjusted for the market cap of the asset.

A handy table in the lower right corner displays useful information about the asset market cap, and percentage it represents in the liquidity pool.

Reverse repo soak is also an optional addition in the Input settings using the RRPONTSYD value from FRED. This value is subtracted from global liquidity used to determine divergence since it is swept away from markets when residing in the Fed's reverse repo facility.

There is an option to draw a line at the Zero bound. This provides a convenience so that the line doesn't keep having to be redrawn on every chart. The normalized equation produces a value that should oscillate around zero, as price/valuation grows past liquidity support, falls under it, and repeats in cycles.






版本注释:
Updated with fixes for the market cap calculation, and helper table in the lower right.

Also changed the default for all CB assets to be included (on).
版本注释:
Change the name used in the indicator status view so it isn't so long.

Subtract RRP by default
版本注释:
Make DEDO an indicator in its own pane, not overlay. It didn't use the current chart symbol anyway.

You can double click on the pane that DEDO is rendered in to make it take up the entire view.

Made the zero line draw by default.

Code cleanup.
版本注释:
Fixes candle color and levels.
版本注释:
Added Korean assets to non-US central banks list of assets available to markets.
版本注释:
Adds Bank of Canada assets

Makes default candle colors a little more pleasant (at least to me, but these are customizable in the settings)
版本注释:
Replace custom "zero" bound line with TradingView's built-in hline method
版本注释:
Uses current chart symbol so that user doesn't have to enter it
Adds ability to use other types of plots, instead of only candles.
版本注释:
Adds a non-liquid fed balance sheet offset used to exclude collateral on balance sheet for items such as the discount window borrowing program (BTFD)
版本注释:
Overhaul to make the script more like the original formula:

FRED:WRESBAL/4276000000000-(SP:SPX-1255.08)/3563.54

The TradingView script will not use the constants as shown in the formula, and instead utilizes the highs at the time of the data point in the series. This is a more accurate equation using WRESBAL, instead of individual Fed balance sheet items.
版本注释:
Add Fed balance sheet items as optional parameters to subtract from the total available to markets.

Balance sheet lines were:
WHOICL - inflation compensation
WUPSHO - unamortized premiums
WLCFLL - loans

Clean up settings in Inputs tab with new categories.
版本注释:
Workaround for China balance sheet.
版本注释:
Remove CNCBBS workaround.

开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?