ADX VMA Indicator

Created at 17 May 2017, 18:13
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!
IF

iForex2015

Joined 17.03.2015

ADX VMA Indicator
17 May 2017, 18:13


Hi all, 

Please help me with the following code. 

I am trying to create an alert for ADX VMA indicator  
My code is given below 
---------------------------

using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.Indicators;

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class TrendIndicator : Indicator
    {
        private AdxVma adx; 

        protected override void Initialize()
        {
            adx = Indicators.GetIndicator<AdxVma>(MarketSeries.Close, 4);
        }


        public override void Calculate(int index)
        {
             ShowADXTrend();
        }
        public void ShowADXTrend()
        {
            var open1 = MarketSeries.Open.Last(1);
            var adx1 = adx.Result.Last(1);
            if (open1 < adx1 && adx.Result.IsFalling())
                ChartObjects.DrawText("adx1", "Falling", StaticPosition.TopCenter, Color.Blue);
            else if (open1 > adx1 && adx.Result.IsRising())
                ChartObjects.DrawText("adx1", "Rising", StaticPosition.TopCenter, Color.Blue);
        } 
}

--------------------

As you can see there are three main colors, green for up, red for down and yello for flat trends in the in ADX VMA indicator. My code shows Rising or Falling even for flat trends. Any idea how to avoid that and to show only Rising or Falling when it is only Green and Red respectively.  

 

 


@iForex2015