Topics
21 Oct 2023, 15:08
 271
 0
01 Jul 2023, 01:26
 3
 520
 3
Replies

undseth
21 Oct 2023, 15:03

And the problem is still here in 2023 :(


@undseth

undseth
03 Jul 2023, 12:13

RE:

That's working great, thank you :).

 

This indicator should be included in ctrader ;).

 

Regards

Halvard

 

PanagiotisChar said:

Hi there,

Check this indicator. It might be helpful

Aieden Technologies

Need help? Join us on Telegram

 

 


@undseth

undseth
14 Mar 2022, 18:46

RE: RE: RE:

amusleh said:

undseth said:

amusleh said:

Hi,

The data series itself has a minimum method, so you can use is like this:

// This gives you the lowest price in last 20 bars lows
var lowestLow = Bars.LowPrices.Minimum(20)

 

 

Hi again,

This will get the lowest low from start index 1, but I need it to get the lowest low from eks start index 10, so it shuld

start at index 10 and get the lowest low in a periode of 20 bars. Hope this make sense??

 

Thanks for all the help!

Halvard

Then use the method I posted on my first post, you can set the start/end index and it will give you the low, ex:

// This will return the lowest low between bar index 90 and 100
var low = Minimum(Bars.LowPrices, 90, 100);

 

Thank you so much!

 

Best regards

Halvard


@undseth

undseth
14 Mar 2022, 11:12

RE:

amusleh said:

Hi,

The data series itself has a minimum method, so you can use is like this:

// This gives you the lowest price in last 20 bars lows
var lowestLow = Bars.LowPrices.Minimum(20)

 

 

Hi again,

This will get the lowest low from start index 1, but I need it to get the lowest low from eks start index 10, so it shuld

start at index 10 and get the lowest low in a periode of 20 bars. Hope this make sense??

 

Thanks for all the help!

Halvard


@undseth

undseth
11 Mar 2022, 11:26

RE: RE:

Hi again,

 

I'm not sure this will do what I asked for, but maybe i'm wrong?

I need to get the lowest low in a range lets say 63 bars back.

so something like this:

Lowest.low(range), [bars back]

 

Hope this make sense?

 

Regards

Halvard

 

 

undseth said:

amusleh said:

Hi,

If you want to get the lowest/minimum value x bars back you can use this method:

using System;
using cAlgo.API;

namespace cAlgo
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class NewIndicator : Indicator
    {
        protected override void Initialize()
        {
            // Initialize and create nested indicators
        }

        public override void Calculate(int index)
        {
            // To get index on a cBot use
            // var index = Bars.Count - 1;

            // low of 20 previous bars
            var low = Minimum(Bars.LowPrices, index - 20, index);

            Print(low);
        }

        /// <summary>
        /// Returns the minimum value between start and end (inclusive) index in a dataseries
        /// </summary>
        /// <param name="dataSeries"></param>
        /// <param name="startIndex">Start index (Ex: 1)</param>
        /// <param name="endIndex">End index (Ex: 10)</param>
        /// <returns>double</returns>
        private double Minimum(DataSeries dataSeries, int startIndex, int endIndex)
        {
            var min = double.PositiveInfinity;

            for (var i = startIndex; i <= endIndex; i++)
            {
                min = Math.Min(dataSeries[i], min);
            }

            return min;
        }
    }
}

 

 

 

Thank you :).

 

Best regards

Halvard

 


@undseth

undseth
10 Mar 2022, 11:13

RE:

amusleh said:

Hi,

If you want to get the lowest/minimum value x bars back you can use this method:

using System;
using cAlgo.API;

namespace cAlgo
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class NewIndicator : Indicator
    {
        protected override void Initialize()
        {
            // Initialize and create nested indicators
        }

        public override void Calculate(int index)
        {
            // To get index on a cBot use
            // var index = Bars.Count - 1;

            // low of 20 previous bars
            var low = Minimum(Bars.LowPrices, index - 20, index);

            Print(low);
        }

        /// <summary>
        /// Returns the minimum value between start and end (inclusive) index in a dataseries
        /// </summary>
        /// <param name="dataSeries"></param>
        /// <param name="startIndex">Start index (Ex: 1)</param>
        /// <param name="endIndex">End index (Ex: 10)</param>
        /// <returns>double</returns>
        private double Minimum(DataSeries dataSeries, int startIndex, int endIndex)
        {
            var min = double.PositiveInfinity;

            for (var i = startIndex; i <= endIndex; i++)
            {
                min = Math.Min(dataSeries[i], min);
            }

            return min;
        }
    }
}

 

 

 

Thank you :).

 

Best regards

Halvard


@undseth