pivot for date

 

hello all i need code help to get the pivot for date in history which i put it manual

i make this code :

extern int dd = 28;
extern int mm = 11;
extern int yy = 2007;

-----------------------

double H2,L2,C2,Py;
H2=iHigh("EURUSD",PERIOD_D1,2);
L2=iLow(NULL,PERIOD_D1,2);
C2=iClose(NULL,PERIOD_D1,2);
Py = NormalizeDouble(((H2+L2+C2)/3),Digits);

i want to replace the '2' value with the int date-2 days

what's the code ? or if any easy code to calculate pivot for any day in past

i need help plz

thanks

 
string       strDate  = "2007.6.15";
datetime     dDate    = StrToTime(strDate);
int          shift    = iBarShift(Symbol(), PERIOD_D1, dDate);
 
H2 = iHigh("EURUSD",PERIOD_D1,shift);
 

thabks alot for this code

i need to get the date- 1 day in coding

ex: double H2,L2,C2,Py;
H2=iHigh("EURUSD",PERIOD_D1,date-1);
L2=iLow(NULL,PERIOD_D1,date-1);
C2=iClose(NULL,PERIOD_D1,date-1);

 

1 day = 86400 seconds

Time is in seconds in MT4

date-1 day is date-86400

 
arabifx:

this's the master code on pivote point :

double H2,L2,C2,Py;
H2=iHigh("EURUSD",PERIOD_D1,2); ====> mean pervious yesterday
L2=iLow(NULL,PERIOD_D1,2); ====> mean pervious yesterday
C2=iClose(NULL,PERIOD_D1,2); ====> mean pervious yesterday
Py = NormalizeDouble(((H2+L2+C2)/3),Digits);


//---- Definitiion of Pivots Today with it's Pivot Levels
double H1,L1,C1,Ot,Pt;
H1=iHigh(NULL,PERIOD_D1,1); ====> mean yesterday
L1=iLow(NULL,PERIOD_D1,1); ====> mean yesterday
C1=iClose(NULL,PERIOD_D1,1); ====> mean yesterday
Pt = NormalizeDouble(((H1+L1+C1)/3),Digits);

Ot=iOpen(NULL,PERIOD_D1,0); ===> mean today

i want to replace 0,1,2 with dates in the past

im replace 0 number with your code (shift) and working done now i need to replace 1 and 2 with code mean date-1 working day and date-2 working days

(i mean by working day dosnt include suterday and sunday)

i need it in code please and thank you again for your help

 

shift-1

shift-2

etc

 

got error

 

"i want to replace 0,1,2 with dates in the past im replace 0 number with your code (shift)
and working done now i need to replace 1 and 2 with code mean date-1 working day and date-2 working days"

That would be shift+1 shift+2 (going back in time) ... sorry

 

Thankssssssssssssssssssssssss You alot

working done

i got it wowwwwwwwww

 

how to make the program off today and working in the past only ?

im using this code but dosnt working

string expire_date = "2007.11.30";

datetime dDate = StrToTime(expire_date);

if (CurTime() == dDate)

{
Alert ("You Can check past data only");
return(0);
}

 

Try

if (CurTime() <= dDate)

Reason: