RSI<35 jako buysignal,vypnuta slopeProtect na buy

This commit is contained in:
David Brazda
2023-06-01 17:57:32 +02:00
parent 2f68667f08
commit 80e264eeaa
5 changed files with 10 additions and 6 deletions

View File

@ -407,7 +407,7 @@ def next(data, state: StrategyState):
dont_buy_when['last_buy_offset_too_soon'] = data['index'] < (state.vars.last_buysignal_index + safe_get(state.vars, "lastbuy_offset",3))
dont_buy_when['blockbuy_active'] = (state.vars.blockbuy == 1)
dont_buy_when['jevylozeno_active'] = (state.vars.jevylozeno == 1)
dont_buy_when['buy_protection_enabled'] = buy_protection_enabled()
#dont_buy_when['buy_protection_enabled'] = buy_protection_enabled()
dont_buy_when['open_rush'] = is_open_rush(datetime.fromtimestamp(data['updated']).astimezone(zoneNY), safe_get(state.vars, "open_rush",0))
dont_buy_when['close_rush'] = is_close_rush(datetime.fromtimestamp(data['updated']).astimezone(zoneNY), safe_get(state.vars, "close_rush",0))
dont_buy_when['rsi_is_zero'] = (state.indicators.RSI14[-1] == 0)
@ -429,14 +429,18 @@ def next(data, state: StrategyState):
#slopeMA jde dolu, rsi jde nahoru
#buy mame kazdy potvrzeny, tzn. rsi falling muze byt jen 2
buy_cond['AND']['slopeMA_falling'] = isfalling(state.indicators.slopeMA,3)
buy_cond['AND']['rsi_is_rising'] = isrising(state.indicators.RSI14,2)
buy_cond["AND"]["rsi_buy_signal_below"] = state.indicators.RSI14[-1] < safe_get(state.vars, "rsi_buy_signal_below",40)
#buy_cond['AND']['slopeMA_falling'] = isfalling(state.indicators.slopeMA,3)
#buy_cond['AND']['rsi_is_rising'] = isrising(state.indicators.RSI14,2)
#buy_cond["AND"]["rsi_buy_signal_below"] = state.indicators.RSI14[-1] < safe_get(state.vars, "rsi_buy_signal_below",40)
#puvodni buy conditiony
#buy_cond["AND"]["rsi_buy_signal_below"] = state.indicators.RSI14[-1] < safe_get(state.vars, "rsi_buy_signal_below",40)
#buy_cond["AND"]["ema_trend_is_falling"] = isfalling(state.indicators.ema,state.vars.Trend)
#pouze RSI pod 35 a zadny jiny
buy_cond["AND"]["rsi_buy_signal_below"] = state.indicators.RSI14[-1] < safe_get(state.vars, "rsi_buy_signal_below",40)
result, conditions_met = eval_cond_dict(buy_cond)
if result:
state.ilog(e=f"BUY SIGNAL {conditions_met}")

View File

@ -6,7 +6,7 @@ from appdirs import user_data_dir
NORMALIZED_TICK_BASE_PRICE = 30.00
LOG_RUNNER_EVENTS = False
#no print in console
QUIET_MODE = False
QUIET_MODE = True
#how many consecutive trades with the fill price are necessary for LIMIT fill to happen in backtesting
#0 - optimistic, every knot high will fill the order
#N - N consecutive trades required

View File

@ -419,10 +419,10 @@ class Strategy:
else:
rt_out["trades"] = item
rt_out["indicators"] = dict()
#get only last values from indicators, if there are any indicators present
#standardni indikatory plnime jen na confirmed bar pro real time
if len(self.state.indicators) > 0 and item['confirmed'] == 1:
rt_out["indicators"] = dict()
for key, value in self.state.indicators.items():
#odchyceny pripad, kdy indikatory jsou inicializovane, ale jeste v nich nejsou data, pak do WS nic neposilame
try: