Multi Symbols indicator and Stochastic Indicaotr

Created at 23 Jun 2014, 13:40
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!
GI

giovi61

Joined 26.01.2014

Multi Symbols indicator and Stochastic Indicaotr
23 Jun 2014, 13:40


hi, I would like to compare two stochastic indicators of two different marketseries.
is this possible? I ask this because in the Stochastic Oscillator I can not define the symbol


@giovi61
Replies

Spotware
23 Jun 2014, 15:37

You can create Stochastic Oscillator for different symbol by passing market series object. Example:

            var eurUsd = MarketData.GetSeries("EURUSD", TimeFrame.Minute10);
            var eurGbp = MarketData.GetSeries("EURGBP", TimeFrame.Minute10);

            var stochasticEurUsd = Indicators.StochasticOscillator(eurUsd, 8, 3, 9, MovingAverageType.Simple);
            var stochasticEurGbp = Indicators.StochasticOscillator(eurGbp, 8, 3, 9, MovingAverageType.Simple);

 


@Spotware

giovi61
23 Jun 2014, 17:03

RE:

Spotware said:

You can create Stochastic Oscillator for different symbol by passing market series object. Example:

            var eurUsd = MarketData.GetSeries("EURUSD", TimeFrame.Minute10);
            var eurGbp = MarketData.GetSeries("EURGBP", TimeFrame.Minute10);

            var stochasticEurUsd = Indicators.StochasticOscillator(eurUsd, 8, 3, 9, MovingAverageType.Simple);
            var stochasticEurGbp = Indicators.StochasticOscillator(eurGbp, 8, 3, 9, MovingAverageType.Simple);

 

Thanks this works, but I have another question:

I realize an indicator, for example "myIndicator" that has as parameters Period and Limit.
I want to create a new indicator that refers to this in this way:

// # reference: myIndicator.algo
...
...
var = _myInd Indicators.GetIndicator <myIndicator> (Period, Limit);


Up to here no problem. But if I want to specify a symbol to use with the indicator reported in the following way:

var = EURUSD MarketData.GetSeries ("EURUSD", TimeFrame.Minute10);
var = _myInd Indicators.GetIndicator <myIndicator> (EURUSD, Period, Limit);


to do this I need to create an instance of my indicator (myIndicator) based on the symbol. But how should I declare the constructor of myIndicator to do this?


@giovi61

Spotware
24 Jun 2014, 09:17

You need to obtain instance of market series object and pass it as first parameter to GetIndicator method:

            var anotherSeries = MarketData.GetSeries("EURGBP", TimeFrame.Minute20);
            alligator = Indicators.GetIndicator<SampleAlligator>(anotherSeries, 13, 8, 8, 5, 5, 3);

 


@Spotware

giovi61
24 Jun 2014, 13:42

Thank you, now it works


@giovi61