From 2f68667f080bc6b578b58d8e63ccf8960e63ce02 Mon Sep 17 00:00:00 2001 From: David Brazda Date: Thu, 1 Jun 2023 17:10:20 +0200 Subject: [PATCH] po testu na paper,super nastaveni mysellu surfwave --- v2realbot/ENTRY_Vykladaci_RSI_MYSELL.py | 23 ++++++++++++------- v2realbot/__pycache__/config.cpython-310.pyc | Bin 2847 -> 2847 bytes v2realbot/config.py | 2 +- v2realbot/strategy/base.py | 6 +++-- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/v2realbot/ENTRY_Vykladaci_RSI_MYSELL.py b/v2realbot/ENTRY_Vykladaci_RSI_MYSELL.py index 10ca9ef..d508ff7 100644 --- a/v2realbot/ENTRY_Vykladaci_RSI_MYSELL.py +++ b/v2realbot/ENTRY_Vykladaci_RSI_MYSELL.py @@ -323,9 +323,7 @@ def next(data, state: StrategyState): def populate_rsi_indicator(): #RSI14 INDICATOR try: - rsi_buy_signal = False - rsi_dont_buy = False - rsi_length = 14 + rsi_length = int(safe_get(state.vars, "rsi_length",14)) source = state.bars.close #[-rsi_length:] #state.bars.vwap rsi_res = rsi(source, rsi_length) rsi_value = trunc(rsi_res[-1],3) @@ -374,7 +372,7 @@ def next(data, state: StrategyState): def buy_protection_enabled(): dont_buy_when = dict(AND=dict(), OR=dict()) ##add conditions here - dont_buy_when['rsi_dont_buy'] = state.indicators.RSI14[-1] > safe_get(state.vars, "rsi_dont_buy_above",50) + dont_buy_when['rsi_too_high'] = state.indicators.RSI14[-1] > safe_get(state.vars, "rsi_dont_buy_above",50) dont_buy_when['slope_too_low'] = slope_too_low() result, cond_met = eval_cond_dict(dont_buy_when) @@ -386,12 +384,13 @@ def next(data, state: StrategyState): dont_sell_when = dict(AND=dict(), OR=dict()) ##add conditions here - #IDENTIFIKOVAT MOMENTUM - pokud je momentum, tak prodávat později + #IDENTIFIKOVAce rustoveho MOMENTA - pokud je momentum, tak prodávat později #pokud je slope too high, pak prodavame jakmile slopeMA zacne klesat, napr. 4MA (TODO 3) - dont_sell_when['slope_too_high'] = slope_too_high() and not isfalling(state.indicators.slopeMA,4) - dont_sell_when['slopeMA_rising'] = isrising(state.indicators.slopeMA,2) + #toto docasne pryc dont_sell_when['slope_too_high'] = slope_too_high() and not isfalling(state.indicators.slopeMA,4) + dont_sell_when['AND']['slopeMA_rising'] = isrising(state.indicators.slopeMA,2) + dont_sell_when['AND']['rsi_not_falling'] = not isfalling(state.indicators.RSI14,3) #dont_sell_when['rsi_dont_buy'] = state.indicators.RSI14[-1] > safe_get(state.vars, "rsi_dont_buy_above",50) result, conditions_met = eval_cond_dict(dont_sell_when) @@ -427,8 +426,16 @@ def next(data, state: StrategyState): #no cond group - takes first #TEST BUY SIGNALu z cbartick_price - 3klesave za sebou #buy_cond['tick_price_falling_trend'] = isfalling(state.cbar_indicators.tick_price,state.vars.Trend) + + #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"]["ema_trend_is_falling"] = isfalling(state.indicators.ema,state.vars.Trend) + + #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) result, conditions_met = eval_cond_dict(buy_cond) if result: diff --git a/v2realbot/__pycache__/config.cpython-310.pyc b/v2realbot/__pycache__/config.cpython-310.pyc index 8771c3690f366365277fdad0f66e9d718384301f..9be4c78c1d9839d50837ff059ebd0374b4c4e829 100644 GIT binary patch delta 195 zcmW-aOAf(M07c)URa&q0?MJEqTEtu=uIYUwCZ=WvY=8|kF|mM7t-~^`!AtMpBY{Uy=X4jVU#PD88&U3zyx?^Z$A zSd+?_GS;K7s|>Vtu-IbzZlTW(LUs|chnRgN3^8DYRLj#4BgV*>WEh(~F?Z84&p5!G VDHf(K89gP6z5Lm7Q>>kD^$!m$E(!nu delta 195 zcmW-aI}U 0: + #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 @@ -429,7 +430,8 @@ class Strategy: #zatim takto odchycene identifikatory, ktere nemaji list, ale dict - do budoucna predelat na samostatny typ "indicators_static" except IndexError: pass - #populate cbar indicators + + #populate cbar indicators, plnime pokazde if len(self.state.cbar_indicators) > 0: for key, value in self.state.cbar_indicators.items(): try: