Moving Average on On Balance Volume

Created at 03 Aug 2017, 01:58
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!
JA

jalmir.coelho@gmail.com

Joined 19.07.2017

Moving Average on On Balance Volume
03 Aug 2017, 01:58


I would like help creating a robot with two exponential moving averages linked to the indicator on balance volume. When the blue average crosses above the yellow the buying signal is generated and when the blue average crosses below the yellow the sell signal is generated.

I need to capture the signal from the two moving average within the On Balance Volume

Follow the image to clarify the functionality.imagem


@jalmir.coelho@gmail.com
Replies

Spotware
03 Aug 2017, 11:54

Dear jalmir.coelho@gmail.com,

Thanks for posting in the forum. You can call these indicators from your cBot and check whenever they cross each other. Check our example cBots (e.g. Sample Trend cBot) to see how to access an indicator from a cBot. Also the following functions might be helpful for you

/api/reference/functions/hascrossedabove

/api/reference/functions/hascrossedbelow

Best Regards,

cTrader Team


@Spotware

jalmir.coelho@gmail.com
03 Aug 2017, 14:34

RE:

Spotware said:

 

Thank you for your response, however, I would like to know how to apply the average on the indicator on balance volume?

 

 

Dear jalmir.coelho@gmail.com,

Thanks for posting in the forum. You can call these indicators from your cBot and check whenever they cross each other. Check our example cBots (e.g. Sample Trend cBot) to see how to access an indicator from a cBot. Also the following functions might be helpful for you

/api/reference/functions/hascrossedabove

/api/reference/functions/hascrossedbelow

Best Regards,

cTrader Team

 


@jalmir.coelho@gmail.com

Spotware
03 Aug 2017, 14:53

Hi again,

You might try something like the following

           // Get the On Balance Volume indicator
            var onBalance = Indicators.OnBalanceVolume(MarketSeries.Median);
            //Get the exponential moving averages for the On Balance Volume indicator
            var ema10 = Indicators.ExponentialMovingAverage(onBalance.Result, 10);
            var ema14 = Indicators.ExponentialMovingAverage(onBalance.Result, 14);
            
            //Check if exponential moving averages cross each other
            if(ema10.Result.HasCrossedAbove(ema14.Result,5))
            {
                //Do something
            }
            
            if(ema10.Result.HasCrossedBelow(ema14.Result,5))
            {
                //Do something
            }

Best Regards,

cTrader Team


@Spotware