Skip to main content

The Quantitative Investor 1.52

Page 1

”Macro-scale quantitative market analysis”

T Quantitati In `tor MARCH 26, 2021

VOL.I. . . No.52

Abstract By BENJAMIN J. COWEN, PHD

BC ANALYTICS, LLC

The introduction on PineScript will show how to code up a fairly basic indicator. Learning some of the basic principles can be a huge barrier, but perhaps slowly walking through them together will help people obtain the confidence they need to begin exploring the idea of creating their own indicators. I understand that this type of weekly report/video will not be useful to everyone, but hopefully enough people will find value in a discussion on PineScript. First, you will want to define the study (Fig. 2). As shown in the figure, I am using PineScript version 4.

You have jumped into the cryptoverse! Welcome to the 52nd edition of The Quantitative Investor, a weekly newsletter for those who want to dive deep into the metrics of various financial markets, with a focus on cryptocurrencies, and visualize data not often presented elsewhere. The main objectives of this newsletter are to graph key metrics, identify any trends or correlations, and present the data which will help the reader understand long-term price movements. This report is strictly not financial advice and should not be treated as such. Instead, it is focused on analyzing historical data, presenting the data in a manner which is informative, and making a few projections Figure 2: Bitcoin bull market support PineScript. based on mathematics alone. The reader is still expected to do their own research when it comes to investing, especially within Then we can define our inputs (Fig. 3). Note that this part the cryptocurrency asset class. can be made more simplistic if you do not want the variables to be inputs that the user can change.

Trading View Pine Script

This week I have decided to do an introduction to the programming language used by Trading View, called Pinescript. This is just a rudimentary introduction, but it should at least be enough to get started. In the weekly video we show how to recreate the Bull Market Support Band Indicator (Fig. 1). If you are new to programming, I recommend just following along. While making an indicator may seem complicated, it Figure 3: Bitcoin bull market support PineScript. is actually quite easy once you get the hang of it. You simply need to define things and then plot them (generally speaking). Of course, you are free to make things as complicated or as Then we simply plot it all (Fig. 4). I’ve also added a line to simplistic as you want. change the background color anytime there is a cross between the two moving averages.

Figure 4: Bitcoin bull market support PineScript.

Figure 1: Bitcoin bull market support indicator.

The discussion on creating this indicator can be found in the weekly video, with the source code shown in Fig. 5.


The Quantitative Investor

VOL.I. . . No.52

MARCH 26, 2021

Asset BTC ETH LTC ADA LINK XRP XMR SPX

Price $53683 $1660 $181 $1.20 $26.88 $0.55 $219 $3927

Risk 0.771 0.546 0.558 0.573 0.569 0.329 0.484 0.818

2 Risk (Last Wk) 0.854 0.584 0.604 0.630 0.617 0.310 0.510 0.829

Figure 5: Bitcoin bull market support PineScript.

105

1 0.9

104

0.8

ETH Price ($)

Risk

BTC Price ($)

0.7

103

0.6 0.5

102

2000

1

1800

0.9

1600

0.8

1400

0.7

1200

0.6

1000

0.5

800

0.4

600

0.3

400

0.2

200

0.4

0.1

0 Jan 2019

Jul 2019

Jan 2020

Jul 2020

Jan 2021

0.3

101

0.2

Figure 8: Ether price vs. time with a color-coded risk dimension.

0.1

100

0

2012 2013 2014 2015 2016 2017 2018 2019 2020 2021

Figure 6: Bitcoin price vs. time with a color-coded risk dimension.

104

104

1 Price Risk

0.9

0.9 103

0.8 3

0.8 0.7

0.6

102

0.5 101

0.4

ETH Price ($)

0.7

Risk

BTC Price ($)

10

1

102

0.6 0.5

101

0.4

0.3

100

0.2

Risk

105

0.3 100

0.2

10-1 0.1 10-2 2010

0 2012

2014

2016

2018

2020

0.1 10-1

0 2016

2017

2018

2019

2020

2021

Figure 7: Bitcoin price (primary y-axis) and risk (secondary Figure 9: Ether price (primary y-axis) and risk (secondary y-axis) vs. time. y-axis) vs. time.


The Quantitative Investor

VOL.I. . . No.52 103

MARCH 26, 2021

3

103

1

1 Price Risk

0.9

0.8

0.8

102 0.7

0.7

102

0.9

10

1

0.5

Risk

0.5

BNB ($)

LTC Price ($)

0.6 0.6

0.4 0.4

0.3

101

100

0.3

0.2

0.2

0.1

0.1

100 2013

2014

2015

2016

2017

2018

2019

2020

10

-1

0 Jan 2018

Jan 2019

Jan 2020

Jan 2021

2021

Figure 13: Cardano price (primary y-axis) and risk (secondary Figure 10: Litecoin price vs. time with a color-coded risk y-axis) vs. time. dimension. 103 103

1

1

0.9

Price Risk

0.9

0.8

0.8

102 0.7

LTC Price ($)

0.5

Risk

0.6

XMR ($)

0.7

102

0.6

101

0.5

0.4 101

0.4

0.3

0.3

100

0.2

0.2 0.1 100

0.1

0 2015

2016

2017

2018

2019

2020

2021

10

-1

2015

2016

2017

2018

2019

2020

2021

Figure 11: Litecoin price (primary y-axis) and risk (secondary Figure 14: Monero price vs. time with a color-coded risk y-axis) vs. time. dimension. 103

1

103

1

0.9

Price Risk

0.8

0.8

102

102 0.7

0.6 0.5

0.6 101

0.5

0.4 0.3

100

0.4 0.3 100 0.2

0.2

0.1

0.1

10-1

10-1

Jan 2018

Jan 2019

Jan 2020

Jan 2021

Risk

10

XMR ($)

BNB ($)

0.7

1

0.9

0 2015

2016

2017

2018

2019

2020

2021

Figure 12: Cardano price vs. time with a color-coded risk Figure 15: Monero price (primary y-axis) and risk (secondary y-axis) vs. time. dimension.


The Quantitative Investor

VOL.I. . . No.52

4000

1

0.9

3800

0.9

0.8

3600

0.7

3400

0.5 0.4

S&P 500 ($)

0.6

LINK ($)

4

1

101

100

MARCH 26, 2021

0.8 0.7 0.6

3200 0.5

3000 0.4

2800

0.3

0.3

2600

0.2

0.2

2400

0.1

0.1

10-1

Jan 2018

Jan 2019

Jan 2020

2200 Jan 2017

Jan 2021

0

Jan 2018

Jan 2019

Jan 2020

Jan 2021

Jan 2022

Figure 16: Chainlink price vs. time with a color-coded risk Figure 18: Price of the S&P 500 vs. time with a color-coded risk dimension. dimension. 104

1

101

1 0.9

0.9

0.8

0.8

103 0.7

0.5 100

0.4

S&P 500 ($)

0.6

Risk

LINK ($)

0.7

0.6 102

0.5

Risk

Price Risk

0.4 0.3

0.3

101 0.2

0.2 Price ($) Risk

0.1 10

-1

0 Jan 2018

Jan 2019

Jan 2020

Jan 2021

0

10 1920

0.1 0

1940

1960

1980

2000

2020

Figure 17: Chainlink price (primary y-axis) and risk (secondary Figure 19: S&P 500 price (primary y-axis) and risk (secondary y-axis) vs. time. y-axis) vs. time.


Turn static files into dynamic content formats.

Create a flipbook
The Quantitative Investor 1.52 by Will Pastons - Issuu