Wrong behavior of Limit order
Hi guys, I have a problem with a limit order during my backtests on forex pair EURUSD.
Let's take a look at the log:
2022-01-05, | SHORT crossover low price @ 1.12772 2022-01-05 | open SHORT trade @ 1.12772 (entrySellPrice) 2022-01-06 | EUR_USD, Trade Opened, Price: 1.1313, Size: -1 Type: SHORT Comms: 0.0
on 2022-01-05 I set the price and add a "limit" order with this code:
self.order = self.sell(exectype=bt.Order.Limit, price=self.entrySellPrice, size=1)
This order is executed on 2022-01-06 but the limit price (1.12772) is outside the candle of 6th of Jan 2021
I do not understand what is wrong; I am using the default broker
@alexgiul Hello, if you want some people to reproduce your issue and help you to solve it, it may help to provide the code which generate the issue (No need to expose the trade logic), along with a piece of the data you are using around the date of the issue.
Hi @emr , I looked at the code of bbroker and discovered I misunderstand the logic of "limit" order; what I was looking for is exactly the "Stop" order which is executed only when the target price is hit by the candle