renko + prescribedTrades and tradeList linked

This commit is contained in:
David Brazda
2023-11-09 13:44:33 +01:00
parent b7f148fadd
commit aead08a2c9
9 changed files with 275 additions and 48 deletions

View File

@ -5,7 +5,7 @@ def populate_cbar_tick_price_indicator(data, state: StrategyState):
conf_bar = data['confirmed']
#specifická sekce pro CBARVOLUME, kde vzdy máme nova data v confirmation baru (tzn. tickprice pocitame jak pri potvrzenem tak nepotvrzenem)
if state.rectype == RecordType.CBARVOLUME:
if state.rectype in (RecordType.CBARVOLUME, RecordType.CBARRENKO):
try:
tick_price = data['close']
tick_delta_volume = data['volume'] - state.vars.last_tick_volume

View File

@ -62,10 +62,10 @@ def execute_prescribed_trades(state: StrategyState, data):
state.ilog(lvl=1,e=f"Nastaveno SL na {sl_defvalue}, priced normalized: {sl_defvalue_normalized} price: {state.vars.activeTrade.stoploss_value }")
elif isinstance(sl_defvalue, str):
#from indicator
ind = sl_defvalue_abs
ind = sl_defvalue
sl_defvalue_abs = float(value_or_indicator(state, sl_defvalue))
if sl_defvalue_abs >= float(data['close']):
raise Exception(f"error in stoploss {sl_defvalue_abs} >= curr price")
raise Exception(f"error in stoploss {ind} {sl_defvalue_abs} >= curr price")
state.vars.activeTrade.stoploss_value = sl_defvalue_abs
state.ilog(lvl=1,e=f"Nastaveno SL na {sl_defvalue_abs} dle indikatoru {ind}")
insert_SL_history(state)
@ -92,10 +92,10 @@ def execute_prescribed_trades(state: StrategyState, data):
state.ilog(lvl=1,e=f"Nastaveno SL na {sl_defvalue}, priced normalized: {sl_defvalue_normalized} price: {state.vars.activeTrade.stoploss_value }")
elif isinstance(sl_defvalue, str):
#from indicator
ind = sl_defvalue_abs
ind = sl_defvalue
sl_defvalue_abs = float(value_or_indicator(state, sl_defvalue))
if sl_defvalue_abs <= float(data['close']):
raise Exception(f"error in stoploss {sl_defvalue_abs} <= curr price")
raise Exception(f"error in stoploss {ind} {sl_defvalue_abs} <= curr price")
state.vars.activeTrade.stoploss_value = sl_defvalue_abs
state.ilog(lvl=1,e=f"Nastaveno SL na {sl_defvalue_abs} dle indikatoru {ind}")
insert_SL_history(state)