How can I get the value of the stochastic %K?

 

Hi, how can I get the value of the stochastic?

I'm using this:

int iStochasticResult1 = iStochastic(_Symbol, PERIOD_CURRENT, Signal_0_Stoch_PeriodK, Signal_0_Stoch_PeriodD, Signal_0_Stoch_PeriodSlow, MODE_SMA, STO_LOWHIGH); //- is a function that returns the symbol name of the current chart.InfoInteger_InfoInteger()_
int iStochasticResult2 = iStochastic(_Symbol, PERIOD_CURRENT, Signal_1_Stoch_PeriodK, Signal_1_Stoch_PeriodD, Signal_1_Stoch_PeriodSlow, MODE_SMA, STO_LOWHIGH); //- is a function that returns the symbol name of the current chart.InfoInteger_InfoInteger()_

And I'm printing the value, but it gives a constant value. How can I get the value of %K? What am I doing wrong?

void OnTick()
  {
   Print("iStochasticResult1 = ", iStochasticResult1);
   Print("iStochasticResult2 = ", iStochasticResult2);

edited: I whant to print the last value.

Stochastic Oscillator - Oscillators - Technical Indicators - Price Charts, Technical and Fundamental Analysis - MetaTrader 5 Help
  • www.metatrader5.com
The Stochastic Oscillator Technical Indicator compares where a security’s price closed relative to its price range over a given time period. The...
 
William Roeder #:

Perhaps you should read the manual, especially the examples.
   How To Ask Questions The Smart Way. (2004)
      How To Interpret Answers.
         RTFM and STFW: How To Tell You've Seriously Screwed Up.

They all (including iCustom) return a handle (an int). You get that in OnInit. In OnTick/OnCalculate (after the indicator has updated its buffers), you use the handle, shift and count to get the data.
          Technical Indicators - Reference on algorithmic/automated trading language for MetaTrader 5
          Timeseries and Indicators Access / CopyBuffer - Reference on algorithmic/automated trading language for MetaTrader 5
          How to start with MQL5 - General - MQL5 programming forum - Page 3 #22 (2020)
          How to start with MQL5 - MetaTrader 5 - General - MQL5 programming forum - Page 7 #61 (2020)
          MQL5 for Newbies: Guide to Using Technical Indicators in Expert Advisors - MQL5 Articles (2010)
          How to call indicators in MQL5 - MQL5 Articles (2010)

having trouble with this language ...


is there something like to python to get the last of an array (as in python  var[-1])?

Reason: