RefreshRstes vs ChartRedraw() finctions

 
What are the basic differences between RefreshRates() and ChartRedraw() functions.

Does ChartRedraw(ID) update the chart timeframe of non current chartd?, as much as it updates chart objects?
 
macpee: What are the basic differences between RefreshRates() and ChartRedraw() functions. Does ChartRedraw(ID) update the chart timeframe of non current chartd?, as much as it updates chart objects?

When in doubt, please refer to the documentation ...

RefreshRates

Refreshing of data in pre-defined variables and series arrays

Timeseries and Indicators Access

ChartRedraw

Calls a forced redrawing of a specified chart

Chart Operations

 
Fernando Carreiro #:

When in doubt, please refer to the documentation ...

RefreshRates

Refreshing of data in pre-defined variables and series arrays

Timeseries and Indicators Access

Better be careful with this thing😄

Otherwise, you may not notice that the arrival of a new bar has shifted the indexing

void OnTick()
  {
   datetime time0Before = Time[0];
   Alert(StringFormat("Before sleep: current %s, bar0 %s", toStr(TimeCurrent()), toStr(time0Before)));
   Sleep(61000);
   Alert(StringFormat("After sleep: current %s, bar0 %s", toStr(TimeCurrent()), toStr(Time[0])), ", same as before ", time0Before == Time[0]);
   RefreshRates();
   Alert(StringFormat("After RefreshRates: current %s, bar0 %s", toStr(TimeCurrent()), toStr(Time[0])), ", same as before ", time0Before == Time[0]);
   ExpertRemove();
  }

string toStr(datetime time)
  {
   return(TimeToString(time, TIME_MINUTES));
  }


After RefreshRates: current 17:56, bar0 17:56, same as before false
After sleep:        current 17:56, bar0 17:55, same as before true
Before sleep:       current 17:55, bar0 17:55

 
Vladislav Boyko #:
Otherwise, you may not notice that the arrival of a new bar has shifted the indexing

It will also update the indicators

(the test was performed on M1 to catch a new bar)

void OnTick()
  {
   Alert(StringFormat("Before sleep: current %s, MA1 %s", toStr(TimeCurrent()), getMa1Str()));
   Sleep(61000);
   Alert(StringFormat("After sleep: current %s, MA1 %s", toStr(TimeCurrent()), getMa1Str()));
   RefreshRates();
   Alert(StringFormat("After RefreshRates: current %s, MA1 %s", toStr(TimeCurrent()), getMa1Str()));
   ExpertRemove();
  }

string getMa1Str()
  {
   return(DoubleToString(iMA(Symbol(), PERIOD_CURRENT, 1, 0, MODE_SMA, PRICE_OPEN, 1), Digits()));
  }

string toStr(datetime time)
  {
   return(TimeToString(time, TIME_MINUTES));
  }

After RefreshRates: current 18:16, MA1 1.07958
After sleep:        current 18:16, MA1 1.07975
Before sleep:       current 18:15, MA1 1.07975
 

Anyone knows of a function that refresh non current bars which someone has coded?

 
macpee #:
non current bars

What does this mean?

What exactly do you want to refresh?

 
Vladislav Boyko #:

What does this mean?

What exactly do you want to refresh?

It means that I want to refresh non current charts using their ID's. I know Refreshrates() is used for refreshing the market data of current chart, but not that of non current charts. But I have come across a block of codes used to refresh non current chat somewhere, only the person did not give any guarantee that it would work.

 
macpee #: It means that I want to refresh non current charts using their ID's
  1. There is nothing to refresh. RefreshRates only applies to predefine variables and predefined arrays, and they are only apply to the current chart.

  2. On MT4: Unless the current chart is that specific symbol(s)/TF(s) referenced, you must handle 4066/4073 errors before accessing candle/indicator values.
              Download history in MQL4 EA - MQL4 programming forum - Page 3 #26.4 (2019)

 
macpee #: It means that I want to refresh non current charts using their ID's. I know Refreshrates() is used for refreshing the market data of current chart, but not that of non current charts. But I have come across a block of codes used to refresh non current chat somewhere, only the person did not give any guarantee that it would work.
You have edited your post, but it is still unclear and nonsensical.