daily update
This commit is contained in:
2584
research/strats/WVAP_DIVERGENCE/from_signal_func_nb.py
Normal file
2584
research/strats/WVAP_DIVERGENCE/from_signal_func_nb.py
Normal file
File diff suppressed because it is too large
Load Diff
16
research/strats/WVAP_DIVERGENCE/signal_func_nb.py
Normal file
16
research/strats/WVAP_DIVERGENCE/signal_func_nb.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
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)
|
||||||
|
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
|
||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user