Advertisement
fabgonber

FED Net Liquidity Indicator for Thinkorswim TOS Thinkscript

Dec 28th, 2022 (edited)
1,574
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.04 KB | None | 0 0
  1. # You can download the latest version of this indicator here: https://pastebin.com/edit/M6ttyxDf
  2. #
  3. #   In theory, Fed liquidity indicates the amount of money coming into the market.
  4. #   If the SPX reaches the red zone it means that there is no more liquidity to continue rising.
  5. #   If it is in the green zone, there is enough money flowing into the market to push it higher.
  6. #
  7. #   Use only in SPX
  8. #
  9. # Based on the original work of:
  10. #     https://twitter.com/maxjanderson/status/1546472693234470912
  11. #     https://thinkscript101.com/fed-net-liquidity-indicator-thinkorswim/
  12.  
  13. input Short_Zone = 350;
  14. input Long_Zone = -150;
  15.  
  16. def a = If(IsNaN(close("WALCL:FRED")), a[1], close("WALCL:FRED"));
  17. def b = If(IsNaN(close("WTREGEN:FRED")), b[1], close("WTREGEN:FRED"));
  18. def c = If(IsNaN(close("RRPONTSYD:FRED")), c[1], close("RRPONTSYD:FRED"));
  19. def SPX = If(IsNaN(close("SPX")), SPX[1], close("SPX"));
  20. def SPXFairValueNetLiq = (a - (b + c) * 1000) / 1000 / 1.1 - 1625;
  21. def SPXFairValue = If(!IsNaN(close), SPXFairValueNetLiq, Double.NaN);
  22. AddLabel(yes, "FED Net Liquidity = Fed Balance Sheet - (Treasury General Account + Reverse Repo)");
  23. AddLabel(yes, "Use ONLY in SPX daily");
  24.  
  25. plot los_colores = close;
  26. los_colores.DefineColor("Short_Zone", Color.DARK_RED);
  27. los_colores.DefineColor("Long_Zone", Color.DARK_GREEN);
  28. los_colores.SetHiding(yes);
  29.  
  30. plot upperBand = SPXFairValue + Short_Zone;
  31. AddCloud(upperBand, upperBand + 200, Color.lIGHT_GREEN, Color.pink);
  32. upperBand.AssignValueColor(los_colores.color("Short_Zone"));
  33.  
  34. plot red_short_arrow = if high>upperBand then high*1.01 else Double.NaN;
  35. red_short_arrow.setDefaultColor(Color.RED);
  36. red_short_arrow.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
  37.  
  38.  
  39. plot lowerBand = SPXFairValue + Long_Zone;
  40. AddCloud(lowerBand, lowerBand - 200, Color.lIGHT_GREEN, Color.pink);
  41. lowerBand.AssignValueColor(los_colores.color("Long_Zone"));
  42.  
  43. plot green_long_arrow = if low<lowerBand then low*0.99 else Double.NaN;
  44. green_long_arrow.setDefaultColor(Color.GREEN);
  45. green_long_arrow.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement