How to get DataSeries IndicatorsSource

Created at 28 Dec 2021, 16:59
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!
NC

ncel01

Joined 19.03.2020

How to get DataSeries IndicatorsSource
28 Dec 2021, 16:59


Hello,

How can I get the selected " public DataSeries IndicatorsSource { get; set; } "  to be used on a conditional statement?

For instance:
If (IndicatorsSource == BarOpen)

...

else if (IndicatorsSource == BarHigh)

...

etc.



Thank you.


@ncel01
Replies

amusleh
29 Dec 2021, 08:58

Hi,

Do you mean something 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 TopYbottomYtest : Indicator
    {
        [Parameter("Source")]
        public DataSeries Source { get; set; }

        protected override void Initialize()
        {
            if (Source == Bars.HighPrices)
            {
                Print("High Prices");
            }
        }

        public override void Calculate(int index)
        {
        }
    }
}

 


@amusleh

ncel01
11 Jan 2022, 00:11

RE:

amusleh said:

Hi,

Do you mean something 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 TopYbottomYtest : Indicator
    {
        [Parameter("Source")]
        public DataSeries Source { get; set; }

        protected override void Initialize()
        {
            if (Source == Bars.HighPrices)
            {
                Print("High Prices");
            }
        }

        public override void Calculate(int index)
        {
        }
    }
}

 

Hi amusleh,

That's clear.
Thanks for the info!


@ncel01