Correlation Matrix by Daveatt

Hi everyone

A co-pinescripter friend told me this was impossible to do and we bet a free dinner tomorrow. Guess who's going to be invited to a very fancy restaurant tomorrow :) :) :) (hint: not him)

What's the today script is about?

This script is based on this MT4 correlation matrix
Asset correlation is a measure of how investments move in relation to one another and when. ... Under what is known as modern portfolio theory, you can reduce the overall risk in an investment portfolio and even boost your overall returns by investing in asset combinations that are not correlated.

I did it because it wasn't existing before with this format. What I discovered was only correlations shown as plot lines... #this #is #not #pretty

How does it work?

The correlation matrix will not be based on the current asset of the chart BUT will be based on the current timeframe (confusing? if yes, read it again until you'll get it)

- Numbers of bars back: numbers of bars used for the correlation calculation
- High correlation level: Correlation upper threshold. If above, then the correlation will be green
- Low correlation level: Correlation lower threshold. If below, then the correlation will be red
If the correlation is between the high and low levels, then it will be displayed in orange
- FOREX/INDEX: You can choose between displaying the correlation matrix between 3 FOREX or 3 INDEX assets


So far the scale doesn't respond too well to the matrix so you'll have to adapt the scale manually. I'll publish a V2 if I'll find a way to solve this issue from the code directly #new #challenge

A quick final note on why I'm sharing so much?
It challenges me to think out of the norm, get out of my bubble and explore areas of Pinescript that I still don't know. This "a script a day" challenge allows me to speed up my learning curve on Pinescript by a billion factor (and I get a few interesting gigs as well)

Let's bring this indicator to 100 LIKES guys !!!!! I think it deserves it, don't you think? :)

Before all copy/pasters will add a version with crypto tomorrow, don't bother, I already did it and will post it in a few minutes for FREE :p


Be sure to hit the thumbs up as it shows me that I'm not doing this for nothing and will motivate to deliver more quality content in the future.

- I'm an officially approved PineEditor/LUA/MT4 approved mentor on codementor. You can request a coaching with me if you want and I'll teach you how to build kick-ass indicators and strategies
Jump on a 1 to 1 coaching with me
- You can also hire for a custom dev of your indicator/strategy/bot/chrome extension/python

- if you like my work and wants to buy me some coffee :
- BTC TipJar: 3MKDve7stWTe1io99oFxeQXvP8XB4zCQ8m
- LTC TipJar: MC5oeBAhw9BLqyi65TR3J1Lid8io9uHADw
从常用的脚本中删除 添加到常用的脚本
This is an admirable script, definitely an elegant, off the charts style of thinking, yet right there in the chart, (Correlation + Matrix) == BLAM! First of all, I wasn't in the know that bar_index was a series, go figure... I would have never thought of that. Which makes me ponder what other built-in variables are not documented in the Pine Reference as a series by TV. As the French Merovingian in the movie "Matrix Reloaded" would say to Daveatt, "OK, you have some SKILL". If you haven't seen it, I would like to make an opinionated suggestion, watch all 4 - The Matrix, The Animatrix, Matrix Reloaded, and Matrix Revolutions... Watch out for this guy Daveatt in the TV cloud... He's probably doing his superman thing again. Novel work!
Daveatt midtownsk8rguy
@midtownsk8rguy, what a comment!!! Thanks a lot
Actually most of (if not all?) the variables are series in Pine.
PS: I've seen the whole trilogy at least three times so I get what you're saying ^^
@Daveatt, You just unveiled behind the curtain aspects of Pine I haven't contemplated before. color.shades may be excluded for a potential series along with a few others. Let's say you just "set my mind free" again, AND I dream about Pine while I'm sleeping... also while being awake. That's how my day starts, evolves, and ends. I periodically peer upon and wonder as the universe unfolds it's infinite spectacle of awe and beauty in the most sublime of the geomathemagical code called existence. Not so often, I catch a glimpse of ultra methodical thought, now my wheel works in thinking are spinning in contemplation again. I may be on my 30-40th iteration of the Matrix quadrilogy in an infinite for loop until I find the end of PI, where it leads... LOL We'll see you.
Thanks mate, new script new level. Thanks for share.
Daveatt CryptoArch_
@CryptoArch_, Thx !!!
Impressive script!
Daveatt Chloster
@Chloster, hehe thanks
Awesome script.
Dave you are awesome!!! Thank you for your massive contribution.
Daveatt Ace567890
首页 股票筛选器 外汇筛选器 加密货币筛选器 财经日历 如何运作 图表功能 价格 网站规则 版主 网站 & 经纪商解决方案 插件 图表解决方案 帮助中心 功能请求 博客 & 新闻 常见问题 维基百科 Twitter
概述 个人资料设置 账号和账单 TradingView代币 我的客服工单 帮助中心 已发表观点 粉丝 正在关注 私人消息 聊天 退出