As I commented in the strategy channel in Discord, I have a problem trying to sell in the current candle, probably I am doing something wrong.
I am trying to sell at current candle when price is below EMA_50_4h but cannot get it to work. It is selling in next candle (day 31).
I would like it sell the same day 30, in the same current candle, when the price crosses and goes below EMA50_4h value.
Import BitFinex candles since 2019
jesse import-candles Bitfinex BTC-USD 2019-01-01
routes = [
('Bitfinex', 'BTC-USD', '4h', 'ExampleStrategy'),
- I have uploaded the full strategy code here
Full debug here
Debug with the problem for those two days 30-31
Time 2019-05-30 14:00:00: We have a buy, ema_value_50_4h = 8396.880766830884, price = 8964.2, position = 553.1288094270626
==== BTC-USD | 2019-05-30T16:00 | 8964.2 | 8610.91 | 9109.0 | 8530.5 | 6482.45
Time 2019-05-30 18:00:00: We have a buy, ema_value_50_4h = 8405.274070092417, price = 8610.91, position = 373.68447785453054
==== BTC-USD | 2019-05-30T20:00 | 8610.91 | 8270.0 | 8611.0 | 8005.0 | 7952.95
Time 2019-05-30 22:00:00: We have a buy, ema_value_50_4h =8399.969204598596, price = 8270.0, position = 200.5282405526209
[2019-05-31T00:00:00+00:00]: SUBMITTED order: BTC-USD, MARKET, sell, -0.5079236082893133, $8270.0
[2019-05-31T00:00:00+00:00]: EXECUTED order: BTC-USD, MARKET, sell, -0.5079236082893133, $8270.0
Thanks in advance 🙂