Username: Password:

Author Topic: Bollinger Bands: Either the math doesn't add up or I'm just a noob  (Read 27926 times)

Offline BBConfusion

  • Rookie
  • *
  • Posts: 3
    • View Profile
So. I decided to go with BB on a sideways market and have set my high and low BBs to 35%. Let's say that the pricepoint at the low BB is 1, shouldn't the bot buy at 1.35?

When I check the logs, the bot wants to buy at 1.0302 (3.02%). Why is that?

Offline heromrk18

  • Rookie
  • *
  • Posts: 7
    • View Profile
Re: Bollinger Bands: Either the math doesn't add up or I'm just a noob
« Reply #1 on: January 07, 2018, 07:46:20 PM »
at least you bot does something... oh and you wont find much help here... looking into a telegram group instead

Offline BBConfusion

  • Rookie
  • *
  • Posts: 3
    • View Profile
Re: Bollinger Bands: Either the math doesn't add up or I'm just a noob
« Reply #2 on: January 07, 2018, 07:56:32 PM »
at least you bot does something... oh and you wont find much help here... looking into a telegram group instead

telegram is only 3-5 people talking about how awesome their bot is and 100 other people being ignored!

Offline Tangy

  • Rookie
  • *
  • Posts: 5
    • View Profile
Re: Bollinger Bands: Either the math doesn't add up or I'm just a noob
« Reply #3 on: January 07, 2018, 09:50:54 PM »
at least you bot does something... oh and you wont find much help here... looking into a telegram group instead

telegram is only 3-5 people talking about how awesome their bot is and 100 other people being ignored!

The Telegram group isn't your free tech support group. Ask your question and wait for an answer. If it doesn't get answered within an hour, ask again.

Offline sloaleks

  • Contributor
  • **
  • Posts: 610
    • View Profile
Re: Bollinger Bands: Either the math doesn't add up or I'm just a noob
« Reply #4 on: January 08, 2018, 09:58:11 AM »
So. I decided to go with BB on a sideways market and have set my high and low BBs to 35%. Let's say that the pricepoint at the low BB is 1, shouldn't the bot buy at 1.35?

When I check the logs, the bot wants to buy at 1.0302 (3.02%). Why is that?

no. it all depends at where your low bb is, where the sma is and where the high bb is. you need to check this on the charts, pay attention to have the same period on your chart calculation and on your bot strategy.
your calculation would be right only when (value @high bb is 2) - (value @low bb is 1) = "thickness" of bb is exactely 1, only then price @low bb 35 =1.35
the calculation of Bollinger bands is not a percentage calculation. it involves a simple moving average over a certain period, combined with standard deviations addition and subtraction from that sma. standard deviation on its own is a calculation of volatility.

some bb pointers to consider:
low bb 50 = sma = high bb 50
low bb 0 = high bb 100
low bb 100 = high bb 0

keep in mind, the price need not be inside the Bollinger bands, it can wander either under or over them. you can use this fact to your advantage.
« Last Edit: January 08, 2018, 10:11:26 AM by sloaleks »

Offline sloaleks

  • Contributor
  • **
  • Posts: 610
    • View Profile
Re: Bollinger Bands: Either the math doesn't add up or I'm just a noob
« Reply #5 on: January 08, 2018, 10:14:21 AM »
So. I decided to go with BB on a sideways market and have set my high and low BBs to 35%. Let's say that the pricepoint at the low BB is 1, shouldn't the bot buy at 1.35?

When I check the logs, the bot wants to buy at 1.0302 (3.02%). Why is that?

no. it all depends at where your low bb is, where the sma is and where the high bb is. you need to check this on the charts, pay attention to have the same period on your chart calculation and on your bot strategy.
your calculation would be right only when:
(value @high bb is 2) - (value @low bb is 1) = "thickness" of bb is exactely 1, only then price @low bb 35 =1.35

the calculation of Bollinger bands is not a percentage calculation. it involves a simple moving average over a certain period, combined with standard deviations addition and subtraction from that sma. standard deviation on its own is a calculation of volatility.

some bb pointers to consider:
low bb 50 = sma = high bb 50
low bb 0 = high bb 100
low bb 100 = high bb 0

keep in mind, the price need not be inside the Bollinger bands, it can wander either under or over them. you can use this fact to your advantage.

Offline srfnmnk

  • Rookie
  • *
  • Posts: 8
    • View Profile
Re: Bollinger Bands: Either the math doesn't add up or I'm just a noob
« Reply #6 on: January 10, 2018, 09:44:50 PM »

some bb pointers to consider:
low bb 50 = sma = high bb 50
low bb 0 = high bb 100
low bb 100 = high bb 0

keep in mind, the price need not be inside the Bollinger bands, it can wander either under or over them. you can use this fact to your advantage.

Great explanation sloaleks, thanks for taking the time to help out us noobs. You bring up a point I don't fully undersatnd in the last part there; you say that the price does not need to be inside the bands, I realize this but when is it that the bot decides to make a decision to buy/sell? Immediately when the price is achieved OR when a candlestick closes with the top/bottom in your range OR maybe when the following candlestick closes with a reverse direction...? What is the deciding factor for the bot?

One more thing is with regard to periods vs SMAPERIOD candlestick number. If SMAPERIOD = 50 I shift the PERIOD to 5 does that mean the SMA is calculated over the past 5*50 = 500 candlesticks? If so, to visualize the chart that the bot is using must I create a BB indicator on a chart with the "length" set to the SMAPERIOD and the candlestick period = PERIOD? Is that right?

Thanks again.

Offline sloaleks

  • Contributor
  • **
  • Posts: 610
    • View Profile
Re: Bollinger Bands: Either the math doesn't add up or I'm just a noob
« Reply #7 on: January 11, 2018, 06:28:37 AM »
Great explanation sloaleks, thanks for taking the time to help out us noobs. You bring up a point I don't fully undersatnd in the last part there; you say that the price does not need to be inside the bands, I realize this but when is it that the bot decides to make a decision to buy/sell? Immediately when the price is achieved OR when a candlestick closes with the top/bottom in your range OR maybe when the following candlestick closes with a reverse direction...? What is the deciding factor for the bot?

One more thing is with regard to periods vs SMAPERIOD candlestick number. If SMAPERIOD = 50 I shift the PERIOD to 5 does that mean the SMA is calculated over the past 5*50 = 500 candlesticks? If so, to visualize the chart that the bot is using must I create a BB indicator on a chart with the "length" set to the SMAPERIOD and the candlestick period = PERIOD? Is that right?

Thanks again.
I'm not very sure when exactely the buy or sell cycle starts, because I'm not able to exactely reproduce the market bbs on my bots decisions. Let's say, it goes into buy or sell cycles in the immediate vicinity of the set low and high bb. The deciding factor should be the breach of the set low and high value, but I'm also aware, the price don't just stop there. So, I'm farely confident the bot buys really really close to what it is set. On selling, not so sure. I have had moments, when the sell was performed under the minimum gain, which shouldn't have happened, and I have had it "loose" several peaks, when the price clearly went over the set high bb (and I have then sold manually, because the trend reversed already). But in general it works very close to what it is set (talking pure bb here).
Yes, the change in your period affects you SMA calculation. If set like you wrote, your SMA is calculated over 50 candlesticks of 5 minutes each, so over 250 minutes.
And yes again, to exactely visualize the charts, you should have set the same periods on the chart and on the bot. To replicate bbs you also should have the same SMA, so set the same on your bot and on your exchange the SMAPERIOD.

Offline srfnmnk

  • Rookie
  • *
  • Posts: 8
    • View Profile
Re: Bollinger Bands: Either the math doesn't add up or I'm just a noob
« Reply #8 on: January 12, 2018, 04:45:00 PM »
Gotcha, thanks again sloaleks, this is super helpful; hopefully some other folks can something out of this convo too.

I have made a lot of progress on my understanding of how the bot works now. I agree with you that the bot seems a little dumb in it ability to determine candlestick trends. I'd love to see it initiate sell cycle after HIGH_BB is passed but then wait for an inflection point in the up-trend, not just sell because it hit that level; same on down-side buys too obviously.

I've been playing around a lot with the Buy Down strategies and replaying them to see what would have happened and how expensive it would have gotten for various coins. I think I finally found a scenario that makes sense for me...but here's a question.

On second buy-down cycle when the new average price is breached by the HIGHBB, does the bot buy immediately at that point (when the HIGHBB falls below the new average price) or does it then enter the buy cycle and wait for the price to dip below LOW_BB?

Thanks again.

Offline sloaleks

  • Contributor
  • **
  • Posts: 610
    • View Profile
Re: Bollinger Bands: Either the math doesn't add up or I'm just a noob
« Reply #9 on: January 12, 2018, 07:54:43 PM »
Sorry, can't help with that. I have DOUBLE UP disabled. So, you will need to test this on your own. I have been told, the bot can get pretty quickly over your remaining capital if you're not extra careful with this function.