diff --git a/v2realbot/controller/services.py b/v2realbot/controller/services.py index 25b1fe6..28eca88 100644 --- a/v2realbot/controller/services.py +++ b/v2realbot/controller/services.py @@ -1650,13 +1650,14 @@ def preview_indicator_byTOML(id: UUID, indicator: InstantIndicator, save: bool = new_inds = AttributeDict(**new_inds) new_tick_inds = {key: [] for key in detail.indicators[1].keys()} new_tick_inds = AttributeDict(**new_tick_inds) - interface = BacktestInterface(symbol="X", bt=None) + def_account = Account("ACCOUNT1") + interface = BacktestInterface(symbol="X", bt=None, account=def_account) ##dame nastaveni indikatoru do tvaru, ktery stratvars ocekava (pro dynmaicke inicializace) stratvars = AttributeDict(indicators=AttributeDict(**{jmeno:toml_parsed})) #print("stratvars", stratvars) - state = StrategyState(name="XX", symbol = "X", stratvars = AttributeDict(**stratvars), interface=interface) + state = StrategyState(name="XX", symbol = "X", stratvars = AttributeDict(**stratvars), interface=interface, accounts=[def_account], account=def_account) #inicializujeme stavove promenne a novy indikator v cilovem dict if output == "bar": diff --git a/v2realbot/strategyblocks/activetrade/close/evaluate_close.py b/v2realbot/strategyblocks/activetrade/close/evaluate_close.py index 788b18b..fd901d2 100644 --- a/v2realbot/strategyblocks/activetrade/close/evaluate_close.py +++ b/v2realbot/strategyblocks/activetrade/close/evaluate_close.py @@ -58,7 +58,7 @@ def eval_close_position(state: StrategyState, accountsWithActiveTrade, data): if curr_price > activeTrade.stoploss_value: directive_name = 'reverse_for_SL_exit_short' - reverse_for_SL_exit = get_signal_section_directive(state=state, activeTrade=activeTrade, directive_name=directive_name, default_value=safe_get(state.vars, directive_name, "no")) + reverse_for_SL_exit = get_signal_section_directive(state=state, signal_name=activeTrade.generated_by, directive_name=directive_name, default_value=safe_get(state.vars, directive_name, "no")) if reverse_for_SL_exit == "always": followup_action = Followup.REVERSE