isNewBar() not producing the right time Stochastic value onTick MQL5

Check this program I am trying to get the values of the Stochastic

#include <Lib CisNewBar.mqh>
CisNewBar current_chart; // instance of the CisNewBar class: detect new tick candlestick

void OnTick()
if(current_chart.isNewBar() > 0)
int stoch = iStochastic(_Symbol,PERIOD_M1,5,3,3,MODE_SMA,STO_LOWHIGH);
double K[],D[];

Here is the output I got:

95.97315 90.40000 74.11765 49.25373 25.00000
73.68421 81.87919 90.40000 74.11765 49.25373
74.34211 80.70175 81.87919 90.40000 74.11765
90.24390 78.94737 80.70175 81.87919 90.40000
78.33333 84.05797 78.94737 80.70175 81.87919

The above values represents Array elements as 0th, 1st,2nd,3rd & 4th
What is the 0th in the initial print will become the previous for the next and will be placed at the 1st position in the next print.
But I see the values has changed and is drastic.

Previously the iStochastic() was giving the right and correct values. But it was working OnTick()and hence was giving the output for every change. I only need the values when the bar is complete or after minute. So, I tried the solution from the community. Here is the link: solution for newbar

But the output is infront and is changing the equation of my trade which is why I am losing it.

Please help me. How I can make it work for me?

Here are the files needed: Lib CisNewBar.mqh

Placed the same questioon here:

//±-----------------------------------------------------------------+ //| Lib CisNewBar.mqh | //… -