We will add the Bollinger Bands using the add BBands

BBands command and the MACD trend

bollinger bands
Bollinger Bands are a popular technical analysis tool used in the stock market to help traders and investors identify potential price trends, volatility, and potential reversal points. They were developed by John Bollinger in the 1980s and consist of three lines plotted on a price chart:

Middle Band (Simple Moving Average - SMA):

The middle band is typically a 20-period simple moving average (SMA) of the stock's price. It represents the average price over the specified period.
Upper Band (SMA + Standard Deviation):

The upper band is calculated by adding a multiple (usually 2) of the standard deviation of the stock's price to the middle band. The standard deviation measures the price volatility over the same period as the SMA.
Lower Band (SMA - Standard Deviation):

The lower band is calculated by subtracting the same multiple of the standard deviation from the middle band.

Key points and interpretations of Bollinger Bands:


Volatility Indicator: Bollinger Bands are primarily used as a volatility indicator. When the bands expand, it indicates increased price volatility, and when they contract, it suggests decreased volatility.

Price Bands: The upper and lower bands form price channels around the middle band. These channels are used to identify potential support and resistance levels.

Overbought and Oversold Conditions: When the price touches or moves outside the upper band, it may be considered overbought, suggesting a potential reversal or pullback. Conversely, when the price touches or moves outside the lower band, it may be considered oversold, indicating a potential reversal to the upside.

Squeeze: A Bollinger Bands squeeze occurs when the bands contract significantly, indicating a period of low volatility. Traders often use this as a signal of an impending price breakout or significant move.

Confirmation with Other Indicators: Traders often use Bollinger Bands in conjunction with other technical indicators, such as the Relative Strength Index (RSI) or MACD, to confirm potential buy or sell signals.

Duration of SMA and Standard Deviation: While the 20-period SMA is the most commonly used setting for Bollinger Bands, traders can adjust the number of periods to suit their trading style. Shorter periods result in more sensitive bands, while longer periods yield smoother bands with less sensitivity.

Adjusting the Standard Deviation Multiplier: The standard deviation multiplier (usually 2) can be adjusted to make the bands wider or narrower, depending on the trader's preference for sensitivity.

Bollinger Bands are a versatile tool that can help traders identify potential price reversals, breakouts, and trends. However, like any technical indicator, they are not foolproof and should be used in conjunction with other analysis methods and risk management techniques to make informed trading decisions. Traders should also be aware that Bollinger Bands may generate false signals, especially during periods of low volatility.
we will add the Bollinger Bands using the addBBands() command and the MACD trend-following momentum indicator using the add MACD() command to get more insights into the stock price evolution.
 library(Quandl)
> library(xts)
> currencies <- c( "USD", "CHF", "GBP", "JPY", "RUB", "CAD", "AUD")
> currencies <- paste("CURRFX/EUR", currencies, sep = "")
> currency_ts <- lapply(as.list(currencies), Quandl, start_date="2005-01-
+ 01",end_date="2013-06-07", type="xts")
Error in charToDate(x) :
  character string is not in a standard unambiguous format
> currency_ts <- lapply(as.list(currencies), Quandl, start_date="2005-01-
+ 01",end_date="2013-06-07", type="xts")
Error in charToDate(x) :
  character string is not in a standard unambiguous format
> Q <- cbind(
+     currency_ts[[1]]$Rate,currency_ts[[3]]$Rate,currency_
+     ts[[6]]$Rate,currency_ts[[7]]$Rate)
Error: unexpected symbol in:
"    currency_ts[[1]]$Rate,currency_ts[[3]]$Rate,currency_
    ts"
> matplot(Q, type = "l", xlab = "", ylab = "", main = "USD, GBP, CAD, AUD",
+         xaxt = 'n', yaxt = 'n')
Error in matplot(Q, type = "l", xlab = "", ylab = "", main = "USD, GBP, CAD, AUD",  :
  object 'Q' not found
> library(quantmod)
[1] "BMW.DE"
> BMW<-bmw_stock$BMW.DE
> head(BMW)
           BMW.DE.Open BMW.DE.High BMW.DE.Low
2010-01-04      31.820      32.455     31.820
2010-01-05      31.960      32.410     31.785
2010-01-06      32.450      33.040     32.360
2010-01-07      32.650      33.200     32.380
2010-01-08      33.335      33.430     32.515
2010-01-11      32.995      33.050     32.110
           BMW.DE.Close BMW.DE.Volume BMW.DE.Adjusted
2010-01-04       32.050       1808170        24.15409
2010-01-05       32.310       1564182        24.35004
2010-01-06       32.810       2218604        24.72685
2010-01-07       33.100       2026145        24.94541
2010-01-08       32.655       1925894        24.61004
2010-01-11       32.170       2157825        24.24452
> chartSeries(BMW,multi.col=TRUE,theme="white")
> addMACD()
> addBBands()
> BMW_return <-
+     log(BMW$BMW.DE.Close/BMW$BMW.DE.Open)
> qqnorm(BMW_return, main = "Normal Q-Q Plot of BMW daily log return",
+        xlab = "Theoretical Quantiles",
+        ylab = "Sample Quantiles", plot.it = TRUE, datax = FALSE
+ )
> qqline(BMW_return, col="red")
> getSymbols("BMW.DE", env = bmw_stock, src = "yahoo", from =
+                as.Date("2014-01-01"), to = as.Date("2018-12-31"))
[1] "BMW.DE"
> BMW<-bmw_stock$BMW.DE
> head(BMW)
           BMW.DE.Open BMW.DE.High BMW.DE.Low
2014-01-02       85.90       86.10      83.38
2014-01-03       83.63       84.51      83.35
2014-01-06       84.00       84.53      82.87
2014-01-07       83.10       84.01      82.41
2014-01-08       83.82       84.66      83.73
2014-01-09       84.13       85.13      83.54
           BMW.DE.Close BMW.DE.Volume BMW.DE.Adjusted
2014-01-02        83.54       1499492        69.45904
2014-01-03        83.98        826285        69.82488
2014-01-06        82.99        987242        69.00174
2014-01-07        83.55       1231698        69.46736
2014-01-08        84.45       1435898        70.21566
2014-01-09        83.86       1297442        69.72510
> chartSeries(BMW,multi.col=TRUE,theme="white")
> addMACD()
> addBBands()
Learn PYTHON

Post a Comment

4 Comments

  1. THE FX-AGENCY ADVISOR 3 THE WORLDS LEADING MULTI-FUNCTIONAL HIGH END FOREX SYSTEM FX-AGENCY ADVISOR 3
    Trade Easy ,
    Secure and
    Professional way,
    👇
    check
    FX-AGENCY ADVISOR 3 detail


    Crypto trading course
    Crypto quantum leap

    Be a professional YouTuber and start your carrier
    Tube Mastery and Monetization by matt

    ReplyDelete
  2. Harrah's Casino | New Orleans Hotel & Casino
    Harrah's Casino is w88 the hotel 메리트카지노 of choice for 바카라 배팅 법 those looking for a premier casino choegocasino.com twitter experience that 사이트 추천 is unforgettable. The casino is located just minutes

    ReplyDelete
  3. PokerStars Review 2021 - Online Casinos - ProFans
    Check out our detailed review of PokerStars, its poker 더킹카지노 sister sites and what 메리트 카지노 고객센터 all the different 메리트 카지노 쿠폰 types of games 슬롯 가입 머니 it offers to the player on the 바카라 사이트

    ReplyDelete
  4. Casino Nights 2, Blackjack, Roulette, and Slots - KTM Hub
    The casino is available to play with a 여주 출장샵 virtual ticket 안산 출장안마 for every $15 you spend on a sportsbook ticket. This means if 계룡 출장샵 you want to play 여주 출장안마 with a casino 속초 출장샵

    ReplyDelete