I am trying to refine my entries and also realizing the shortfalls of backtesting vs reality when it comes to actual fills. As we know, the biggest aspect of whether your order gets filled (when trading does occur at your desired price) is who got their orders in first at the desired price. Is there a simple way to solve for the future price that triggers your trade signal using MC? Let's use a SMA to keep it simple and say your strategy goes short when the price exceeds the 2 std dev up band and exits when it passes the 2 std dev down. You're using a length of 20. Is there a way to take the known previous 19 closes and solve for the minimum 20th (future) close which will cause the price to exceed your trading threshold (bollinger band in this case) and place a limit order at that minimum price so if the price does indeed exceed your threshold you will be earlier in line to be filled? Below is an example with normal calculations, but I want to make a version of this that predicts that minimum price increase needed from current price to induce a signal and get that order in ahead of time. The close of the 20th future bar will not only decide whether a threshold is crossed but also what that threshold is so it gets a little tricky.
Code: Select all
Variables:
SMA (0) ,
SDev (0) ,
NumberStdDevs (0) ;
//Normal Calculations
SMA = Average (Close, 20) ;
SDev = StandardDev (Close, 20) ;
NumberStdDevs = (Close - SMA) / SDev ;
//Normal Orders
If NumberStdDevs > 2.0
then sell short next bar at Close Limit ;
If NumberStdDevs < -2.0
then buy to cover next bar at Close Limit ;