xmd79

VIX % Contango

Jan 22nd, 2022 (edited)
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
  2. // ©aeromircorp
  3. // VIX % Contango - VIX CBOE-VX1!
  4. //@version=5
  5.  
  6. indicator("VIX % Contango", overlay=false)
  7.  
  8. threshold = input.float(3.0, "Threshold")
  9.  
  10. inp = input(close)
  11.  
  12. VIX1 = request.security("VX1!", "", inp)
  13. VIX2 = request.security("VX2!", "", inp)
  14.  
  15. oscillator = 100*(VIX2-VIX1)/VIX1
  16.  
  17. var plotcolor = color.green
  18.  
  19. if (oscillator > 3.0)
  20. plotcolor := color.green
  21. else if (oscillator >= 0.0)
  22. plotcolor := color.orange
  23. else
  24. plotcolor := color.red
  25.  
  26. plot(oscillator, title="VIX % Contango", color=plotcolor, linewidth=2)
  27.  
  28. hline(0, "Center", color=color.gray, linestyle=hline.style_dotted)
  29. hline(threshold, "", color=color.orange, linestyle=hline.style_dashed)
Add Comment
Please, Sign In to add comment