TL;DR:
- For standard charts, BB usually defaults to SMA20, so if your coin likes 15-min candles, use SMAPERIOD = 720. If you like 5-min candles, use SMAPERIOD=240.
- For Sjakil's GUI charts, BB is SMA10, so if your coin likes 15-min candles, use SMAPERIOD = 360. If you like 5-min candles, use SMAPERIOD=120.
---------
Historically, users have been frustrated with the BB values shown in the Gunbot log, or, more often, looking at a chart and being frustrated that Gunbot has apparently executed a Buy Order that does not appear to correspond to the specified configuration.
This is because Gunbot is not able to get SMA or BB data from the exchange API - it is not there. These must be calculated locally.
Gunbot, as of v5.0.1, exposes more parameters than ever before for user adjustment. In order for Gunbot to use the same Bollinger Bands that you are looking at on your charts (e.g. TradingView or others), you must have the SMAPERIOD (only present in strategies that use BB to either buy or sell) set accordingly.
Here is how it works:
A standard Bollinger Band is calculated as follows, by both Gunbot and any traditional charting software:
* Middle Band = 20-day simple moving average (SMA)
* Upper Band = 20-day SMA + (20-day standard deviation of price x 2)
* Lower Band = 20-day SMA - (20-day standard deviation of price x 2)
Now in both GUNBOT v5 (and in most charting software), you can customize the SMA period as well as the standard deviation value.
Our challenge has been setting the correct SMAPERIOD for GUNBOT to match the charting software. In GUNBOT, SMAPERIOD is NOT days or candles, so a value of 20 in your charting software represents CANDLES and is not the same as 20 in Gunbot. The question ends up being: How many price collections occur in the same period as the chart is using?
SMAPERIOD = NUMBER OF TICKER COLLECTIONS TO USE IN SMA CALCULATION
SMAPERIOD = (# of Chart candles for SMA)*(Chart Candle Value)*60/(interval_ticker_update/1000)
So if we want to use a 20-period BB (that means 20-period SMA), while looking at a 15 minute candle chart, the equation looks like this:
SMAPERIOD = 20*15*60/25 = 720
Try it:
- 20-period BB indicator
- 15-min candle chart
- 60 seconds in one minute
- 25000 is the default interval_ticker_update, so divided by 1000 = 25
As if by magic, now our Gunbot BB values will match the chart!
Additionally, for those of you using Sjakil's GUI, the GUI Bollinger Bands are 20-period SMA bands. So please keep that in mind if you use an SMAPERIOD other than 720. Sjakil is looking to support config-based BB drawing in future releases, but until then...
Of course, if you found this helpful, I accept tips: 17vaWPJeDN7YXfRu6TRrwUDY8ETTPtJuCu