This picture simplifies the theorical stages of a bubble:

If you look for bitcoin bubble versus other bubbles you will find so many of draws done to compare this bubble with the other ones.

The funny thing is that depending of the message the newspaper/blog/author wants to sell to you, you will find a different draw.

I have seen examples where:

  • Tulip bubble is bigger than bitcoin bubble and viceversa.
  • Etherium bubble is bigger that bitcoin bubble.
  • Bitcoin rise and fall just done in 1 year (c’mon guys bitcoin started before 2017!!)

what you can never find is how the draw was done, so you can compare the figures properly.

AWS Machine Learning for enterprises

Today I attended this webinar to introduce the main components that AWS offers for working on Machine Learning.

I like this picture that explains in plain english what is Deep Learning, machine learning and Artificial Inteligence.

The main component of the overall solution is SageMaker, which is an integrated deep learning development and deployment platform, launched in November 2017.

You can build, train, and deploy machine learning models at any scale.

The basic steps are:

  1. Collect and prepare your training data to discover which elements of your data set are important.
  2. Select which algorithm and framework you’ll use. This is basically define the approach you want to use.
  3. Teach the model how to make predictions by training. This step typically requires a lot of compute resources.
  4. Tune the model so it delivers the best possible predictions. This step is often a tedious and manual effort. Here it’s suppposed you have a fully trained model.
  5. Integrate the model with your application and deploy this application on infrastructure that will scale. Here your model can be linked to other models making the things more complex.
  6. Once done, experiment and optimize every part of the process. This takes a lot of specialized expertise, access to large amounts of compute and storage, and a lot of time.

One of the competitive advantages that Amazon SageMaker offers is that it includes modules that can be used together or independently to build, train, and deploy your machine learning models.

Tradingview, Pine editor, SMA (6,70)

This code below has 2 interesting things:

  • Calculate the SMA for 6 days and 70 days.
  • Define a period of time for your backtesting


strategy(“SMA – 6d – 70d”, overlay=true, initial_capital=1000)

FromMonth = input(defval = 1, title = “From Month”, minval = 1)
FromDay = input(defval = 1, title = “From Day”, minval = 1)
FromYear = input(defval = 2012, title = “From Year”, minval = 2014)
ToMonth = input(defval = 1, title = “To Month”, minval = 1)
ToDay = input(defval = 1, title = “To Day”, minval = 1)
ToYear = input(defval = 2018, title = “To Year”, minval = 2018)

// === SERIES SETUP ===
buy = crossover(sma(close, 6), sma(close, 70))
sell = crossunder(sma(close, 6), sma(close, 70))

// === ALERTS ===
strategy.entry(“L”, strategy.long, when=(buy and (time > timestamp(FromYear, FromMonth, FromDay, 00, 00)) and (time < timestamp(ToYear, ToMonth, ToDay, 23, 59))))
strategy.close(“L”, when=(sell and (time < timestamp(ToYear, ToMonth, ToDay, 23, 59))))
plot(sma(close, 6),”SMA 6″, orange)
plot(sma(close, 70),”SMA 70″, navy)
plot(close,”price”, red)

Pine editor, RSI + Bollinger Bands

The entry script done in Pine Editor (trading view)

strategy(shorttitle=”joapenBB”, title=”joapen Bollinger Bands”, overlay=true)
/////////// inputs //////////
// RSI
length = input(14, minval=1)
overSold = input(25, minval=1)
overBought = input(75, minval=1)
price = close
// Bollinger Bands
src = input(close, title=”Source”)
mult = input(2.0, minval=0.001, maxval=50)
basis = sma(src, length)
dev = mult * stdev(src, length)
upper = basis + dev
lower = basis – dev
/////////// long and short conditions //////////
bbLongCondition = crossover(close, lower)
vrsi = rsi(price, length)
if (not na(vrsi))
if (crossover(vrsi, overSold) and bbLongCondition)
strategy.entry(“Long”, strategy.long, comment=”Long”)
if (crossunder(vrsi, overBought))
strategy.entry(“Short”, strategy.short, comment=”Short”)

plot(basis, color=red)
p1 = plot(upper, color=blue)
p2 = plot(lower, color=blue)
fill(p1, p2)

The outputs of the sample backtest:

LTCEUR (Coinbase):

  • share Ratio = 0.516 (1 minute)
  • share Ratio = 0.837 (7 minutes)
  • share Ratio = 0.808 (3 hours)
  • share Ratio = 0.814 (133 minutes)

ETHEUR (Coinbase):

  • share Ratio = 0.26 (1 minute)
  • share Ratio = 0.113 (7 minutes)
  • share Ratio = 0.88 (3 hours)
  • share Ratio = 0.634 (133 minutes)

Trading view Pine Editor, hello world

Reading the book Machine Trading from Ernie P. Chang, on the first chapter it offers different oppinions about environments to gather historical data, do backtesting…

I started to analyze which one of the solutions was better to cover the whole picture proposed in the book. My analysis was basically to compare Tradingview and Ninja Trader.

I started to evaluate Quantopian, as it covers backtesting and the environment to develop is Perl on Notebook (which I am familar with), but I discarded it.

As conclusion, for my initial steps on backtesting I have selected Tradingview as tool to start building backtests scripts.

This one is the first one. It combines a simple strategy between RSI and MACD.

strategy(“Test-1 RSI”, overlay=true, initial_capital=1000, currency=’USD’)
/////////// inputs //////////
// RSI
Length = input(14, minval=1)
Oversold = input(25, minval=1)
Overbought = input(70, minval=1)
fastLength = input(12)
slowlength = input(26)
MACDLength = input(9)
/////////// individual long conditions //////////
// RSI
rsiLongCondition = rsi(close, Length) < Oversold
MACD = ema(close, fastLength) – ema(close, slowlength)
aMACD = ema(MACD, MACDLength)
macdDelta = MACD – aMACD
macdLongCondition = crossover(macdDelta, 0)
/////////// long condition //////////
// RSI and MACD
if (rsiLongCondition and macdLongCondition)
strategy.entry(“Long 1”, strategy.long)
/////////// individual short conditions //////////
// RSI
rsiShortCondition = rsi(close, Length) > Overbought
macdShortCondition = crossunder(macdDelta, 0)
/////////// short condition //////////
if (macdShortCondition)
strategy.close(“Short 1”)

Machine Trading

Machine Trading is the third book of Ernest P. Chang. It’s the second one I start to read.

I say “start” to read due to the fact that there are some chapters that are quite complex to me to understand and I just skipped them.

  1. CHAPTER1 The Basics of Algorithmic Trading: this is the most interesting to me at this moment. It contains sources of information about which tools, platforms and sources of data you can use to aproach the different steps of a quantitative trading analysis.
  2. CHAPTER2 Factor Models
  3. CHAPTER3 Time-Series Analysis (skipped)
  4. CHAPTER4 Artificial Intelligence Techniques (partially skipped)
  5. CHAPTER5 Options Strategies (skipped)
  6. CHAPTER6 Intraday Trading and Market Microstructure (skipped)
  7. CHAPTER7 Bitcoins
  8. CHAPTER8 Algorithmic Trading Is Good for Body: this is a funny extra chapter for laughing. He has a good sense of humour.


Association for Professional Basketball Research Metrics

This association has been working so many years ago on the quantification of all aspects of the game building standard statistics baselines and making some new concepts related to basketball very popular.


I can spend hours looking into the numbers of this site. I would like to see what else is behind the scene, they just offer limited stats.

In any case is a nice reference of data.

Modeling Basketball’s Points per Possession With Application to Predicting the Outcome of College Basketball Games

This essay contains some basic information about different basic ways to calculate the performance of a player or team per posession. I like the analysis Ryan does about the different models he used, it results very didactic.


Do you know any other place where to dig into this type of basketball statistics?

Dashboards, data analysis, how to improve draft results,

this article below mentions 6 technologies that could transform the way the game is seen: https://www.ksl.com/?sid=46267592&nid=294