• Products
  • Community
  • Markets
  • Brokers
  • More
Get started
  • Community
  • /
  • /Dynamicaverage

Dynamicaverage

Correlation Coefficient: Visible Range Dynamic Average R -Correlation Coefficient with Dynamic Average R (shows R average for the visible chart only, changes as you zoom in or out) -Label: Vis-Avg-R = Visable Average R -the Correlation Coefficient function for Pearson's R is taken from "BA🐷 CC" indicator by @balipour (highly recommended; more thorough treatment of R and other stats, but without the dynamic average) -I wrote this primarily to add a dynamic Average R, showing correlation for arbitrary start times/end times; whether it be the last month, last year, of some specific period from the past (backtest mode) -I have been using this to get an idea of correlation regimes over time between Bonds vs Stocks (ZB1! vs ES1!). -As you see from the above, most of 2022 has seen an unusually strong positive correlation between Bonds and Stocks ~~inputs: -lookback length for calculation of R -Backtest mode (true by default): displays Average R for ONLY the visible range displayed on any part of chart history (LHS to RHS of screen only) -source for both Ticker and compared Asset (close, open, high, low, ohlc4.. etc) ~~some other assets worth comparing: Aussie vs Gold; Aussie vs ES; Btc vs ES; Copper vs ES
Pine Script® indicator
by twingall
Updated Jun 18, 2023
33

Select market data provided by ICE Data services. Select reference data provided by FactSet. Copyright © 2025 FactSet Research Systems Inc.© 2025 TradingView, Inc.

More than a product
  • Supercharts
Screeners
  • Stocks
  • ETFs
  • Bonds
  • Crypto coins
  • Crypto pairs
  • CEX pairs
  • DEX pairs
  • Pine
Heatmaps
  • Stocks
  • ETFs
  • Crypto
Calendars
  • Economic
  • Earnings
  • Dividends
More products
  • Yield curves
  • Options
  • News Flow
  • Pine Script®
Apps
  • Mobile
  • Desktop
Community
  • Social network
  • Wall of Love
  • Refer a friend
  • House Rules
  • Moderators
Ideas
  • Trading
  • Education
  • Editors' picks
Pine Script
  • Indicators & strategies
  • Wizards
  • Freelancers
Tools & subscriptions
  • Features
  • Pricing
  • Market data
Special offers
  • CME Group futures
  • Eurex futures
  • US stocks bundle
About company
  • Who we are
  • Manifesto
  • Athletes
  • Blog
  • Careers
  • Media kit
Merch
  • TradingView store
  • Tarot cards for traders
  • The C63 TradeTime
Policies & security
  • Terms of Use
  • Disclaimer
  • Privacy Policy
  • Cookies Policy
  • Accessibility Statement
  • Security vulnerability
  • Status page
Business solutions
  • Widgets
  • Charting libraries
  • Lightweight Charts™
  • Advanced Charts
  • Trading Platform
Growth opportunities
  • Advertising
  • Brokerage integration
  • Partner program
  • Education program
Community
  • Social network
  • Wall of Love
  • Refer a friend
  • House Rules
  • Moderators
Ideas
  • Trading
  • Education
  • Editors' picks
Pine Script
  • Indicators & strategies
  • Wizards
  • Freelancers
Business solutions
  • Widgets
  • Charting libraries
  • Lightweight Charts™
  • Advanced Charts
  • Trading Platform
Growth opportunities
  • Advertising
  • Brokerage integration
  • Partner program
  • Education program
Look FirstLook First