Real-time * BackTest Position MisMatch

Questions about MultiCharts and user contributed studies.
jondo
Posts: 9
Joined: 17 Jul 2015
Has thanked: 1 time
Been thanked: 2 times

Real-time * BackTest Position MisMatch

Postby jondo » 04 Aug 2015

Hello,

Could you please advise me how to deal with having different bars trading real-time and back-tested. Basically it seem I am getting from TS data feed different ticks in real time compering to back-test (window reload). That means my back-tested results doesn't fit with real-time.

Compering bars using a print function from real-time run and back-tested one, I have more bars in real time trading also with slightly different prices. I have this issue in strategy which is using multiple time series including markets and different range bars. Series one is tick range bar, second eries is different market on 10 tick range bar, 3rd data is first market on 10 tick range bar. I do not have this issue in different windows, strategies.

In enclosed picture, you found a position difference compering strategy (back-test) and colored bars (global variables containing market_position_at_broker from real-time).

I had a similar issue in TS and it was one of more reasons why I had to go for different software. Do you think a different data provider would change a situation? Perhaps IQFeed or ESignal would provide better real-time data feed?


Thank you very much,
John
Attachments
Ilust.jpg
(127.94 KiB) Downloaded 374 times

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

Re: Real-time * BackTest Position MisMatch

Postby Henry MultiСharts » 04 Aug 2015

Hello jondo,

Most data vendors adjust historical data on their servers, that is why it can be different from the realtime stream. To minimize the difference that is recommended to use time based resolutions.

In general case in order to ensure backtesting calculation is similar to realtime calculation you need to have the same sequence of ticks for strategy calculation (Bar Magnifier). Backetsting and Realtime calculations should also occur at the same time periods (IOG & RTHM).

As for the code - the fewer complicated conditions it has, the better. A condition that is triggered in backtesing can be not met in realtime and vice versa.
When historical calculation is compared to realtime broker trading that is even more complicated as the orders are managed by the broker.

Please study the following articles to get a better understanding of how backtesting and realtime trading are working:
Backtesting vs Live Trading, How Signals are Calculated, Why Identical Charts Are Showing Different Strategy Trading Results,
Why is Data Playback strategy performance different from Backtesting results%3F.

Please keep in mind that backtesting cannot simulate real market movement activity, order queue and latency. It is just a calculation on historical data where you always filled when fill conditions are met. That is it’s nature and that is expected. Backtesting, optimization, and forward testing (real-time simulation) provide an insight into potential performance of your strategy in “ideal world”. This information should be analyzed to get a range of possible scenarios.
It is up to trader to decide if this range is acceptable for live trading or not.

If you want to have real market activity simulation – you can use the sim/paper trading broker connection or the prebuilt Paper Trader (starting from MultiCharts 9.1 Beta 1). But even brokers do not guarantee that it will be the same as the real live market trading.

jondo
Posts: 9
Joined: 17 Jul 2015
Has thanked: 1 time
Been thanked: 2 times

Re: Real-time * BackTest Position MisMatch

Postby jondo » 05 Aug 2015

Thanks Henry,

actually the screen is from simulated trading so this piece is still in testing regime. I went through the material you advised. But I am still surprised why there is a difference in number of bars. I tried to print bars using "ticks" in code and without, no difference. Actually the number of bars is significantly larger from automated print than from recalculation print (169k comparing to 42k/ 3 days). I am not reloading data, I just turn off the strategy and recalculate it.

I enclosed recalculation print also with real time print including date, time and close prices for 3 input data series also marketpostion. This version of print is without "ticks". I have IOG enabled from code also in settings. Charts have also same starting points.

Why this is occurring? Of course expected results should be those from recalculation.

What exactly function "ticks" do in code? I thought including this function would recalculate code on every tick (especially running on 1 tick range bar). Does it? [I know its not written in documentation but it was said somewhere... :) ]

Have a nice day,
John
Attachments
Print.rar
(136.23 KiB) Downloaded 155 times

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

Re: Real-time * BackTest Position MisMatch

Postby Henry MultiСharts » 05 Aug 2015

Hello John,

Please send us the workspace and code you are using to generate this output to support@multicharts.com


Return to “MultiCharts”