more accurate backtests

Questions about MultiCharts .NET and user contributed studies.
HellGhostEvocatorX
Posts: 74
Joined: 10 Feb 2022
Has thanked: 44 times
Been thanked: 8 times

more accurate backtests

Postby HellGhostEvocatorX » 23 Jun 2022

Hello, I tried to send buy and sell orders within a daily chart. However, these are only ever executed with close or with the bar magnifying glass with open, high, low or close.
Not in the bar itself. Why can't this be simulated for backtesting?

The backtest system should assume that EVERY possible price within a candle has been started once. a possible deviation could be made adjustable in a similar way to the slippage.

Otherwise you would have to carry out every backtest on the basis of tick data, it would be difficult to get hold of such data.

Maybe the whole thing is already possible, but I couldn't find a way to do this even with the IOG.

And especially with such long candles as in the picture, an execution in the backtest only at the close hardly makes sense.

so i can write :

Code: Select all

if (Bars.Price.Value == HochPunktSpeicherPreis[0] ) {//Kaufsignal MarketKaufOrder.Send();
Attachments
111.png
(54.18 KiB) Not downloaded yet

User avatar
Svetlana MultiCharts
Posts: 645
Joined: 19 Oct 2017
Has thanked: 3 times
Been thanked: 163 times

Re: more accurate backtests

Postby Svetlana MultiCharts » 30 Jun 2022

Hello HellGhostEvocatorX,

Have you tried to use Bar Magnifier and IOG? For proper Bar Magnifier operation, you need to have data subscription to the detailed data (e.g. to tick data if Bar Magnifier is set to tick) or this data should be imported in the database.

If it does not help, could you reproduce this behaviour in a simplified environment and send us the following files for analysis?
1. The workspace where the behaviour is reproduced.
2. Export of used symbols (with data) from QuoteManager in .qmd archive.
3. The exported scripts with all dependent functions that are used on the workspace.
4. Screenshots and step-by-step instruction how to reproduce the issue, or a short video.

HellGhostEvocatorX
Posts: 74
Joined: 10 Feb 2022
Has thanked: 44 times
Been thanked: 8 times

Re: more accurate backtests

Postby HellGhostEvocatorX » 30 Jun 2022

thanks svetlana for the answer.

Yes, I've tried both and it doesn't work (because I only have end-of-day data - probably)

But that's exactly what it's about. if I open e.g. at 100 and a close at 90, then the price must have been at 99, 98, 97 etc. in the meantime and my sell order could have been triggered at 94, for example, and not at 90.

Of course I'm aware that there can also be intraday "gaps" here, but it would still be more accurate if the backtester can trigger my sell order at any point in the bar than just at high, low, open, close.

I've already considered writing a function for this, but the mechanisms take place in areas of multicharts that are not accessible to me.

one could simply write, if a limit sell order is at 95, then fill it at 95 if a candle has a high above and a low below 95.

HellGhostEvocatorX
Posts: 74
Joined: 10 Feb 2022
Has thanked: 44 times
Been thanked: 8 times

Re: more accurate backtests

Postby HellGhostEvocatorX » 02 Jul 2022

ok, i think i found the solution to my problem. With market orders, the order is always created at the end of a bar and cannot be executed in the middle of the bar. By changing to a limit order, the orders can now also be executed in the bar. I stumbled upon it by accident: TJ's 1st post here brought me to it

viewtopic.php?f=1&p=121407#p121407

Now, however, the buy orders are still generally executed at the wrong bar, and not as I had originally intended, but I can still get behind that, maybe I've accidentally changed something wrong by trying around.

User avatar
Svetlana MultiCharts
Posts: 645
Joined: 19 Oct 2017
Has thanked: 3 times
Been thanked: 163 times

Re: more accurate backtests

Postby Svetlana MultiCharts » 05 Jul 2022

Taking the above into account, if you use market orders, they can be executed on next bar open or this bar close only. If you use price orders, they will be placed at the order’s price and filled when the bar’s price meets the order’s price conditions.
Please read more here.


Return to “MultiCharts .NET”