MT5 EA cannot be optimised due to it reading chart objects generated by indicator - Is this true?

 

I decided to ask here before taking some action with having a new EA written or modifying my current one.

Basically my EA that I had developed and converted to MT5 gets its buy/sell signals from an indicator, and to determine TP and SL, it gets some info from the objects the indicator displays on the chart.

The problem is that I want to do some optimization to find the most suitable combination of parameters. I run the optimisation and get some results, but selecting a combination and trying to run a single test on the exact same set of data results in a completely different result. 

I have been told by some developers that this is due to the EA reading objects from the chart, and that during optimisation, there is no chart to read data from, and therefore it is giving incorrect results.

Another developer has mentioned to me there is some issue with the way the EA works with regards to the way the indicator's developer has provided the code to get the signal from the buffer, which is here:

//---- Read values from the signal buffer
int start()
{
// Read signal for this bar
double value = iCustom(Symbol(), Period(), "PZ_DayTrading_LICENSE", 4, 1);
// Do something
if(value == OP_BUY) { /* Your code for bullish signal */ }
if(value == OP_SELL){ /* Your code for bearish signal */ }
if(value == EMPTY_VALUE) { /* Your code if no signal */}
// Exit
return(0);
}

I've attached my EA, if anyone is able to lend some insight, I would greatly appreciate it!

Files:
PZ_EA_MOD.mq5  253 kb