How can I find the Bars number corresponding to different time zone

1
How can I find the Bars number corresponding to different time zone at the same time in a piece of code running on the 5 minute chart.
OPenTF15=iClose(Symbol(),15,i]; how can I find the value corresponding to the i value in the 5 minute chart in the code.
If i=25 in the 5-minute chart, using it as i=25 in m15 will return an incorrect result.

Code: Select all

void OnStart()
  {
//---
  int total=2543;
    for(int i=0;i<total;i++)
      {
       double OpenTF5=Open[i];

       double OPenTF15=iClose(Symbol(),15,i]; // how do find this Bars numbers on TFm15
        
      }
   
  }


Re: How can I find the Bars number corresponding to different time zone

2
mbastem wrote: Sat Sep 18, 2021 4:29 am How can I find the Bars number corresponding to different time zone at the same time in a piece of code running on the 5 minute chart.
OPenTF15=iClose(Symbol(),15,i]; how can I find the value corresponding to the i value in the 5 minute chart in the code.
If i=25 in the 5-minute chart, using it as i=25 in m15 will return an incorrect result.

Code: Select all

void OnStart()
  {
//---
  int total=2543;
    for(int i=0;i<total;i++)
      {
       double OpenTF5=Open[i];

       double OPenTF15=iClose(Symbol(),15,i]; // how do find this Bars numbers on TFm15
        
      }
   
  }
if you know a valid range of values use [start and end values in an if statement ] to limit your operations https://book.mql4.com/operators/if
also [print function ] might be useful
https://www.mql5.com/en/docs/common/print

regards


Who is online

Users browsing this forum: ChatGPT [Bot], ParallelNative, RodrigoRT7, Ruby [Bot] and 119 guests