whittlem / pycryptobot

Python Crypto Bot (PyCryptoBot)
Apache License 2.0
1.96k stars 739 forks source link

EMA12/26 crossing not always detected #301

Closed davidtmiles closed 11 months ago

davidtmiles commented 3 years ago

It seems EMA12/26 crossing detection is not always operating. Suspicion is that the candlestick detection is interfering with the evaluation. Example where it works:

2021-06-03 16:45:00 | ETH-USD | 900 | Close: 2833.32 | v EMA12/26: 2810.27 < 2810.34 v | ^ MACD: -0.08 > -4.1 ^ | ^ OBV: 40654.179 (0.35%) ^ | ERI: sell | WAIT | Last Action: SELL
2021-06-03 16:48:02 | ETH-USD | 900 | Current Price: 2833.32
2021-06-03 16:50:04 | ETH-USD | 900 | Current Price: 2833.32
2021-06-03 16:52:04 | ETH-USD | 900 | Current Price: 2826.91
2021-06-03 16:54:06 | ETH-USD | 900 | Current Price: 2835.54
2021-06-03 16:56:07 | ETH-USD | 900 | Current Price: 2834.75
2021-06-03 16:58:08 | ETH-USD | 900 | Current Price: 2830.17
2021-06-03 17:00:08 | ETH-USD | 900 | Current Price: 2835.68
2021-06-03 17:02:11 | ETH-USD | 900 | Current Price: 2828.46
2021-06-03 17:00:00 | ETH-USD | 900 | Close: 2826.7 | *^ EMA12/26: 2812.69 > 2811.5 ^* | ^ MACD: 1.19 > -3.05 ^ | v OBV: 48334.616 (-1.08%) v | ERI: sell | WAIT | Last Action: SELL

Where it does not:

2021-06-03 21:00:00 | ETH-USD | 900 | Close: 2819.31 | v EMA12/26: 2808.76 < 2809.48 v | ^ MACD: -0.72 > -2.23 ^ | v OBV: 5240.2622 (-0.44%) v | ERI: sell | WAIT | Last Action: SELL
2021-06-03 21:02:17 | ETH-USD | 900 | Current Price: 2819.31
2021-06-03 21:04:20 | ETH-USD | 900 | Current Price: 2824.04
2021-06-03 21:06:22 | ETH-USD | 900 | Current Price: 2836.41
2021-06-03 21:08:21 | ETH-USD | 900 | Current Price: 2843.12
2021-06-03 21:10:22 | ETH-USD | 900 | Current Price: 2838.27
2021-06-03 21:12:24 | ETH-USD | 900 | Current Price: 2837.11
2021-06-03 21:14:24 | ETH-USD | 900 | Current Price: 2836.44
2021-06-03 21:16:26 | ETH-USD | 900 | Current Price: 2837.47
* Candlestick Detected: Shooting Star ("Weak - Reversal - Bearish Pattern - Down") 

* Candlestick Detected: Inverted Hammer ("Weak - Continuation - Bullish Pattern - Up") 

2021-06-03 21:15:00 | ETH-USD | 900 | Close: 2835.55 | ^ EMA12/26: 2814.95 > 2812.5 ^ | ^ MACD: 2.45 > -1.1 ^ | ^ OBV: 12378.557 (2.1%) ^ | ERI: sell | WAIT | Last Action: SELL

debug log

06/03/2021 09:00:19 PM - DEBUG: 2021-06-03 21:00:00 | ETH-USD | 900 | Close: 2819.31 | v EMA12/26: 2808.76 < 2809.48 v | ^ MACD: -0.72 > -2.23 ^ | v OBV: 5240.2622 (-0.44%) v | ERI: sell | WAIT | Last Action: SELL
06/03/2021 09:18:28 PM - DEBUG: * Candlestick Detected: Shooting Star ("Weak - Reversal - Bearish Pattern - Down")
06/03/2021 09:18:28 PM - DEBUG: * Candlestick Detected: Inverted Hammer ("Weak - Continuation - Bullish Pattern - Up")
06/03/2021 09:18:28 PM - DEBUG: 2021-06-03 21:15:00 | ETH-USD | 900 | Close: 2835.55 | ^ EMA12/26: 2814.95 > 2812.5 ^ | ^ MACD: 2.45 > -1.1 ^ | ^ OBV: 12378.557 (2.1%) ^ | ERI: sell | WAIT | Last Action: SELL
antonp01 commented 3 years ago

Same here, I have seen no action from the bot, missing good opportunities when EMA12 and 26 cross in either direction...

whittlem commented 3 years ago

@antonp01 and @davidtmiles, have you disabled the bull only option? "disablebullonly"? By default the bot won't trade in a bear market. You need to disable that check to trade now during the market crash.

davidtmiles commented 3 years ago

Yes it was (youll notice there isn't a BEAR or BULL indicator in the log, like this)

python3 pycryptobot.py --disableprofitbankupperpcnt --autorestart
2021-06-16 20:00:00 | ETH-USD (BULL) | 3600 | Close: 2406.9500 |  v EMA12/26: 2440.4262 < 2476.3695 v  | v MACD: -35.9433 < -30.1546 v | ^ OBV: -136317.2219 (4.8800%) ^ | ERI: sell | WAIT | Last Action: SELL

python3 pycryptobot.py --disableprofitbankupperpcnt --autorestart --disablebullonly
2021-06-16 20:00:00 | ETH-USD | 3600 | Close: 2407.1800 |  v EMA12/26: 2440.6293 < 2476.4673 v  | v MACD: -35.8380 < -30.1335 v | ^ OBV: -136668.3540 (5.1500%) ^ | ERI: sell | WAIT | Last Action: SELL

Also it's interesting that you don't see the ^ ^ indicators on the EMA crossing, suggesting its something with the data. I've put some debug in so that if it happens again we can get the values.

I do notice the elder ray is SELL, but that shouldn't change the crossing indicators? Also, if you have a sec - is the logic behind waiting for crossings (vs all indicators buy) to try and catch the market near the bottom?

ElNoupy commented 2 years ago

Same here, can confirm that some EMA12/EMA26 crossing are not detected. Last one I noticed was last night at BTC-GBP on CBPro, at around 20:30 UTC.

Using version v2.47.2.

davidtmiles commented 2 years ago

It would appear so

2021-08-10 12:46:59 INFO     2021-08-10 19:45:00 | ETH-USD | 900 | Close: 3138.3500 | v EMA12/26: 3121.7944 < 3122.0288 v | ^ MACD: -0.2344 > -6.1829 ^ | ^ OBV: -13231.9695 (0.9600%) ^ | ERI: sell | WAIT | Last Action: SELL
2021-08-10 12:46:59 INFO     Seasonal ARIMA model predicts the closing price will be 3137.97 at 2021-08-10 20:30:00 (delta: -0.38)
2021-08-10 12:48:01 INFO     2021-08-10 19:47:59 | ETH-USD | 900 | Current Price: 3136.55
2021-08-10 12:49:03 INFO     2021-08-10 19:49:01 | ETH-USD | 900 | Current Price: 3137.0
2021-08-10 12:50:05 INFO     2021-08-10 19:50:03 | ETH-USD | 900 | Current Price: 3137.0
2021-08-10 12:51:08 INFO     2021-08-10 19:51:07 | ETH-USD | 900 | Current Price: 3139.6
2021-08-10 12:52:10 INFO     2021-08-10 19:52:09 | ETH-USD | 900 | Current Price: 3141.54
2021-08-10 12:53:13 INFO     2021-08-10 19:53:12 | ETH-USD | 900 | Current Price: 3142.98
2021-08-10 12:54:15 INFO     2021-08-10 19:54:15 | ETH-USD | 900 | Current Price: 3141.08
2021-08-10 12:55:17 INFO     2021-08-10 19:55:16 | ETH-USD | 900 | Current Price: 3138.96
2021-08-10 12:56:19 INFO     2021-08-10 19:56:18 | ETH-USD | 900 | Current Price: 3144.69
2021-08-10 12:57:22 INFO     2021-08-10 19:57:21 | ETH-USD | 900 | Current Price: 3146.4
2021-08-10 12:58:24 INFO     2021-08-10 19:58:22 | ETH-USD | 900 | Current Price: 3145.32
2021-08-10 12:59:26 INFO     2021-08-10 19:59:25 | ETH-USD | 900 | Current Price: 3141.15
2021-08-10 13:00:28 INFO     2021-08-10 20:00:26 | ETH-USD | 900 | Current Price: 3146.38
2021-08-10 13:01:31 INFO     * Candlestick Detected: Inverted Hammer ("Weak - Continuation - Bullish Pattern - Up")
2021-08-10 13:01:31 INFO     2021-08-10 20:00:00 | ETH-USD | 900 | Close: 3148.0000 | ^ EMA12/26: 3126.4533 > 3124.2996 ^ | ^ MACD: 2.1537 > -4.4184 ^ | v OBV: -2771.1370 (-9.9300%) v | ERI: buy | WAIT | Last Action: SELL
2021-08-10 13:01:31 INFO     Seasonal ARIMA model predicts the closing price will be 3141.62 at 2021-08-10 20:45:00 (delta: -6.38)

working ex:

2021-08-09 16:02:35 INFO     2021-08-09 23:00:00 | ETH-USD | 900 | Close: 3147.6000 | v EMA12/26: 3121.3667 < 3123.0760 v | ^ MACD: -1.7094 > -4.3578 ^ | ^ OBV: 2682.4575 (10.7500%) ^ | ERI: sell | WAIT | Last Action: SELL
2021-08-09 16:18:08 INFO     2021-08-09 23:15:00 | ETH-USD | 900 | Close: 3174.3500 | *^ EMA12/26: 3131.9608 > 3128.1564 ^* | ^ MACD: 3.8044 > -2.4962 ^ | v OBV: -1904.5746 (-38.3800%) v | ERI: buy | WAIT | Last Action: SELL

others:

2021-08-10 00:48:41 INFO     2021-08-10 07:45:00 | ETH-USD | 900 | Close: 3128.2500 | v EMA12/26: 3120.2945 < 3121.1514 v | ^ MACD: -0.8569 > -2.5906 ^ | ^ OBV: -26445.9534 (1.3300%) ^ | ERI: sell | WAIT | Last Action: SELL
2021-08-10 01:04:13 INFO     2021-08-10 08:00:00 | ETH-USD | 900 | Close: 3144.0600 | ^ EMA12/26: 3125.8586 > 3123.8629 ^ | ^ MACD: 1.9957 > -1.4660 ^ | ^ OBV: -26048.4228 (0.9800%) ^ | ERI: sell | WAIT | Last Action: SELL

2021-08-10 08:18:36 INFO     2021-08-10 15:15:00 | ETH-USD | 900 | Close: 3140.0600 | ^ EMA12/26: 3150.4546 > 3148.4728 ^ | v MACD: 1.9817 < 5.8000 v | ^ OBV: -38278.5629 (1.2200%) ^ | ERI: buy | WAIT | Last Action: SELL 
2021-08-10 08:34:11 INFO     2021-08-10 15:30:00 | ETH-USD | 900 | Close: 3108.5100 | v EMA12/26: 3139.8457 < 3143.3642 v | v MACD: -3.5186 < 3.6179 v | ^ OBV: -38782.6159 (10.3300%) ^ | ERI: sell | WAIT | Last Action: SELL

2021-08-09 04:02:51 INFO     2021-08-09 11:00:00 | ETH-USD | 3600 | Close: 3105.6000 | v EMA12/26: 3012.4514 < 3014.3487 v | ^ MACD: -1.8973 > -19.9919 ^ | ^ OBV: 403557.3161 (0.2500%) ^ | ERI: sell | WAIT | Last Action: SELL
2021-08-09 04:24:41 INFO     2021-08-09 11:15:00 | ETH-USD | 900 | Close: 3135.8200 | ^ EMA12/26: 3061.5503 > 3016.9525 ^ | ^ MACD: 44.5977 > 27.9681 ^ | v OBV: 37762.7562 (-2.9901%) v | ERI: sell | WAIT | Last Action: SELL

FWIW, I cannot see an example of where all conditions were satisfied (eg, SELL or BUY).