Creating a "yesterday" value.

 

Hello again! I am trying to apply a price average in a yesterday format. Here is what I have;


double DP = (High + Low + Close + Close + Open + Open)/6;
double DP1 = (High + Low + Close + Close + Open + Open)/6, Current + 0;
double DP2 = (High + Low + Close + Close + Open + Open)/6, Current + 1;




Here is an example where my current + 0 worked;


double Buy1_1 = iMA("GBPUSD", PERIOD_M15, periodchange, 0, MODE_SMA, DP, Current + 0);


As you can see, I have the moving average based off of my DP formula, which works just fine. However, I am trying to create a logic where if Today's DP is > or < a set moving average, but setting DP to be relative to the date. Here is what I am shooting for;


Buy Logic;


If Today's DP is > moving average 1 && Yesterdays DP is < moving Average 2, etc etc.


Any pointers on what I can add to my DP formula to help make it reference to today and yesterday?


Thank you in advance!!

Reason: