daily update

This commit is contained in:
David Brazda
2024-10-24 14:58:29 +02:00
parent 58834ae533
commit d718ed61bd
2 changed files with 121287 additions and 16050 deletions

View File

@ -2,15 +2,18 @@ from numba import njit
import vectorbtpro as vbt
@njit
def signal_func_nb(c, entries, exits, short_entries, short_exits, cooldown_time, cooldown_bars):
entry = vbt.pf_nb.select_nb(c, entries)
exit = vbt.pf_nb.select_nb(c, exits)
long_entry = vbt.pf_nb.select_nb(c, entries)
long_exit = vbt.pf_nb.select_nb(c, exits)
short_entry = vbt.pf_nb.select_nb(c, short_entries)
short_exit = vbt.pf_nb.select_nb(c, short_exits)
if not vbt.pf_nb.in_position_nb(c): #c.last_position == 0
if vbt.pf_nb.has_orders_nb(c):
last_exit_idx = c.last_pos_info[c.col]["exit_idx"] #(92) #If not in position, position information records contain information on the last (closed) position
if cooldown_time is not None and c.index[c.i] - c.index[last_exit_idx] < cooldown_time:
return False, exit, False, short_exit #disable entry
elif cooldown_bars is not None and last_exit_idx + cooldown_bars > c.i:
return False, exit, False, short_exit #disable entry
return entry, exit, short_entry, short_exit
if cooldown_time is not None and c.index[c.i] - c.index[last_exit_idx] <= cooldown_time:
return False, long_exit, False, short_exit #disable entry
elif cooldown_bars is not None and last_exit_idx + cooldown_bars >= c.i:
return False, long_exit, False, short_exit #disable entry
#if in position, entries are disabled too
else:
return False, long_exit, False, short_exit #disable entry
return long_entry, long_exit, short_entry, short_exit

File diff suppressed because one or more lines are too long