Backtesting Precision & Bar Magnifier

Questions about MultiCharts and user contributed studies.
rgranero
Posts: 56
Joined: 26 Jul 2010
Has thanked: 4 times
Been thanked: 1 time

Backtesting Precision & Bar Magnifier

Postby rgranero » 08 Feb 2012

Hi,
I applied on a weekle chart a strategy and then I tried to use Bar Magnifier to see the result based on daily data but the result are the same... it seems that dosn't works.

How I did:
in Strategy Properties-->Backtesting I flag Use Bar Magnifier and then flag Daily.

Riccardo

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

Re: Backtesting Precision & Bar Magnifier

Postby Henry MultiСharts » 08 Feb 2012

Hello Riccardo,

Do you consider that the strategy calculation results should be different using 1 day bar magnifier?
Please describe in details.

rgranero
Posts: 56
Joined: 26 Jul 2010
Has thanked: 4 times
Been thanked: 1 time

Re: Backtesting Precision & Bar Magnifier

Postby rgranero » 09 Feb 2012

Hello Henry,

I use stop order on weekly data. If I don't use Bar Magnifier I have execution price to levels that would have been untouched. When I use Bar Magnifier I would expect a execution price only at real price touched in daily data.

In attachment the example chart where I buy at open + x stop. I applied Bar Magn. but the price of execution is never touched on daily data.

Thanks
Riccardo
Attachments
CHART.png
(106.67 KiB) Downloaded 725 times

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

Re: Backtesting Precision & Bar Magnifier

Postby Henry MultiСharts » 09 Feb 2012

Hello Riccardo,

1) All highlighted in orange trades took place within a bar. Do you have any orders executed at price beyond High or Low of a bar?
If yes, please demonstrate this bar with visible hint window.
Please have a look at the attachment.
2) Are you using Extended Backtesting mode with 2 extra data series (asks/bids)?
3) Please explain what is incorrect in the Strategy performance report.
Attachments
Pic1.png
(161.8 KiB) Downloaded 709 times

rgranero
Posts: 56
Joined: 26 Jul 2010
Has thanked: 4 times
Been thanked: 1 time

Re: Backtesting Precision & Bar Magnifier

Postby rgranero » 10 Feb 2012

Henry in attachment the explain.

Thanks
Riccardo
Attachments
Immagine1.png
(63.8 KiB) Downloaded 713 times

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Backtesting Precision & Bar Magnifier

Postby JoshM » 10 Feb 2012

Henry in attachment the explain.
Your problem might lay in your code:

Code: Select all

buy next bar at open + value1 stop;
This is an "ever changing" stop order, since the open for every bar changes, you're in effect "running after the market".

For example, let's say value1 is 10, and the current price is 2.498:
  • Bar 1 opens at 2.499 -> buy order submitted at 2.509,
    Bar 2 opens at 2.502 -> buy order submitted at 2.512,
    Bar 3 opens at 2.499 -> buy order submitted at 2.509,
    etc.
Also note that with IntrabarOrderGeneration turned on (don't know if you use that, but just saying), you'll need to submit the order every tick since 'next bar' effectively means 'next tick' with IOG turned on.

Perhaps something like this might work better:

Code: Select all

Variables:
enterLong(False), elPrice(0);

if (Close > XAverage(Close, 20)) then begin
enterLong = True;
elPrice = Open + 10;
end;

if (enterLong = True) then
buy next bar at elPrice stop;

rgranero
Posts: 56
Joined: 26 Jul 2010
Has thanked: 4 times
Been thanked: 1 time

Re: Backtesting Precision & Bar Magnifier

Postby rgranero » 10 Feb 2012

Thanks Josh for the help!

The code isn't
buy next bar at open + value1 stop;
but
buy next bar at open next bar + value1 stop;

Josh I would buy tomorrow at open + value1 (calculated today).

I tried in TS and works (pheraps the code is little bit different)

easylanguage TS 2000i:
buy at o next bar + value1 stop;
In format strategy Backtesting Setting I flag Strategy testing resolution on daily and works.

easylanguageMC 7.4:
buy next bar at open next bar + value1 stop;
I flag daily resolution but don't work

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

Re: Backtesting Precision & Bar Magnifier

Postby Henry MultiСharts » 10 Feb 2012

There is no hint on the chart that makes price comparison impossible.
Please enable the hint in View->Show hint and Tracking time and price in View->Tracking settings and provide proper screenshots with visible hint or data window.
Please further note that full screenshots are preferred as the cropping is removing necessary information.

You can also come to our live chat Monday-Friday 6:30 am - 4 pm EST to demonstrate the issue live.
We will do our best to help you.

rgranero
Posts: 56
Joined: 26 Jul 2010
Has thanked: 4 times
Been thanked: 1 time

Re: Backtesting Precision & Bar Magnifier

Postby rgranero » 14 Feb 2012

Henry, The correct price filled is fundamental during backtesting. When I test a strategy i must know if is really profitable or if the order generated are filled at inesistent price (during gAp). In TS backtesting resolution works in this manner. Sure I prefere MC, but this is a problem in backtesting. Could MC staff modify backtester resolution and bar magnifire to have a result nearest to reality? Nobody have my problem?

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

Re: Backtesting Precision & Bar Magnifier

Postby Henry MultiСharts » 15 Feb 2012

Riccardo, we are investigating this case.
I will keep you updated.

rgranero
Posts: 56
Joined: 26 Jul 2010
Has thanked: 4 times
Been thanked: 1 time

Re: Backtesting Precision & Bar Magnifier

Postby rgranero » 15 Feb 2012

Ok! Thanks

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

Re: Backtesting Precision & Bar Magnifier

Postby Henry MultiСharts » 16 Feb 2012

Hello Riccardo,

Currently MultiCharts uses only the close of the detailed data series bar and applies Intra-Bar Price Movement Assumptions for calculation. We agree that this is malfunction.
This functionality will be improved in one of the future versions of MultiCharts. Strategy will be calculated on the OHLC of the detailed data series bar using Intra-Bar Price Movement Assumptions, avoiding order fill in the price gaps.
Thank you for the reporting.

rgranero
Posts: 56
Joined: 26 Jul 2010
Has thanked: 4 times
Been thanked: 1 time

Re: Backtesting Precision & Bar Magnifier

Postby rgranero » 16 Feb 2012

Ok Henry,

Please to cosider to extend Bar Magnifier and the improvement to Portfolio Backtester too. Portfolio Backtester is a formidable tool (global variable like Portfolio.netprofit are very useful!!) and one (with many other) of the benefit to work with MC.

I am glad that my report is served!!

Riccardo

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

Re: Backtesting Precision & Bar Magnifier

Postby Henry MultiСharts » 16 Feb 2012

Riccardo,

Thank you for your suggestion.
We will consider the implementation of this feature in one of the future versions.


Return to “MultiCharts”