change textbox position between indicatorarea and chart area

Created at 02 Aug 2021, 16: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!
IR

IRCtrader

Joined 17.06.2021

change textbox position between indicatorarea and chart area
02 Aug 2021, 16:15


how can i get all windwos open in my chart?

i have daily net profit percent indicator. i want trader should change position of this between main chart and indicator areas.?

i need to add option in parameters to do that.

for ex: in below image trader could open daily profit indicator setting and move it to main chart or indicator area.

 


@IRCtrader
Replies

PanagiotisCharalampous
02 Aug 2021, 16:33

Hi khoshroomahdi,

See an example below

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

namespace cAlgo
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class NewIndicator : Indicator
    {
        [Parameter(DefaultValue = true)]
        public bool ShowOnMain { get; set; }


        protected override void Initialize()
        {
            // Initialize and create nested indicators
        }

        public override void Calculate(int index)
        {
            if (ShowOnMain)
                Chart.DrawStaticText("Text", "Text", VerticalAlignment.Top, HorizontalAlignment.Right, Color.Red);
            else
                Chart.IndicatorAreas[0].DrawStaticText("Text", "Text", VerticalAlignment.Top, HorizontalAlignment.Right, Color.Red);

        }
    }
}

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

 


@PanagiotisCharalampous

IRCtrader
02 Aug 2021, 16:43 ( Updated at: 02 Aug 2021, 16:54 )

RE:

PanagiotisCharalampous said:

Hi khoshroomahdi,

See an example below

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

namespace cAlgo
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class NewIndicator : Indicator
    {
        [Parameter(DefaultValue = true)]
        public bool ShowOnMain { get; set; }


        protected override void Initialize()
        {
            // Initialize and create nested indicators
        }

        public override void Calculate(int index)
        {
            if (ShowOnMain)
                Chart.DrawStaticText("Text", "Text", VerticalAlignment.Top, HorizontalAlignment.Right, Color.Red);
            else
                Chart.IndicatorAreas[0].DrawStaticText("Text", "Text", VerticalAlignment.Top, HorizontalAlignment.Right, Color.Red);

        }
    }
}

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

 

thanks. great answer


@IRCtrader