|
```{r setup, include=FALSE} |
|
knitr::opts_chunk$set( |
|
echo = FALSE, |
|
message = FALSE, |
|
warning = FALSE, |
|
fig.width = 12, |
|
fig.height = 6 |
|
) |
|
``` |
|
|
|
## Bitcoin Price Alert |
|
|
|
The bitcoin price has broken through one or more resistance levels. Please see below for details: |
|
|
|
</br> |
|
|
|
```{r} |
|
library(ggplot2) |
|
library(dplyr) |
|
|
|
bpitechnical <- readRDS('bpitechnical.rda') |
|
|
|
emastatus <- function(data, ema, lag) |
|
{ |
|
yesterdayabove <- ifelse(data[nrow(data)-lag, 'Price'] > data[nrow(data)-lag, ema], T, F) |
|
todayabove <- ifelse(data[nrow(data), 'Price'] > data[nrow(data), ema], T, F) |
|
|
|
if(yesterdayabove != todayabove) |
|
{ |
|
ifelse(yesterdayabove, 'FALL', 'RISE') |
|
}else |
|
{ |
|
'UNCHANGED' |
|
} |
|
} |
|
|
|
ema12status <- emastatus(bpitechnical, 'EMA12', 3) |
|
ema26status <- emastatus(bpitechnical, 'EMA26', 3) |
|
ema50status <- emastatus(bpitechnical, 'EMA50', 3) |
|
ema200status <- emastatus(bpitechnical, 'EMA200', 3) |
|
|
|
ema12colour <- ifelse(ema12status == 'RISE', 'green', 'red') |
|
ema26colour <- ifelse(ema26status == 'RISE', 'green', 'red') |
|
ema50colour <- ifelse(ema50status == 'RISE', 'green', 'red') |
|
ema200colour <- ifelse(ema200status == 'RISE', 'green', 'red') |
|
|
|
ema12message <- ifelse(ema12status == |
|
'RISE', 'The price has risen through the 12 day resistance level.', |
|
ifelse(ema12status == |
|
'FALL', 'The price has fallen through the 12 day resistance level.\n', '') |
|
) |
|
|
|
ema26message <- ifelse(ema26status == |
|
'RISE', 'The price has risen through the 26 day resistance level.', |
|
ifelse(ema26status == |
|
'FALL', 'The price has fallen through the 26 day resistance level.\n', '') |
|
) |
|
|
|
ema50message <- ifelse(ema50status == |
|
'RISE', 'The price has risen through the 50 day resistance level.', |
|
ifelse(ema50status == |
|
'FALL', 'The price has fallen through the 50 day resistance level.\n', '') |
|
) |
|
|
|
ema200message <- ifelse(ema200status == |
|
'RISE', 'The price has risen through the 200 day resistance level.', |
|
ifelse(ema200status == |
|
'FALL', 'CRITICAL: The price has fallen through the 200 day resistance level.\n', '') |
|
) |
|
|
|
risesig <- ifelse(ema200status=='RISE', 4, ifelse(ema50status=='RISE', 3, ifelse(ema26status=='RISE', 2, ifelse(ema12status=='RISE', 1, 0)))) |
|
|
|
fallsig <- ifelse(ema200status=='FALL', 4, ifelse(ema50status=='FALL', 3, ifelse(ema26status=='FALL', 2, ifelse(ema12status=='FALL', 1, 0)))) |
|
|
|
positivenews <- ifelse(risesig > fallsig, T, F) |
|
|
|
``` |
|
|
|
<span style="color:`r ema12colour `"> `r ema12message `</span> |
|
<span style="color:`r ema26colour `"> `r ema26message `</span> |
|
<span style="color:`r ema50colour `"> `r ema50message `</span> |
|
<span style="color:`r ema200colour `"> `r ema200message `</span> |
|
|
|
### Historical Views |
|
|
|
```{r} |
|
ggplot(bpitechnical, aes(x=Day)) + |
|
geom_line(aes(y=Price), colour='black') + |
|
geom_line(aes(y=EMA12), colour='green', size=1.3, alpha=0.3) + |
|
geom_line(aes(y=EMA26), colour='yellow', size=1.3, alpha=0.3) + |
|
geom_line(aes(y=EMA50), colour='orange', size=1.3, alpha=0.3) + |
|
geom_line(aes(y=EMA200), colour='red', size=1.3, alpha=0.3) + |
|
ylab('ZAR') + |
|
theme(axis.title.x = element_blank()) + |
|
ggtitle('All Time') |
|
|
|
ggplot(filter(bpitechnical, Index > nrow(bpitechnical) - 365), aes(x=Day)) + |
|
geom_line(aes(y=Price), colour='black') + |
|
geom_line(aes(y=EMA12), colour='green', size=1.3, alpha=0.3) + |
|
geom_line(aes(y=EMA26), colour='yellow', size=1.3, alpha=0.3) + |
|
geom_line(aes(y=EMA50), colour='orange', size=1.3, alpha=0.3) + |
|
geom_line(aes(y=EMA200), colour='red', size=1.3, alpha=0.3) + |
|
ylab('ZAR') + |
|
theme(axis.title.x = element_blank()) + |
|
ggtitle('1 Year') |
|
|
|
ggplot(filter(bpitechnical, Index > nrow(bpitechnical) - 92), aes(x=Day)) + |
|
geom_line(aes(y=Price), colour='black') + |
|
geom_line(aes(y=EMA12), colour='green', size=1.3, alpha=0.3) + |
|
geom_line(aes(y=EMA26), colour='yellow', size=1.3, alpha=0.3) + |
|
geom_line(aes(y=EMA50), colour='orange', size=1.3, alpha=0.3) + |
|
geom_line(aes(y=EMA200), colour='red', size=1.3, alpha=0.3) + |
|
ylab('ZAR') + |
|
theme(axis.title.x = element_blank()) + |
|
ggtitle('3 Months') |
|
|
|
ggplot(filter(bpitechnical, Index > nrow(bpitechnical) - 31), aes(x=Day)) + |
|
geom_line(aes(y=Price), colour='black') + |
|
geom_line(aes(y=EMA12), colour='green', size=1.3, alpha=0.3) + |
|
geom_line(aes(y=EMA26), colour='yellow', size=1.3, alpha=0.3) + |
|
geom_line(aes(y=EMA50), colour='orange', size=1.3, alpha=0.3) + |
|
geom_line(aes(y=EMA200), colour='red', size=1.3, alpha=0.3) + |
|
ylab('ZAR') + |
|
theme(axis.title.x = element_blank()) + |
|
ggtitle('1 Month') |
|
``` |
|
|
|
</br> |
|
|
|
`r if(positivenews){'[comment]: # '}` EVERYTHING WILL BE FINE, JUST <span style="color:green"> HODL </span> |
|
|
|
</br> |
|
|
|
Trading in cryptocurrencies is a high risk venture. Consult with a financial advisor before making investment decisions. This should not be treated as expert financial advice. |
|
|
|
</br> |
|
|
|
|
|
`Powered by coindesk.com` |