Username: Password:

Author Topic: GUNBOT v5: Setting up your BB strategy to match CHARTS  (Read 68515 times)

Offline Culture

  • Rookie
  • *
  • Posts: 40
    • View Profile
GUNBOT v5: Setting up your BB strategy to match CHARTS
« on: September 20, 2017, 08:28:43 PM »
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
« Last Edit: September 21, 2017, 01:59:07 PM by Culture »
If you find my discussion useful, buy me a drink: 17vaWPJeDN7YXfRu6TRrwUDY8ETTPtJuCu

Offline paramecie

  • Contributor
  • **
  • Posts: 302
    • View Profile
Re: GUNBOT v5: Setting up your BB strategy to match CHARTS
« Reply #1 on: September 20, 2017, 08:46:18 PM »
Waw! Interesting! I'll check this!

I've found that, but it requires tradingview:
https://www.tradingview.com/script/OZeGGswT-Bollinger-Bands-Explorer/
« Last Edit: September 20, 2017, 11:31:16 PM by paramecie »

Offline paramecie

  • Contributor
  • **
  • Posts: 302
    • View Profile
Re: GUNBOT v5: Setting up your BB strategy to match CHARTS
« Reply #2 on: September 20, 2017, 11:33:46 PM »
Ah but it's only concerning 5.x, as SMA can't be set up in 3.x version AFAIK?
Too bad because I recently gave up 5.0.4 because of abnormal buying prices (see gtihub), which will be solved on 5.0.5

Question, do you have a way to, at the contrary, make the marketplace match gunbot BB?
Like changing the settings in Bittrex BB to match gunbot?

Offline Culture

  • Rookie
  • *
  • Posts: 40
    • View Profile
Re: GUNBOT v5: Setting up your BB strategy to match CHARTS
« Reply #3 on: September 20, 2017, 11:53:59 PM »
Ah but it's only concerning 5.x, as SMA can't be set up in 3.x version AFAIK?
Too bad because I recently gave up 5.0.4 because of abnormal buying prices (see gtihub), which will be solved on 5.0.5

Question, do you have a way to, at the contrary, make the marketplace match gunbot BB?
Like changing the settings in Bittrex BB to match gunbot?

Yes and no.  Gunbot settings are FAR more configurable than your typical charting interface, so it's not always possible.   That said, some things can be done, but I'm not so confident to speak to 3.x versions at the moment...
If you find my discussion useful, buy me a drink: 17vaWPJeDN7YXfRu6TRrwUDY8ETTPtJuCu

Offline ntsili

  • Rookie
  • *
  • Posts: 27
    • View Profile
Re: GUNBOT v5: Setting up your BB strategy to match CHARTS
« Reply #4 on: September 20, 2017, 11:56:23 PM »
Excellent post!
What happens if we have a lot of pairs running in the same time in Sjakil's GUI ?? Should the number of pairs influence the "(interval_ticker_update/1000)" part of the equation??
If I have 10 pairs running in the same time should 720 became 72?

Offline paramecie

  • Contributor
  • **
  • Posts: 302
    • View Profile
Re: GUNBOT v5: Setting up your BB strategy to match CHARTS
« Reply #5 on: September 21, 2017, 12:02:13 AM »
What happens if we have a lot of pairs running in the same time in Sjakil's GUI ??

If I understand well.
For now, gunbot has its own BB calculation, Sjakil's also (and different), and the marketplace also (and different of one or both).
This above trick is to make GB have the same curves than the marketplace, that's all.

It doesn't change in Sjakil's, it'll be probably different... (until his new version)

Offline ntsili

  • Rookie
  • *
  • Posts: 27
    • View Profile
Re: GUNBOT v5: Setting up your BB strategy to match CHARTS
« Reply #6 on: September 21, 2017, 12:06:02 AM »
Forget Sjakil's GUI!  ;)
If there are a lot of instances of coins running, does this influences the way gunbot "creates" the BBs of each coin?

Offline Debugger

  • Rookie
  • *
  • Posts: 1
    • View Profile
Re: GUNBOT v5: Setting up your BB strategy to match CHARTS
« Reply #7 on: September 21, 2017, 01:46:38 AM »
Kinda weird im sure Gunthar told me sma was based on candel close and not ticks. Im quite confused now.

Offline Culture

  • Rookie
  • *
  • Posts: 40
    • View Profile
Re: GUNBOT v5: Setting up your BB strategy to match CHARTS
« Reply #8 on: September 21, 2017, 01:57:17 AM »
He explained it a little while back on Telegram, not fully laid out, so it took me a while to process it. He did directly state that the SMA is built from an array of prices, and "if you get one price every 25 seconds... You do the math."
If you find my discussion useful, buy me a drink: 17vaWPJeDN7YXfRu6TRrwUDY8ETTPtJuCu

Offline Mann_mit_Hut

  • Rookie
  • *
  • Posts: 14
    • View Profile
Re: GUNBOT v5: Setting up your BB strategy to match CHARTS
« Reply #9 on: September 21, 2017, 08:16:55 AM »
Hey Culture, thank you for this great explanation!

I'm pretty sure that it doesn't work with multiple coins. I also thought it would be the way you say here, but i have an example in this thread https://gunthy.org/index.php/topic,1338.0.html where you can see that there is something wrong - at least with multiple coins.

Offline Culture

  • Rookie
  • *
  • Posts: 40
    • View Profile
Re: GUNBOT v5: Setting up your BB strategy to match CHARTS
« Reply #10 on: September 21, 2017, 01:26:47 PM »
I'm running 44 pairs, with so far very good results. It bears to state that EMA and SMA have notably different calculations, and I'd like to get that figured out as well. In the meantime, I'm much happier with the chart match ups.

Incidentally, I did read Gunthar saying the EMA calc uses PERIOD as a base. Not there yet, myself.
If you find my discussion useful, buy me a drink: 17vaWPJeDN7YXfRu6TRrwUDY8ETTPtJuCu

Offline Culture

  • Rookie
  • *
  • Posts: 40
    • View Profile
Re: GUNBOT v5: Setting up your BB strategy to match CHARTS
« Reply #11 on: September 21, 2017, 01:56:24 PM »
It doesn't change in Sjakil's, it'll be probably different... (until his new version)

Sjakil's GUI plots BB based on SMA10, which does make a difference when comparing.  So in that case, if you really want your Gunbot to see the same chart as Sjakil's GUI, set SMAPERIOD = 360.  But remember that you're changing the way Gunbot sees the world.  Just make sure that makes sense for your trading!
If you find my discussion useful, buy me a drink: 17vaWPJeDN7YXfRu6TRrwUDY8ETTPtJuCu

Offline davidgs

  • Rookie
  • *
  • Posts: 4
    • View Profile
Re: GUNBOT v5: Setting up your BB strategy to match CHARTS
« Reply #12 on: September 21, 2017, 03:19:45 PM »
Wow, this post is really helpful! Thanks!!!!

Offline Mann_mit_Hut

  • Rookie
  • *
  • Posts: 14
    • View Profile
Re: GUNBOT v5: Setting up your BB strategy to match CHARTS
« Reply #13 on: September 21, 2017, 06:35:22 PM »
If you figure out what the difference between SMA und EMA calculation is, please let us know here!  ;D
I'm very keen on understanding what happens, because i gave the bot my money, so i have to trust it ;)

Trying your BB settings now, the bot should need hours (exactly 4 with SMA720) to give the right results. Gogogo!

Offline Mann_mit_Hut

  • Rookie
  • *
  • Posts: 14
    • View Profile
Re: GUNBOT v5: Setting up your BB strategy to match CHARTS
« Reply #14 on: September 21, 2017, 09:14:09 PM »
3.5h of running the bot, it tells me that ETH SMA is at 0.7064. If i take a look at the charts that is impossible, should be around 0.716.
Something is truly wrong with this version... Im stopping the bot now until there is a new version out there  :-\

Offline davidgs

  • Rookie
  • *
  • Posts: 4
    • View Profile
Re: GUNBOT v5: Setting up your BB strategy to match CHARTS
« Reply #15 on: September 22, 2017, 02:05:31 PM »
I'm following this formula, used an SMAPERIOD=600 for "bb" strategy with Low BB at 5%, (for a 50 SMA and 5 min period in Bittrex) but still the bot bought above the Middle band instead of way below. Do I need to also tweak EMA1 and EMA2?

Offline Culture

  • Rookie
  • *
  • Posts: 40
    • View Profile
Re: GUNBOT v5: Setting up your BB strategy to match CHARTS
« Reply #16 on: September 22, 2017, 03:38:03 PM »
I'm following this formula, used an SMAPERIOD=600 for "bb" strategy with Low BB at 5%, (for a 50 SMA and 5 min period in Bittrex) but still the bot bought above the Middle band instead of way below. Do I need to also tweak EMA1 and EMA2?

confirm that your Bot_delay = 1

If you're using pure BB strategy, your EMA values should not make any difference (only with the gain and stepgain families).  We're seeing this type of behavior with some bots out there (see Mann_mit_Hut's posts here)... not sure precisely why, though the thought is that the bot is not collecting tickers in a consistent time, messing up the SMA calculation for some people.

Also check other charts, just to make sure that your Bittrex chart is consistent.  I realize that sounds wrong to even imply, but we're all collecting data here...
If you find my discussion useful, buy me a drink: 17vaWPJeDN7YXfRu6TRrwUDY8ETTPtJuCu

Offline XferSX

  • Rookie
  • *
  • Posts: 4
    • View Profile
Re: GUNBOT v5: Setting up your BB strategy to match CHARTS
« Reply #17 on: September 22, 2017, 04:08:58 PM »
Thanks for your efforts Culture, but still way out my end too. Plus just noticed double buys happening .....again.

Offline Mann_mit_Hut

  • Rookie
  • *
  • Posts: 14
    • View Profile
Re: GUNBOT v5: Setting up your BB strategy to match CHARTS
« Reply #18 on: September 22, 2017, 04:47:12 PM »
Since yours is correct Culture, how is you bot behaving on collecting prices?
I have 10 pairs and they are randomly updating. Sometimes a pair updates 2 times in a row and some pairs i see missing for some minutes (staring at the screen like an ape :D).
Is yours behaving differently?

Offline paramecie

  • Contributor
  • **
  • Posts: 302
    • View Profile
Re: GUNBOT v5: Setting up your BB strategy to match CHARTS
« Reply #19 on: September 22, 2017, 06:08:10 PM »
Since yours is correct Culture, how is you bot behaving on collecting prices?
I have 10 pairs and they are randomly updating. Sometimes a pair updates 2 times in a row and some pairs i see missing for some minutes (staring at the screen like an ape :D).
Is yours behaving differently?

https://github.com/GuntharDeNiro/BTCT/issues/115