We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Number of days in _trades should be just 1 or 2 but are 389 or anything
if records count is 300 then difference is coming out as 389
I am simply buying at records number 10 and selling at record number 11... using a ii counter code:
# Define the two MA lags as *class variables* # for later optimization n1 = 10 n2 = 20 ii = 0 boughtonce=False def init(self): # Precompute the two moving averages self.sma1 = self.I(SMA, self.data.Close, self.n1) self.sma2 = self.I(SMA, self.data.Close, self.n2) def next(self): # print(self.data.Close) global ggg self.ii += 1 # if ggg == False: if self.ii == 10: self.buy() ggg = True if self.ii == 11: self.sell() return
GOOG = GOOG[:300] print(GOOG) bt = Backtest(GOOG, SmaCross, cash=1000, commission=0) stats = bt.run() print(stats, "\n", stats._trades) ` Output: `dtype: object Size EntryBar ExitBar EntryPrice ExitPrice PnL ReturnPct EntryTime ExitTime Duration 0 7 30 299 130.8 345.78 1504.86 1.643578 2004-10-01 2005-10-25 389 days
bokeh.__version__
The text was updated successfully, but these errors were encountered:
Explained in #1100 (comment).
Sorry, something went wrong.
No branches or pull requests
Expected Behavior
Number of days in _trades should be just 1 or 2 but are 389 or anything
Actual Behavior
if records count is 300 then difference is coming out as 389
Steps to Reproduce
I am simply buying at records number 10 and selling at record number 11... using a ii counter
code:
Additional info
bokeh.__version__
:The text was updated successfully, but these errors were encountered: