No orders filled
-
I am using the BackBroker for backtesting, but I am seeing zero trades made, even though stop-limit entry orders the strategy is placing should have been hit.
I see a few orders as rejected, but most not.
Any recommendations for things to check e.g. is it possible to see the reason an order is rejected?
-
@bishbashbosh said in No orders filled:
Any recommendations for things to check e.g. is it possible to see the reason an order is rejected?
It is really impossible to know why you don't get any matches (most probably you are exceeding your available cash) without some working code.
-
I created a notebook here that demonstrates the issue: https://github.com/moconnell/public-notebooks
Orders placed, look like they should be getting hit, but... nada:
-
I don't know if your expectation is that someone does a completely code review of what you have posted in GitHub.
When one believes there is an issue somewhere ... one creates a small working sample to understand what the issue is and where it is (be it in the platform or in your logic)
In any case all your orders are obviously (as stated above) being rejected because you exceed your cash reserves, not that difficult to see:
- Cash in the chart: 10,000
From your own log
Size: 16000 Price: 1.2225000000000001 Price Limit: 1.2226000000000001
You multiply 16000 by 1.2225 and ...
@bishbashbosh said in No orders filled:
Orders placed, look like they should be getting hit, but... nada:
For obvious reasons.
-
Well, I thought that was a small sample! Thanks for taking a look :)
So, I guess in this case my question would be how to integrate leverage into the backtest? For example, the chart is of EURUSD and an account balance of 10k a buy order of 16k would be completely reasonable on IB.
-
and the answer is:
cerebro.broker.setcommission(leverage=50)
-
@backtrader cool framework btw - thanks!