Sirs,
In connection with another problem, I am trying to create an array whose contents are the previous hourly closing values of the EURUSD. I have code as follows:
void Trade()
{
double longThresh = this.longThreshold;
double longTP = this.longTakeProfit;
double longSL = this.longStopLoss;
double shortThresh = this.shortThreshold;
double shortTP = this.shortTakeProfit;
double shortSL = this.shortStopLoss;
int dummyIndex = 0;
Print( "Triggered reload of stack data for trading routine" );
this.stackArray[0] = iClose( "EURUSD", PERIOD_H1, 1 );
this.stackArray[1] = iClose( "EURUSD", PERIOD_H1, 2 );
this.stackArray[2] = iClose( "EURUSD", PERIOD_H1, 3 );
this.stackArray[3] = iClose( "EURUSD", PERIOD_H1, 4 );
this.stackArray[4] = iClose( "EURUSD", PERIOD_H1, 5 );
this.stackArray[5] = iClose( "EURUSD", PERIOD_H1, 6 );
this.stackArray[6] = iClose( "EURUSD", PERIOD_H1, 7 );
this.stackArray[7] = iClose( "EURUSD", PERIOD_H1, 8 );
this.PrintStackArray();
}
The function above is actually an object method. The Object is instantiated, and a do-while
loop causes the method above to be re-executed every hour at the five minute mark.
The problem is that when the code above executes an hour later, the PrintStackArray()
output indicates that the iClose()
function is not keeping up with new candlesticks every hour.
To put it another way, if the code were to execute at 5:05, it would give the same output as it would at 6:05, and in turn give identical output at 7:05.
I cannot for the life of me figure out why re-executing the iClose()
functions does not update the array with the new candlestick values. Despite over two weeks of tinkering with this issue, I cannot force my EA to update and recognize new candlestick values.