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
import pandas as pd import numpy as np from backtesting.test import GOOG tg = GOOG.head(30).copy() nums = list(range(1,7)) + list(range(6,2,-1)) + list(range(6,20)) + list(range(14,17)) + list(range(15,12,-1)) tg["Open"] = tg["Close"] = tg["High"] = tg["Low"] = nums from backtesting import Strategy from backtesting.lib import crossover class PosChange(Strategy): """ 5 days rise buy, with tp = 1.5, sl = 0.8 """ def init(self): pass def next(self): if len(self.data) >= 5: if self.data["Close"][-1] > self.data["Close"][-2] > self.data["Close"][-3] > self.data["Close"][-4] > self.data["Close"] print("buy singal: " + str(self.data["Open"].s.index[-1])) self.buy(tp=1.5*self.data["Close"][-1], sl=0.8*self.data["Close"][-1]) from backtesting import Backtest bt = Backtest(tg, PosChange, cash=100, commission=.000, trade_on_close=True) stats = bt.run() bt.plot() stats._trades
It buys again although it shouldn't have money until the next day.
Although I understand there is no reason to use trade_on_close, are there any plans to fix this behavior?
The text was updated successfully, but these errors were encountered:
Fixed in 4aee89a.
Sorry, something went wrong.
No branches or pull requests
It buys again although it shouldn't have money until the next day.
Although I understand there is no reason to use trade_on_close, are there any plans to fix this behavior?
Additional info
The text was updated successfully, but these errors were encountered: