I am writing my first EA (again!). I am trying to simulate an existing MT4 indicator so I can confirm my calculations are correct. So I am trying to calculate the ichi-moku calculations for Hourly and Daily in one EA and compare my results to the packaged MT4 one.

My issue issue is, when running my EA from MetaEditor, if I set Tools->Options->Debug to my currency, GBPUSD for example, and Hourly timeframe then my PERIOD_H1 calculations are correct and my PERIOD_D1 are "off". After multiple fruitless trawls for a bug I just changed the Tools->Options->Debug to GBPUSD and Daily and voila my PERIOD_D1 calculations are correct but my PERIOD_H1 calculations are now "off"

When I'm making my calculations I am calling the same piece of code (OO class function), I just change the timeframe from PERIOD_H1 to PERIOD_D1. Am i doing something wrong? This implies that to get the correct value I need to run my EA and calculations against one timeframe only _ I presume this implication is incorrect!

for example, all calculations are "timeframe generic" like below:

//+------------------------------------------------------------------+//+ Calculate the highest high over last $periods number of candles//+ timeframe -- timeframe of the currency//+ periods -- number of canldes to look back//+ offset -- number of bars from current candle to start calculations//+-------------------------------------------------------------------+double MyObject::getHigh(int timeFrame,int periods,int offset)
{
stringdescription="MyObject.getHigh(): ";double valHigh;
//--calculate high, last $periods full candlesdatetime time=iTime(EA_CURRENCY,timeFrame,offset);
string timeAsString=TimeToStr(time,TIME_DATE|TIME_MINUTES);
Print("Getting highest high of last ",periods," bars, starting at offset of: ",offset, "timeframe of starting bar is: ",timeAsString);
int val_indexHigh=iHighest(EA_CURRENCY,timeFrame,MODE_HIGH,periods,offset);
if(val_indexHigh!=-1) valHigh=High[val_indexHigh];
elsePrintFormat(description,"Error in call iHighest. Error code=%d",GetLastError());
datetime timeOfHighest=iTime(EA_CURRENCY,timeFrame,val_indexHigh);
string timeAsStringOfHigh=TimeToStr(time,TIME_DATE|TIME_MINUTES);
Print(description,"Unnormalised Highest price on the : ",timeFrame," timeframe over the last ",periods," candles at an offset of ",offset," is: ",valHigh," bar is: ",timeAsStringOfHigh);
valHigh=normaliseDouble(valHigh,5);
Print(description,"Highest price on the : ",timeFrame," timeframe over the last ",periods," candles at an offset of ",offset," is: ",valHigh);
return valHigh;
}