Replies: 1 comment 2 replies
-
You can add condition in front of the self.buy: for example, from:
to:
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I am new to Backtesting.py and I have the following question:
Within my strategy class I use the following to place an order based on some condition.
self.buy(sl = stopLoss, tp = takeProfit, size= .99999)
Before the run I also set:
bt = backtesting.Backtest(df_Test, MyStrategy, trade_on_close = True, exclusive_orders = False, cash = initialCash)
Here is part of the trading plot
Can someone explain to me why Backtesting starts another trade (see arrow) before the active trade becomes inactive since there is not enough available liquidity because size= .99999 (So if I understand the whole initial capital is committed to the previous trade)??
thanks
Beta Was this translation helpful? Give feedback.
All reactions