equivalent indicator command in cAlgo (MT4 istochastic)

Created at 28 Nov 2013, 15:45
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
BO

bodleytunes

Joined 28.11.2013

equivalent indicator command in cAlgo (MT4 istochastic)
28 Nov 2013, 15:45


Hi folks!

I have a robot I'm trying to re-write in cAlgo which is in MQL4 robot.

I'm currently trying to replicate two calls to the iStochastic indicator which differ slightly.  Then the result of each call is compared to one another and the program continues depending on whether the results from one call is greater than the other one.

There is a parameter on the MQL4 version called MODE_MAIN and MODE_SIGNAL, and I cannot see exactly how I would reproduce these different parameters with the cAlgo stochastic indicator.

Basically the line is 

if (iStochastic(Symbol(),PERIOD,12,3,3,MODE_SMA,1,MODE_MAIN,0) > iStochastic(Symbol(),PERIOD,12,3,3,MODE_SMA,1,MODE_SIGNAL,0)

As you can see the only difference is the mode main on the former and mode_signal on the latter.  Seemingly using these different parameters will return different values, the results are then compared and then the program makes a desiscion based on that comparison.

I've had a look at the diNapoliStochastic which seems to make reference to an output of "main" and "signal" but the actual code only seems to the the "signal" and Main is only reference at the beginning in the output section.

If anyone could help point me in the right direction, your help would be much appreciated.

Thanks!

Jon.

 


@bodleytunes
Replies

fzlogic
28 Nov 2013, 17:15

main is the percentK (green line) and signal is the percentD (red line).
 

        StochasticOscillator stochOsc;

        protected override void OnStart()
        {
            stochOsc = Indicators.StochasticOscillator(9, 3, 9, MovingAverageType.Simple);
        }

        protected override void OnTick()
        {
            if (stochOsc.PercentK.LastValue > stochOsc.PercentD.LastValue)
            {
                // 
            }
        }

 


@fzlogic

bodleytunes
28 Nov 2013, 17:23

Ok thanks for the info!

Regards,

Jon


@bodleytunes