Is there anyway to highlight background or to have sorf of marks displayed on the bottom

Created at 22 Feb 2016, 17:15
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!
Singleton's avatar

Singleton

Joined 13.04.2015

Is there anyway to highlight background or to have sorf of marks displayed on the bottom
22 Feb 2016, 17:15


Is there anyway to highlight background or to have sorf of marks displayed on the bottom?

 

I want to highlight background or have marks on the bottom of charts when ADX is above 20

In a nutshell, I want to be notified when ADX is above 20, without plotting ADX on the subcharts.

 

So are there any functions like background highlight, or displaying shapes on the screen?

 

Thank you


@Singleton
Replies

Waxy
23 Feb 2016, 00:48

I think the options you have right now is to make a bot to use adx and draw a line or text at a specified location when it is above 20.


@Waxy

croucrou
13 Mar 2016, 18:39

RE:

You can do it like this:

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

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

        protected override void Initialize()
        {
            adx = Indicators.DirectionalMovementSystem(yourPeriod);
        }

        public override void Calculate(int index)
        {
            if (adx.ADX.LastValue > 20)
            {
                ChartObjects.DrawText("Alert", "ADX above 20!", StaticPosition.BottomLeft, Colors.Yellow);
            }
        }
    }
}

 


@croucrou

Singleton
13 Mar 2016, 19:19

RE: RE:

croucrou said:

You can do it like this:

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

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

        protected override void Initialize()
        {
            adx = Indicators.DirectionalMovementSystem(yourPeriod);
        }

        public override void Calculate(int index)
        {
            if (adx.ADX.LastValue > 20)
            {
                ChartObjects.DrawText("Alert", "ADX above 20!", StaticPosition.BottomLeft, Colors.Yellow);
            }
        }
    }
}

 

Thank you so much for writing it. I appreciate it. Is it easy to learn c# for cTrader Algo only?

 

 


@Singleton

croucrou
13 Mar 2016, 19:59

Learn just what you need and you are going to be fine.


@croucrou

croucrou
13 Mar 2016, 22:24

Spotware has made cAlgo user friendly, so there is no need to have extensive knowledge about C#, to deal with basics.


@croucrou

croucrou
28 Mar 2016, 14:45

Actually this needs one more thing to work. Now it is complete:

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

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

        protected override void Initialize()
        {
            adx = Indicators.DirectionalMovementSystem(14);
        }

        public override void Calculate(int index)
        {
            if (!IsLastBar)
                return;

            if (adx.ADX.LastValue > 20)
            {
                ChartObjects.RemoveObject("Alert");
                ChartObjects.DrawText("Alert", "ADX above 20!", StaticPosition.BottomLeft, Colors.Yellow);
            }
        }
    }
}

 


@croucrou