Extended backtesting  [SOLVED]

Questions about MultiCharts and user contributed studies.
User avatar
MAtricks
Posts: 789
Joined: 09 Apr 2012
Has thanked: 286 times
Been thanked: 288 times

Extended backtesting

Postby MAtricks » 02 Mar 2015

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:

Image

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.
Attachments
EXTENDED BACKTESTING.png
(138.27 KiB) Downloaded 678 times

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Extended backtesting  [SOLVED]

Postby Henry MultiСharts » 31 Mar 2015

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.
Image
Attachments
ext_bt.png
(59.31 KiB) Downloaded 604 times


Return to “MultiCharts”