MQL4 - automated forex trading   /  

Forum

Stochastic Oscillator value

Back to topics list  | 1 2 To post a new topic, please log in or register

avatar
17
samjesse 2007.10.17 03:15 

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

article

A Trader's Assistant Based on Extended MACD Analysis

Script 'Trader's Assistant' helps you to make a decision on opening positions, based on the extended analysis of the MACD status for the last three bars in the real-time trading on any timeframe. It can also be used for back testing.


avatar
2462
phy 2007.10.17 03:28 

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


avatar
17
samjesse 2007.10.17 03:59 
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) );



avatar
2462
phy 2007.10.17 04:44 

"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.


avatar
17
samjesse 2007.10.17 05:07 
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. |
//| http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link "http://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



avatar
2462
phy 2007.10.17 06:00 

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?


avatar
17
samjesse 2007.10.17 12:09 
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

avatar
2462
phy 2007.10.17 12:54 
samjesse wrote:
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) );


avatar
17
samjesse 2007.10.17 14:00 
thanks alot, that fixed it.


avatar
3
rbt 2009.02.14 16:32 
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.


avatar
316
blogzr3 2009.02.14 16:52 
rbt wrote >>

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().

Back to topics list   | 1 2  

To add comments, please log in or register