1

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.

1 Answer 1

1

This may happen uder such condition,
that the code was being run without a live-feed of events from market, using just a localhost time-bound triggered Object method invocation ( which was not disclosed as an MCVE above ) thus forever showing the same time-series data head, which under such conditions simply get no live-feed updates, yielding the same [1,2,3,..] values forever:

if ( !IsConnected() )
{     Print( "No connection!" );
      return( 0 );
      }

may validate your EA state against a live server.

2
  • Thank you for your response. In the event that I validate my EA state against the live server and find out that there is no live feed, how to I re-establish a live feed? In essence, how do I fix the problem so that I can get continuous live-feed data?
    – the_photon
    Commented Feb 20, 2017 at 18:35
  • Because of the uncontrollable levels of risk of mis-use, all the connection / login activities are restricted to a set of manual, human-to-broker, interactions ( login identity, trading-server selection,access-credentials provisioning ). So such an exception-handler may send you an email, but a live human being has to click and assist the Terminal to re-log-in. Commented Feb 21, 2017 at 8:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.