Standard indicators override?! - page 3

 
Rosh, what I'm trying to figure out is whether the error occurs because the USDCHF bar starts later. To track this, I have removed the MA (it only gets in the way), and introduced additionally Close[1] and Open[1]. Meaning that Open[1] will always be correct, and if this is the problem, the discrepancy will be in Open[0] and Open[1] will not. Checking now. What did I miss?
 
Well, I attached 2 pictures, which show that when a new bar appears on GBPJPY you are referring to old unchanged USDCHF chart data, and therefore your algorithm calculates incorrectly. It will count correctly only in one case - if you put it on the native "chart" - but the goal is the opposite.
 
I agree. But only if testing with Open[1] shows that there are no errors. In that case I will be sure that yes, there is no bug in MT. There is a certain... understatement, as it were.

Plus, the challenge is to find a way around the limitation. Say, prohibit redrawing of EURUSD indicator until USDCHF data arrives. Now I am testing the following variant

while(nPos > 1 || (nPos == 1 && Time[0] <= iTime("USDCHF", 0, 0)))



But it all depends on how MT calculates IndicatorCounted. If by tick arrival time - it won't work, if by the fact of bar re-drawing - it will work. Let's see.

 
Here it is now 11-56 MSK or 9-56 server time.
Open[1] EURUSD H1 is 1.2755
Open[1] USDCHF H1 is 1.2443

A new one hour bar appears on the EUR, nothing has changed yet on the Franc. What will your algoitm do?
 
I agree. But only if тестирование with Open[1] shows that no error occurs. In that case I will be sure that yes, there is no bug in MT. There is a certain... reticence or something.

Plus, the challenge is to find a way around the limitation. Say, prohibit redrawing of EURUSD indicator until USDCHF data arrives. Now I am testing the following variant

while(nPos > 1 || (nPos == 1 && Time[0] <= iTime("USDCHF", 0, 0)))



But here everything depends on how MT calculates the IndicatorCounted. If by tick arrival time - it will not work, if by the fact of bar re-drawing - it will work. Let's see.




Stop, stop. Here's where you write :
As you can see from the code, the indicator does not depend on the currency it is attached to. It always works for USDCHF. We attach the indicator to two charts, in my case AUDUSD and EURUSD, but I suppose you can attach it to any chart. We leave it for a few days. And we see that the charts are DIFFERENT. The same indicator. Real time. The same MT. Redraw forcibly (Disconnect - Connect) - they become the same. For some time.

So we're talking about online work, and now we've jumped to a tester. I don't have time for that.
 
The time is now 11-56 MSK or 9-56 server time. <br / translate="no"> Open[1] EURUSD H1 is 1.2755
Open[1] USDCHF H1 is 1.2443

A new hourly bar appears on the EUR, nothing has changed yet on the FRANK. What will your algoitm do?



Yes, you are right. You have to watch the time of the bar, not its number.
 
<br / translate="no"> So we're talking about online work and now we've jumped to a tester. I don't have time for that.


No tester. Only online.
 
deleted
 
Dear Rosh, could you please explain how the following situation is possible.
I have outputted it to the second file of the list of bars to be able to see the dropdowns.

//+------------------------------------------------------------------+
//|                                             RedrawIndicators.mq4 |
//|                                                           Satori |
//|                             http://www.metaquotes.ru/forum/7790/ |
//+------------------------------------------------------------------+
#property copyright "Satori"
#property link      "http://www.metaquotes.ru/forum/7790/"

#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_color3 Yellow
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
extern int       BarsCount=0;   //кол-во считаемых баров, если 0 - то все
extern string    Currency1="EURUSD";
extern string    Currency2="GBPUSD";

int handle,handle2;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexLabel(0,Currency1);

   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexLabel(1,Currency2);

   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,ExtMapBuffer3);

   handle= FileOpen("TestFile.csv",FILE_CSV|FILE_WRITE,';');
   handle2= FileOpen("TestFile2.csv",FILE_CSV|FILE_WRITE,';');
  if(handle<1 || handle2<1 )
   {
    Print("Файл не обнаружен, последняя ошибка ", GetLastError());
    return(false);
   }
   else
   {
   FileWrite (handle,"index",Symbol(),"index",Currency1,"index",Currency2);
   FileWrite (handle2,"index",Currency1,Currency2,Symbol());
   }

   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   FileClose(handle);
   FileClose(handle2);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
   int i;
   int test1,test2;
   datetime tt1,tt2,TimeMain;
   BarsCount=MathMin(Bars,(MathMin(iBars(Currency1,Period()),iBars(Currency2,Period()))));
   Print (Bars," ",iBars(Currency1,Period())," ",iBars(Currency2,Period()));
   Print (BarsCount);
   
   for (i=0;i<BarsCount-counted_bars;i++)
      {
       TimeMain=Time[i];
       test1=iBarShift(Currency1,Period(),TimeMain);
       test2=iBarShift(Currency2,Period(),TimeMain);
       
       ExtMapBuffer1[i]=iTime(Currency1,Period(),test1);
       ExtMapBuffer2[i]=iTime(Currency2,Period(),test2);

       ExtMapBuffer3[i]=(ExtMapBuffer1[i]-ExtMapBuffer2[i]);
       tt1=Time[i]-ExtMapBuffer1[i];
       tt2=Time[i]-ExtMapBuffer2[i];
       if (ExtMapBuffer3[i]!=0 || tt1!=0 || tt2!=0) 
         {
         if (FileWrite (handle,
         i,TimeToStr(Time[i]),iBarShift(Currency1,Period(),TimeMain),TimeToStr(ExtMapBuffer1[i]),iBarShift(Currency2,Period(),TimeMain),TimeToStr(ExtMapBuffer2[i])
          )<=0) Print("нифига не пишет!!");
         }
        FileFlush(handle);
        if (FileWrite (handle2,i,
         TimeToStr(iTime(Currency1,Period(),test1)),
         TimeToStr(iTime(Currency2,Period(),test2)),
         TimeToStr(Time[i])
          )<=0) Print("нифига не пишет!!");
        FileFlush(handle2);

      }//----
   return(0);
  }
//+------------------------------------------------------------------+



We run it on EURGBP 4H on two other brokerages, not Alpari (MIG, FIBO).
The picture is almost the same for both, I will show an example on MIG.
index EURGBP index EURUSD index GBPUSD
15 30.10.2006 0:00 16 29.10.2006 23:00 16 29.10.2006 23:00
46 23.10.2006 0:00 47 22.10.2006 23:00 47 22.10.2006 23:00
77 16.10.2006 0:00 78 15.10.2006 23:00 78 15.10.2006 23:00
108 09.10.2006 0:00 109 08.10.2006 23:00 109 08.10.2006 23:00
139 02.10.2006 0:00 139 02.10.2006 0:00 140 01.10.2006 23:00

Take for example bars 46-47.
In the second file:
45 23.10.2006 4:00 23.10.2006 4:00 23.10.2006 4:00
46 22.10.2006 23:00 22.10.2006 23:00 23.10.2006 0:00
47 22.10.2006 23:00 22.10.2006 23:00 22.10.2006 23:00
48 20.10.2006 20:00 20.10.2006 20:00 20.10.2006 20:00

Seems to be ok... But here is the problem - bar 23.10.2006 00:00 is present in history on all three currencies! I.e. it is on the chart, it is in the quotes archive.
But it seems to be absent from the indicator.
And the last trick - if you try to put a vertical line on this bar it will shift to the next bar. :о) I tried to mark it with a vertical line but it didn't work.



 
Would you mind making it into a picture? A screenshot. It's hard to arrange the columns in your mind.
Reason: