When I was creating a logic program based on the history data of individual stocks, I ran into the problem of not being able to verify limit orders.
For market orders, you can calculate the closest execution price using the “Bid Price” or “Ask Price” from the history data, but you can’t be sure about limit orders or stop orders using history data.
This is obvious, but it’s more troublesome than you might think.
The calculation method is that for buy limit orders, if the “Bid Price” is one price lower than the target price, the order will definitely be executed.
In reality, when creating logic for day trading individual stocks, the spread, which is the difference between the “Bid Price” and “Ask Price”, becomes quite costly when calculating the deduction rate, so if possible, you want to create logic using limit orders and stop orders.
For market orders, the calculation results are generally reliable.