Help : My program needs the yesterday's close price

 

Hi anyone can help me?

I already reference other programs how to do. They use timeday() function to check if close[i] and close[i+1] are different days.
However, because the time is data server's time. Over 00:00am may not be the next day!

Anybody can help me?

How can MT4 can seperate the dates with dash line on Charts>Properties>Common>Show Period Separators?

I don't know why it is so complicated...

 
here it is:

compute the offset between server time and the timezone you want to adjust the index of previous close. It should be something like this:


i2= i1  +/-  offset_in_hours*60/Period();

if(TimeDay( Time[i1])!= TimeDay(Time[i2+1])) { // time[i] is the datetime associated to close[i]
      // put your code here
}

Check it. I didn't do the test!
 

yesterday's close price


#define yesterday 1
double Yesterday.Close = iClose(Symbol(), Period_D1, yesterday);
 

Thank you very much!

You are very kind programmer that know my needs and solved my problem!

: ) Happy Programming!

 
please help..!!!!
anybody.. help me coding to mql4 ea

for time frame M15 up
open bar +4 pip then buy
open bar - 4 pip then sell
TP 10 pip
SL 10 pip
this ea only run just 1 bar & 1 open position for each bar (which one that done first( open +4 (buy) or open-4 (sell))
and wil continue for the next bar...thank's
 
kintaktak wrote >>

Hi anyone can help me?

I already reference other programs how to do. They use timeday() function to check if close[i] and close[i+1] are different days.
However, because the time is data server's time. Over 00:00am may not be the next day!

Anybody can help me?

How can MT4 can seperate the dates with dash line on Charts>Properties>Common>Show Period Separators?

I don't know why it is so complicated...


Easy...

iclose(NULL,1440,1)
Reason: