No Chart / No ChartArea

Created at 19 Oct 2018, 13:16
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!
FR

freemangreat

Joined 16.10.2018

No Chart / No ChartArea
19 Oct 2018, 13:16


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 Test : Indicator
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }

        [Output("Main")]
        public IndicatorDataSeries Result { get; set; }


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

        public override void Calculate(int index)
        {
            var line = Chart.DrawHorizontalLine("Test", Symbol.Bid, Colors.AliceBlue);
        }
    }
}

Build error - Error CS0117: "cAlgo.API.Chart" does not contain a definition for "DrawHorizontalLine"

The Chart is a type, but how to get an instance of a current chart?


@freemangreat
Replies

PanagiotisCharalampous
19 Oct 2018, 14:09

Hi freemangreat,

Which version of cTrader do you use?

Best Regards,

Panagiotis


@PanagiotisCharalampous

freemangreat
19 Oct 2018, 14:25

Hi Panagiotis,

Version 3.0.65534.35441


@freemangreat

PanagiotisCharalampous
19 Oct 2018, 14:41

Hi freemangreat,

Thanks, use the code 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 Test : Indicator
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }

        [Output("Main")]
        public IndicatorDataSeries Result { get; set; }


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

        public override void Calculate(int index)
        {
            ChartObjects.DrawHorizontalLine("Test", Symbol.Bid, Colors.AliceBlue);
        }
    }
}

Best Regards,

Panagiotis


@PanagiotisCharalampous

freemangreat
19 Oct 2018, 15:05

Yes, ChartObjects works fine, but will there be the Chart / ChartArea interface available?
For example, to get BarsTotal, is only with Chart

and ChartArea had many methods for handling mouse events.


@freemangreat

PanagiotisCharalampous
19 Oct 2018, 15:19

Hi freemangreat,

The Chart object is available in Spotware cTrader Beta 3.3. It will be rolled out to brokers soon.

Best Regards,

Panagiotis


@PanagiotisCharalampous