Check this program I am trying to get the values of the Stochastic
Here is the output I got:
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: https://stackoverflow.com/questions/49550100/isnewbar-not-producing-the-right-time-stochastic-value-ontick-mql5
Stochastic calculation to be done at each tick, data retrieve at each new bar :
#include <Lib CisNewBar.mqh> CisNewBar current_chart; // instance of the CisNewBar class: detect new tick candlestick double K[],D[]; // declare it once void OnInit() { int stoch = iStochastic(_Symbol,PERIOD_M1,5,3,3,MODE_SMA,STO_LOWHIGH); // load it once !!!!! ArraySetAsSeries(K,true); // set it once ArraySetAsSeries(D,true); // set it once } void OnTick() { CopyBuffer(stoch,0,0,5,K); // there CopyBuffer(stoch,1,0,5,D); if(current_chart.isNewBar() > 0) { CopyBuffer(stoch,0,0,5,K); // or there ... CopyBuffer(stoch,1,0,5,D); ArrayPrint(K); // ask for value at each new bar } }
Check this program I am trying to get the values of the Stochastic
Here is the output I got:
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: https://stackoverflow.com/questions/49550100/isnewbar-not-producing-the-right-time-stochastic-value-ontick-mql5
Stochastic calculation to be done at each tick, data retrieve at each new bar :
Sorry but I am still get the values, the same as in the question. I don't understand how to fix this issue?
Sorry but I am still get the values, the same as in the question. I don't understand how to fix this issue?
The code is clean. Periods ? SMA/EMA ? On what do you base to say these values are wrong ?
Alain Verleyen:
All is normal. You element 0 is stochastic value at bar 0, so the value at current (new) bar...this value will change until the bar will be close.
What's the point to ask question when you don't follow the answers you got.
How I can get the values of the close bar only, using the current library?
And I didn't got any answer yet. The person is helping me with comments that are of no use as I am unable to understand the meaning. If you have any solution for my issue. Please let me know.
How I can get the values of the close bar only, using the current library?
And I didn't got any answer yet. The person is helping me with comments that are of no use as I am unable to understand the meaning. If you have any solution for my issue. Please let me know.
int stoch = iStochastic(_Symbol,PERIOD_M1,5,3,3,MODE_SMA,STO_CLOSECLOSE); // load it once !!!!!
The code is clean. Periods ? SMA/EMA ? On what do you base to say these values are wrong ?
I guess my code gives clear understanding for your questions.
see I want to have the current value of the line.
See the below image and the related values you will understand what I want and what I am getting.
I tried this too not working for me.
I tried this too not working for me.
Returned value are from a bar to another one.
Display it on tick, you'll see the same values.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Check this program I am trying to get the values of the Stochastic
Here is the output I got:
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: https://stackoverflow.com/questions/49550100/isnewbar-not-producing-the-right-time-stochastic-value-ontick-mql5