Questions tagged [vectorbt]
8 questions
1
vote
1 answer
How to set a stoploss in vectorbt based on the number of ticks or price per contract
There's an options to add tp_stop or sl_stop on vbt.Portfolio.from_signals which is percent based.
sl_stop : array_like of float Stop loss. Will broadcast.
A percentage below/above the acquisition price for long/short
position. Note that 0.01 =…

ralphinator80
- 641
- 5
- 17
1
vote
0 answers
May I ask how to present the backtest result by by vertorbt (From_Signal) or backtesting.py with abosulte point but not in percentage?
May I ask how to present the backtest result by by vertorbt (From_Signal) or backtesting.py with abosulte point but not in percentage? Say, I am trading index futures, so I have a fixed gain for each point instead of being a relative…

Likey Fung
- 11
- 1
1
vote
0 answers
Vectorbt type object 'DOMWidget' has no attribute '_ipython_display_'
So I'm trying to plot a simple RSI indicator in Python using the Vectorbt library. The RSI plots correctly but there's an error that comes with it.
As can be seen here
`
#nilagyan ng r para raw file dahil nababasa ng python as UNICODE pag may slash…

zcodec
- 11
- 2
0
votes
0 answers
Using bid and ask prices with VectorBT library
I am creating a backtest using vectorbt library. This is my function for all the portfolio metrics:
pf = vbt.Portfolio.from_signals(
signal_data['close'],
entries,
exits,
init_cash=10_000_000,
freq='D'
)
Now, instead of using…

arkon
- 57
- 4
0
votes
0 answers
give the index price as a short_enteries to vectorbt
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, …

erfanvahdat
- 47
- 6
0
votes
0 answers
Is it possible for Vectorbt to enter the market in batches?
For example, if the initial cash is $1,000, buy $500 when the stock price crosses MA5 for the first time, buy another $500 when the stock price falls to MA10, stop loss and exit when the stock price falls to MA20, and take profit and exit when there…
0
votes
1 answer
How to fill in NaN when using np.append witb a condition?
Sorry for another noob question!
I have a function which is taking the opening price of a bar, and increasing it by 100%, to return my target entry price:
def prices(open, index):
gap_amount = 100
prices_array = np.array([])
index =…

a7dc
- 3,323
- 7
- 32
- 50
0
votes
2 answers
'numpy.ndarray' object has no attribute 'append'
Sorry for the noob question but I am very new to Python.
I have a function which takes creates a numpy array and adds to it:
def prices(open, index):
gap_amount = 100
prices_array = np.array([])
index = index.vbt.to_ns()
day = 0
…

a7dc
- 3,323
- 7
- 32
- 50