give the index price as a short_enteries to vectorbt

127 views Asked by At

i want to give the vectorbt the date of the short positon but it only takes boolean value for trade.

try:
   import vectorbt as vbt
except:
  !pip install vectorbt
  import vectorbt as vbt

pf = vbt.Portfolio.from_signals(close=data.Close,                                    
                            
    short_entries=data.Close <  0.436 ,
    # short_exits= (data.Close < 0.406)[0] ,
    sl_stop= 0.02,
    tp_stop= 0.02,
    init_cash=20) 

pf.plot().show()

the problem is that i want to have only one short pisiton in backtesting but when the short postion at (stop_loss 2%) is trigger and it has closed, the code goes to the next short_postion.

how can i prevent vectorbt backtesting to not going for the next postion.?

0

There are 0 answers