Stochastic Oscillator value

 

Hi

I plotted the Stochastic Oscillator from the Indicators folder shipped with MetaTrader version 4 build 210 and wanted to use its values in a my code. so I found

double iStochastic(string symbol, int timeframe, int %Kperiod, int %Dperiod, int slowing, int method, int price_field, int mode, int shift)

But the above function does not give the same exact values I see plotted on the indicator window on my chart.

The arguments “method, price_field and mode” are not inputs in the indcator parameters from the custom window but they are given as arguments in the function.

How can I get the values from the Stochastic Oscillator I have plotted on the chart to use in my code?

Thanks a lot

 

You might use iCustom() to access the indicator that is on the chart

 
when I use iCustom() and give it the indicator name as suggested buy the help files. it gives
'Stochastic' - variable not defined

here is how I used it in the code.
iCustom(NULL, 0, Stochastic, 25, 7, 2, 1, 0) );
 

"But the above function does not give the same exact values I see plotted on the indicator window on my chart."

double iCustom( string symbol, int timeframe, string name, ..., int mode, int shift)

Calculates the specified custom indicator and returns its value. The custom indicator must be compiled (*.EX4 file)
and be in the terminal_directory\experts\indicators directory. Use the name of the indicator that you attached to the chart.


If the name is SuperStochasticBombasticator, you use that (minus the . ex4 suffix).

name - Custom indicator compiled program name.

Note that if the indicator has "inputs", you have to put all the inputs into the iCustom() command.

... - Parameters set (if necessary). The passed parameters and their order must correspond with the desclaration order and the type of extern variables of the custom indicator.

 
here are the info from my PC, I don't know where I went wrong.

then name:
=======
C:\Program Files\FXDD - MetaTrader 4\experts\indicators\Stochastic.ex4
so I used the name Stochastic

the extern values:
===========

//+------------------------------------------------------------------+
//| Stochastic. mq4 |
//| Copyright © 2004, MetaQuotes Software Corp. |
//| https://www.metaquotes.net// |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link "https://www.metaquotes.net//"

#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 100
#property indicator_buffers 2
#property indicator_color1 LightSeaGreen
#property indicator_color2 Red
//---- input parameters
extern int KPeriod=5;
extern int DPeriod=3;
extern int Slowing=3;
//---- buffers
 

Well, what do you want to do..

Use the iStochastic() function or use iCustom() to get values that you like from the indicator you see on chart?

 
the indicator on the chart is the standard built_in Stochastic Oscillator. thus I see no custom indicator on the chart. therefore I expected to optain the indicator values using the iStochasic function.
here is a scren shot
http://www.mediafire.com/imageview.php?quickkey=4sr2znhutnn&thumb=4
 
samjesse:
when I use iCustom() and give it the indicator name as suggested buy the help files. it gives
'Stochastic' - variable not defined

here is how I used it in the code.
iCustom(NULL, 0, Stochastic, 25, 7, 2, 1, 0) );



Sorry, my eye was not sharp earlier...

You must enclose the name in quotes becuase you are using a literal string for the parameter...

iCustom(NULL, 0, "Stochastic", 25, 7, 2, 1, 0) );

 
thanks alot, that fixed it.
 
samjesse wrote >>
the indicator on the chart is the standard built_in Stochastic Oscillator. thus I see no custom indicator on the chart. therefore I expected to optain the indicator values using the iStochasic function.
here is a scren shot
http://www.mediafire.com/imageview.php?quickkey=4sr2znhutnn&thumb=4

Hi,

I have exactly the same question. How can I get the value of standard built-in Stochastic Oscillator? because I can see it's better than using iStochastic() function.

 
rbt:

Hi,

I have exactly the same question. How can I get the value of standard built-in Stochastic Oscillator? because I can see it's better than using iStochastic() function.

The standard built-in Stochastic Oscillator is iStochastic().

Reason: