Cycles MT4 Indicators in expert advisor back testing issues


#1

Hello,

I have been testing the new MT4 Hurst indicators and am very impressed with them.

I have been testing an Expert Adviser in MT4 to back test the new Hurst Cycles MT4 indicators and have not been very successful.

I have attempted to call with iCustom the Hurst Cycles indicator for Monthly time-frame down to the target testing time-frame during OnInit(), (as David demonstrates in the setup video to start with a monthly time-frame and work down). I am also passing just the 1st indicator parameter with a different strategy name (not “default”) e.g., “back test”.

I then attempt to call the Hurst VTL and Hurst FLD indicators with iCustom in OnTick() again passing the first parameter for the analysis name (not “default”) e.g., “back test”.

During a visual back test I can see the diamonds being placed, but no VTLs or FLDs / FLD targets seem to be drawn by the VTL and FLD indicators.

I think there may be a few issues to overcome to allow back testing with the indicators.

David also demonstrated in a video that the Hurst Cycle indicator should be added to a chart first before the VTL/FLD indicator so the Hurst Cycles indicator appear first in the indicators list for the chart. Interestingly I notice that even though I call the iCustom() for the Hurst Cycles first in the Expert Adviser, when a back test is complete and I open the indicator list for the visual back test chart after completion, the Hurst Cycles indicator is on the bottom of the indicator list below the VTL and FLD indicators.

I also noticed after running the back test that the cycle data csv file for the analysis name passed as the 1st parameter in the EA is not created in folder with the other indicator analysis files (\MQL4 Folder\Files\Cycles) e.g., EURUSD_backtest.csv.

I also note that during the visual back test the analysis label will sometimes show the next update pending label, I can interrogate the label object “HCInfo” and know when an update is scheduled, but without the ability to Sleep() in the Expert Adviser I can’t find a way to suspend the tester until the Hurst Cycles Analysis is updated. Performing a while loop until the label no longer reads ‘Scheduled’ seems to just hang the back test.

On a live chart, I can read the values of the FLD target lines that are created by the FLD indicator (“FLD_target_{fldnumber}_l”), I was hoping to be able test different strategies and perform this with back testing but the targets are not created on the visual chart during back test.

It would be great if the indicators could be updated to work for back testing.

I also appreciate due to CPU demand of the analysis that scheduling of analysis occurs, perhaps an option for the indicator to not schedule the analysis and to make the analysis be be performed synchronously would also help back testing to be performed successfully.


#2

Hi @thedime back testing with the indicators is a very complex issue because of the way in which an analysis works. Unlike most indicators the concept of retrieving a value from the Hurst Cycles indicators in the past is fairly meaningless. For instance, you can ask what the value of a moving average was 20 bars in the past - because that is a calculated value that we can work out at any time. It is a point on a line that is plotted on a chart, and will be the same line and value for each point no matter how far in the future we look back to that point.

However by contrast the Hurst Cycles indicator does not have a fixed “value” for each point (bar or tick). Unlike most indicators the HC indicator is not performing a calculation for each point, but is instead performing an “analysis”. In fact because the analysis is so complex, it is performing only a fraction of an analysis at any moment. Putting all those pieces of analyses together creates the whole analysis. For this reason calling the iCustom function on the HC indicator is not likely to produce meaningful results because as you know that function is used to retrieve the value for an indicator at a particular time in the past, and the HC indicator has no value!

The same is true for the FLD indicator which at any one moment in time will have a value, but that value is entirely dependent upon the analysis information provided by the HC indicator, and so it is an ephemeral value if you like, dependent upon a sequence of actions taken by the HC indicator.

Having said this however. the HC indicator could be adapted to work correctly in a back-testing scenario (disabling the analysis scheduling and so forth), which is probably why you were seeing the diamonds and circles-and-whiskers. However unfortunately the FLD and VTL indicators will not work because of the way they retrieve the information from the HC indicator (which is via channel broadcasts in real time).

It is certainly interesting idea, and worth thinking about!