If I want to use OnChartEvent() function to Backtest, How to do?

 

I want to use the object manual interaction function during backtesting, but I found that the OnChartEvent() function does not work during backtesting.

How should it be set? Or is there any other good way?

 
Yu Zhang:

I want to use the object manual interaction function during backtesting, but I found that the OnChartEvent() function does not work during backtesting.

How should it be set? Or is there any other good way?

In Tester visual mode, OnChartEvent() is "working" for indicators, not for EA.

I write "working", because it's not fully working like on a live chart, there are some limitations.

Forum on trading, automated trading systems and testing trading strategies

Is OnChartEvent() actually called during a "Stratagy Tester - Visual Testing" mode session?

cowil, 2017.06.05 09:48

Hi Alain,

Just letting you know that this issue has (finally) been confirmed as a bug by MetaQuotes. The "OnChartEvent()" event handler definitely doesn't get called when it's used within an Expert running in "Visual Simulation" mode (works fine on a live chart). It does however, get called if the event handler is placed within an Indicator and then that Indicator is run within a "Visual Simulation" mode session.

Metaquotes aren't able to provide a fix date, so it'll just be a matter of keeping an eye on the release notes I guess...

It has not changed since 2017.