Help!! Stochastic question

 
Using the following code am I getting the stochastic values from the two previously closed bars (not the current bar)?

extern int KPeriod = 15;
extern int DPeriod = 5;
extern int Slowing = 5;
extern int Method = MODE_EMA;
extern int Price = 1; // 0=Low/High, 1=Close/Close

dStochMainCurr = iStochastic(NULL,0,KPeriod,DPeriod,Slowing,Method, Price, MODE_MAIN, 1);
dStochMainPrev = iStochastic(NULL,0,KPeriod,DPeriod,Slowing,Method, Price, MODE_MAIN, 2);
dStochSignalCurr = iStochastic(NULL,0,KPeriod,DPeriod,Slowing,Method, Price, MODE_SIGNAL, 1);
dStochSignalPrev = iStochastic(NULL,0,KPeriod,DPeriod,Slowing,Method, Price, MODE_SIGNAL, 2);

Much thanks,

Ed
 

Current bar is bar 0, and the stochastic value at bar 0 will be unstable.

dStochMainCurr = iStochastic(NULL,0,KPeriod,DPeriod,Slowing,Method,Price,MODE_MAIN,0);
dStochMainPrev = iStochastic(NULL,0,KPeriod,DPeriod,Slowing,Method, Price, MODE_MAIN, 1);
dStochSignalCurr = iStochastic(NULL,0,KPeriod,DPeriod,Slowing,Method, Price, MODE_SIGNAL, 0);
dStochSignalPrev = iStochastic(NULL,0,KPeriod,DPeriod,Slowing,Method, Price, MODE_SIGNAL, 1);

This will take the values from the current bar and the first completed bar.

 
Thanks.
Reason: