Ask for Help: Stochastic

 

Thank you, dear community,

for helping to get my first EA programmed. It is done so far and doing what I expected it to do.

My Question of today is:

How do I retrieve the Stochastic Value of the bar one event before the current event?

Thank you!

ChZ

 

Hi chz

Set shift =1, it's the last parameter in the call.

 
Ruptor wrote >>

Hi chz

Set shift =1, it's the last parameter in the call.

oh my dear god, i have been studying the whole calling command, but this parameter i now see for the first time. just as if it would not have been here before... :)

Thank you very much

 
chz:

Thank you, dear community,

for helping to get my first EA programmed. It is done so far and doing what I expected it to do.

My Question of today is:

How do I retrieve the Stochastic Value of the bar one event before the current event?

Thank you!

ChZ

I would like an EA that use the Stocasstic Oscillator to determine the direction of my trades. I want to base it off of the open and place the trade based off of the %K and %D. If k is higher I will buy and if d is higher I will sell. My question is, " how do I retreive the K and D information so I can place this particular trade......

Thanks in anvance,

 
Ruptor:

Hi chz

Set shift =1, it's the last parameter in the call.


I would like an EA that use the Stocasstic Oscillator to determine the direction of my trades. I want to base it off of the open and place the trade based off of the %K and %D. If k is higher I will buy and if d is higher I will sell. My question is, " how do I retreive the K and D information so I can place this particular trade......

Thanks in anvance,

 

Read This and trie if you understand the coding

double iStochastic( string symbol, int timeframe, int %Kperiod, int %Dperiod, int slowing, int method, int price_field, int mode, int shift)
Calculates the Stochastic oscillator and returns its value.

Parameters:

symbol - Symbol the data of which should be used to calculate indicator. NULL means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.
%Kperiod - %K line period.
%Dperiod - %D line period.
slowing - Slowing value.
method - MA method. It can be any ofMoving Average method enumeration value.
price_field - Price field parameter. Can be one of this values: 0 - Low/High or 1 - Close/Close.
mode - Indicator line index. It can be any of the Indicators line identifiers enumeration value.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).

Sample:
  if(iStochastic(NULL,0,5,3,3,MODE_SMA,0,MODE_MAIN,0)>iStochastic(NULL,0,5,3,3,MODE_SMA,0,MODE_SIGNAL,0))
    return(0);