changes
This commit is contained in:
@ -1650,13 +1650,14 @@ def preview_indicator_byTOML(id: UUID, indicator: InstantIndicator, save: bool =
|
|||||||
new_inds = AttributeDict(**new_inds)
|
new_inds = AttributeDict(**new_inds)
|
||||||
new_tick_inds = {key: [] for key in detail.indicators[1].keys()}
|
new_tick_inds = {key: [] for key in detail.indicators[1].keys()}
|
||||||
new_tick_inds = AttributeDict(**new_tick_inds)
|
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)
|
##dame nastaveni indikatoru do tvaru, ktery stratvars ocekava (pro dynmaicke inicializace)
|
||||||
stratvars = AttributeDict(indicators=AttributeDict(**{jmeno:toml_parsed}))
|
stratvars = AttributeDict(indicators=AttributeDict(**{jmeno:toml_parsed}))
|
||||||
#print("stratvars", stratvars)
|
#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
|
#inicializujeme stavove promenne a novy indikator v cilovem dict
|
||||||
if output == "bar":
|
if output == "bar":
|
||||||
|
|||||||
@ -58,7 +58,7 @@ def eval_close_position(state: StrategyState, accountsWithActiveTrade, data):
|
|||||||
if curr_price > activeTrade.stoploss_value:
|
if curr_price > activeTrade.stoploss_value:
|
||||||
|
|
||||||
directive_name = 'reverse_for_SL_exit_short'
|
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":
|
if reverse_for_SL_exit == "always":
|
||||||
followup_action = Followup.REVERSE
|
followup_action = Followup.REVERSE
|
||||||
|
|||||||
Reference in New Issue
Block a user