Bcktest doesn't work ERROR 4202

 

Hey Guys,


Can someone please explain to me why I always get ERROR 4202 whilst backtesting. I use two indicators drawing trend lines and horizontal lines. Apparently the EA is not able to process the those objects. Many thanks for any help. See the attached files. 

 

Graphical objects are slowing down the performance, what if the indicator saves the prices of its horizontal lines as global variables and your ea request their value this way?

 
Carl Schreiber:

Graphical objects are slowing down the performance, what if the indicator saves the prices of its horizontal lines as global variables and your ea request their value this way?


Thanks for the quick reply! I wasn't aware of this. I'll try to modify the EA like you said. Do you know if there are any articles related to this topic? I couldn't find any.

 
Traderole:

Thanks for the quick reply! I wasn't aware of this. I'll try to modify the EA like you said. Do you know if there are any articles related to this topic? I couldn't find any.

Or you can provide the actual price of the by one of the buffer of the indicator so its value can be requested via iCustom(..) - may be the better solution.
 
Carl Schreiber:
Or you can provide the actual price of the by one of the buffer of the indicator so its value can be requested via iCustom(..) - may be the better solution.

I didn't get that right.. You think it's better to store the object prices in a buffer and then call them via iCustom()? 


Just for my understanding... why does the EA issue ERROR 4202 actually? That error means "object does not exist". So how is that possible though the lines are in the chart and even it arises when creating trend or other lines? 

 
Just for my understanding... why does the EA issue ERROR 4202 actually? That error means "object does not exist". So how is that possible though the lines are in the chart and even it arises when creating trend or other lines?

As the optimization runs "off-chart" I simply assume that nothing is drawn - maybe that is written somewhere, but I have no idea where.


I didn't get that right.. You think it's better to store the object prices in a buffer and then call them via iCustom()?

Indicators can have buffers to store their values and the values of theses buffers on an custom-indicator can be get via the function iCustom(..).

Take a working indicator like the simple MACD and study it! And then read in the reference about iCustom() ho to use it!

Reason: