Datafeed using multiple brokers

 

Hi, I am trying to run the same EA concurrently on 2 different brokers. I realized that due to the different timezones, (broker1 is from UK, broker2 is from Asia) the OHLC data on PERIOD_D1 for the currency pairs are different. I want to standardize my indicator values to OHLC data based on GMT only. (i.e. Using broker1 price feed).

Is there any clever way to do this in the code? I can think of 2 solutions:

(a) On broker1 platform using iOpen, iHigh, iLow, iClose on a lower timeframe (eg. PERIOD_H1) and computing my own OHLC values via a loop that uses the correct time offset value.

(b) On broker1 platform, read in OHLC values that are saved on file from another source that is getting data from GMT timezone.

Both solutions seem to be slow... are there any other solutions out there that I may have missed?


Thanks

 
(a) doesn't have to be slow
for (int shift = Bars-1-IndicatorCounted(); shift >= 0; shift--){
    datetime    now     = Time[shift],
                gmt     = now + Srvr.To.UTC.Hours*3600,
                bod     = gmt - gmt % 86400,
                eod     = bod + 86399;
    int         bodH1   = iBarsShift(NULL, PERIOD_H1, bod),
                eodH1   = iBarsShift(NULL, PERIOD_H1, eod),
                h24     = eodH1 - BodH1 + 1,
                HH      = Highest(NULL, PERIOD_H1, MODE_HIGH, h24, eodH1);
     OpenBuf[shift]     =  iOpen(NULL, PERIOD_H1, bodH1);
    CloseBuf[shift]     = iClose(NULL, PERIOD_H1, eodH1);
     HighBuf[shift]     =  iHigh(NULL, PERIOD_H1, HH);
      LowBuf
}
Untested
 
WHRoeder:
(a) doesn't have to be slow
Untested



Thanks for your this! Yes, I think this will work.... I totally missed iHighest and iLowest, which will save me from making an extra loop... Thanks!