Upload indicator to ctdn

Created at 22 Jun 2021, 18:33
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

Upload indicator to ctdn
22 Jun 2021, 18:33


I want to upload my indicator. i build with source. but when i upload it i got error that file doesn't include source.

Indicaotr

 

//Designed by AcademyWave Student



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

namespace cAlgo
{
    // This sample indicator shows how to add a text block control on your chart
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class AWSpread : Indicator
    {
        TextBlock tb = new TextBlock();
        [Parameter("FontSize", DefaultValue = 12)]
        public int FontSize { get; set; }
        [Parameter("Space to Corner", DefaultValue = 10)]
        public int Margin { get; set; }
        [Parameter("Horizental Alignment", DefaultValue = HorizontalAlignment.Right)]
        public HorizontalAlignment HAlignment { get; set; }
        [Parameter("Vertical Alignment", DefaultValue = VerticalAlignment.Bottom)]
        public VerticalAlignment VAlignment { get; set; }
        [Parameter("Color", DefaultValue = "Red")]
        public string Color1 { get; set; }


        protected override void Initialize()
        {

        }
        public override void Calculate(int index)
        {

            if (IsLastBar)
                DisplaySpreadOnChart();
        }

        public void DisplaySpreadOnChart()
        {

            var spread = Math.Round(Symbol.Spread / Symbol.PipSize, 2);
            string sp = string.Format("{0}", spread);
            tb.Text = sp;
            tb.FontSize = FontSize;
            tb.ForegroundColor = Color1.TrimEnd();
            tb.HorizontalAlignment = HAlignment;
            tb.VerticalAlignment = VAlignment;
            tb.Margin = Margin;
            Chart.AddControl(tb);
        }



    }


}

 


@IRCtrader
Replies

PanagiotisCharalampous
23 Jun 2021, 08:00

Hi khoshroomahdi,

We will investigate this and come back to you.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook


@PanagiotisCharalampous