En vous remerciant d’avance de votre attention, je vous prie de croire, à l’assurance de ma sincère considération.
http://192.168.0.11:81/cgi-bin/luci/;stok=212b2ca4e7263e464f762b748bbf278c/expert/maintenance
int GetRatesLC(int start_pos,int len,MqlRates &rates[],ENUM_TIMEFRAMES base_period,int& shift)
{
//--- number of basic timeframes contained in the current one int k=PeriodSeconds()/PeriodSeconds(base_period);
if(k==0)
return(-1);//basic timeframe specified incorrectly
//---
MqlRates r0[];
ArrayResize(rates,len);
if(CopyRates(_Symbol,_Period,start_pos,1,r0)=0)
{
//--- fixed shift
if(shift=k)
sh = 0;
}
else
return(-2);//shift specified incorrectly //--- opening time of the basic period bar, which is the beginning of the current period bar formation
//--- synchronization of the time of opening bars takes place relative to the tO time
datetime tO;
//--- closing time of the bar under formation, i.e. opening time of the last bar of basic timeframe in the series
datetime tC;
tO=r0[0].time+sh*PeriodSeconds(base_period);
if(tO>TimeCurrent())
tO-=PeriodSeconds();
tC=tO+PeriodSeconds()-PeriodSeconds(base_period);
if(tC>TimeCurrent())
tC=TimeCurrent();
int cnt=0;
while(cnt<len)
{
ArrayFree(r0);
int l=CopyRates(_Symbol,base_period,tC,k,r0);
if(ltC)
tO-=PeriodSeconds();
//--- the time values of tO and tC have actual meaning for the bar under formation int index=len-1-cnt;
rates[index].close=0;
rates[index].open=0;
rates[index].high=0;
rates[index].low=0;
rates[index].time=tO;
for(int i=0; i=tO && r0[i].time r0[i].low)
rates[index].low=r0[i].low;
if(rates[index].high < r0[i].high)
rates[index].high=r0[i].high;
}
rates[index].close=r0[i].close;
}
//--- specifying closing time of the next bar in the loop
tC=tO-PeriodSeconds(base_period);
//
cnt++;
}
if(cnt<len)
{
//-- less data than required, move to the beginning of the buffer
int d=len-cnt;
for(int j=0; j<cnt; j++)
rates[j]=rates[j+d];
for(int j=cnt;j 21:01), will have different indexes.

Phantom bar

Fig. 4. Phantom bar 2014.10.26 at 23:01

3. Indicator Implementation
Let us write an indicator displaying a "liquid chart" in a separate window. The indicator should work in all three modes: the static shift mode, dynamic shift in the bar opening mode and dynamic shift in the bar closing mode. The indicator also has to have control elements for changing modes and the shift value without a necessity to call the indicator parameters dialog.

For a start we shall use the GetRatesLC() function from the liquidchart.mqh file. We shall call it from the RefreshBuffers() function, which, in its turn, is called from the OnCalculate function. It can also be called from OnChartEvent, provided that some alterations in the mode or the shift and recalculation of the indicator buffers are required. The OnChartEvent function will be handling pressing the buttons and changing the values of the shift and the mode.