Does this create a reliable backtest? Can you walk me through the steps of how MC handles the backtests via Bid/Ask series? I'm seeing some areas where it looks buggy...
See the screen shot:
What do I do with this? Why is it that realistic backtesting is so hard with MC?
Symbol with data, simple test code pla, and screen shots were sent to MC.
Extended backtesting [SOLVED]
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Extended backtesting [SOLVED]
Hello MAtricks,
The fill model has been already described multiple times on the forum and is also described in the wiki section:
https://www.multicharts.com/trading-sof ... Calculated
https://www.multicharts.com/trading-sof ... acktesting
Here are extracts applied to the current case:
• A Limit order will execute at the specified price or better. A better price is a lower price for Buy and Buy to cover orders, and a higher price for Sell and Sell short orders.
• Calculation on historical data. Regular mode (IOG disabled. Bar Magnifier disabled):
The script is calculated on the bar close. It's considered that all prices were within the bar (Intra-bar Price movement assumption is used). An order is filled on any price that satisfies order execution conditions with price step (minmove/pricescale) within the next bar.
• Specifically for extended backtesting: MultiCharts will use the ask (orange) data series to fill buy market, buy stop and buy limit orders. Similarly, MultiCharts will use the bid (cyan) data series to fill sell market, sell stop and sell limit orders.
We have edited your code for ease of analysis and description. Now the indicator plots buy and sell markers on the order generation bar. I have manually added line drawings and arrows to demonstrate the price and direction that satisfies the limit order execution conditions. Each line is until the next Trade bar (main calculation series) = order life length.
Case 1: Currently in short position. Open price of the Ask bar satisfies Buy Limit order execution conditions. Reverse at the same bar as Sell Limit order price is within the Bid bar. Order is filled at the price it was generated with no improvement.
Case 2: Low/close of the Ask bar satisfies Buy Limit order execution conditions.
Case 3: Open/high of the Bid bar satisfies Sell limit order execution conditions.
Case 4: Open price of the Ask bar satisfies Buy Limit order execution conditions.
Case 5: Open/high of the Bid bar satisfies Sell limit order execution conditions.
The fill model has been already described multiple times on the forum and is also described in the wiki section:
https://www.multicharts.com/trading-sof ... Calculated
https://www.multicharts.com/trading-sof ... acktesting
Here are extracts applied to the current case:
• A Limit order will execute at the specified price or better. A better price is a lower price for Buy and Buy to cover orders, and a higher price for Sell and Sell short orders.
• Calculation on historical data. Regular mode (IOG disabled. Bar Magnifier disabled):
The script is calculated on the bar close. It's considered that all prices were within the bar (Intra-bar Price movement assumption is used). An order is filled on any price that satisfies order execution conditions with price step (minmove/pricescale) within the next bar.
• Specifically for extended backtesting: MultiCharts will use the ask (orange) data series to fill buy market, buy stop and buy limit orders. Similarly, MultiCharts will use the bid (cyan) data series to fill sell market, sell stop and sell limit orders.
We have edited your code for ease of analysis and description. Now the indicator plots buy and sell markers on the order generation bar. I have manually added line drawings and arrows to demonstrate the price and direction that satisfies the limit order execution conditions. Each line is until the next Trade bar (main calculation series) = order life length.
Case 1: Currently in short position. Open price of the Ask bar satisfies Buy Limit order execution conditions. Reverse at the same bar as Sell Limit order price is within the Bid bar. Order is filled at the price it was generated with no improvement.
Case 2: Low/close of the Ask bar satisfies Buy Limit order execution conditions.
Case 3: Open/high of the Bid bar satisfies Sell limit order execution conditions.
Case 4: Open price of the Ask bar satisfies Buy Limit order execution conditions.
Case 5: Open/high of the Bid bar satisfies Sell limit order execution conditions.
- Attachments
-
- ext_bt.png
- (59.31 KiB) Downloaded 604 times