How do I write code to compare current value and previous value of stochastic line

 
I want to say current value minus previous value is equal to or more/less than a certain value. How do I do it
 
marasha How do I do it

Exactly as you said. Get the current, get the previous, if( MathAbs( current - previous ) < certain ) doWhatever.

 

An example of how to create an indicator handle in MQL5 and how to get the value of the 'Stochastic' indicator:

An example of get values from the iStochastic indicator

How to start with MQL5
How to start with MQL5
  • 2020.04.09
  • www.mql5.com
This thread discusses MQL5 code examples. There will be examples of how to get data from indicators, how to program advisors...
 
William Roeder #:

Exactly as you said. Get the current, get the previous, if( MathAbs( current - previous ) < certain ) doWhatever.

***

this is my code, how do I make that in red work, what needs to be changed? sorry, am quite lay and trying to learn. Please help

 
Why don't you use CopyBuffer function?
This website uses cookies. Learn more about our Cookies Policy.