Chart Object works fine in Visual test but returns no values in backtest
Chart Object works fine in Visual test but returns no values in backtest
There is no chart to put the objects on.
Ok, that does make sense. Is there a workaround you can suggest? Does it need to be in the form of an indicator?
Thank you
There is no chart to put the objects on.
Further digging around the MQL manuals, I found this page https://docs.mql4.com/runtime/testing
In it, there is this section
During visualization, the Expert Advisor interacts with a real chart. In case there is no visualization, the Expert Advisor works with a "virtual" chart that is not displayed. The former case has some peculiarities. During optimization, working with graphical objects is not supported.
Unfortunately it doesn't give guidance on how to get workaround it
Thanks
- docs.mql4.com
Hi,
I've written a piece of code that creates a linear regression object on the chart based recent swings. I then need to use the values from the upper and lower channel in my trade criteria. When I run it in visual backtest mode, everything works fine. When I turn off the visual mode, it stops working. Instead of returning the values of the lines as it did in visual mode, it returns 0.
Below is the code used to create the object where swinghighdate is an array containing the bar the swing occurred on. This is sending correct information verified by Journal
Below is the code I use to get the value of the channels for the last bar
I'm not sure how to solve this. Is it a problem with the RAY_RIGHT not extending and therefore there is no channel at that value? Or am I missing something obvious?
Any help would be appreciated
Thanks