Get all time high/low of a given symbol

Created at 23 Jun 2022, 08:14
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

Get all time high/low of a given symbol
23 Jun 2022, 08:14


Hello,

How to get the all time high/low price of a given symbol?

Thanks!


@ncel01
Replies

PanagiotisCharalampous
23 Jun 2022, 16:19

Hi ncel01,

Here is an example for getting the highest price from all the bars loaded on the chart

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo.Robots
{
    [Robot(AccessRights = AccessRights.None)]
    public class NewcBot : Robot
    {
        [Parameter(DefaultValue = "Hello world!")]
        public string Message { get; set; }

        protected override void OnStart()
        {
            // To learn more about cTrader Automate visit our Help Center:
            // https://help.ctrader.com/ctrader-automate

            Print(Bars.HighPrices.Maximum(Bars.HighPrices.Count));
        }

        protected override void OnTick()
        {
            // Handle price updates here
        }

        protected override void OnStop()
        {
            // Handle cBot stop here
        }
    }
}

Best Regards,

Panagiotis 

Join us on Telegram and Facebook


@PanagiotisCharalampous

ncel01
24 Jun 2022, 10:22

RE:

PanagiotisCharalampous said:

Hi ncel01,

Here is an example for getting the highest price from all the bars loaded on the chart

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo.Robots
{
    [Robot(AccessRights = AccessRights.None)]
    public class NewcBot : Robot
    {
        [Parameter(DefaultValue = "Hello world!")]
        public string Message { get; set; }

        protected override void OnStart()
        {
            // To learn more about cTrader Automate visit our Help Center:
            // https://help.ctrader.com/ctrader-automate

            Print(Bars.HighPrices.Maximum(Bars.HighPrices.Count));
        }

        protected override void OnTick()
        {
            // Handle price updates here
        }

        protected override void OnStop()
        {
            // Handle cBot stop here
        }
    }
}

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

Hi Panagiotis,

That's clear. Thanks!


@ncel01

Hyperion
03 Oct 2022, 16:56

RE:

 

PanagiotisCharalampous said:

Here is an example for getting the highest price from all the bars loaded on the chart

And how to get the all time high, i.e. highest high from the monthly dataseries?


@Hyperion

PanagiotisChar
04 Oct 2022, 07:57

Hi Hyperion,

Just replace

Print(Bars.HighPrices.Maximum(Bars.HighPrices.Count));

with

Print(MarketData.GetBars(TimeFrame.Daily).HighPrices.Maximum(Bars.HighPrices.Count));

Aieden Technologies

Need Help? Join us on Telegram

 


@PanagiotisChar

Hyperion
19 Oct 2022, 18:36

RE:

Thanks a lot!

btw, Monthly time frame works better than Daily for an all-time high.

Cheers

PanagiotisChar said:

Hi Hyperion,

Just replace

Print(Bars.HighPrices.Maximum(Bars.HighPrices.Count));

with

Print(MarketData.GetBars(TimeFrame.Daily).HighPrices.Maximum(Bars.HighPrices.Count));

Aieden Technologies

Need Help? Join us on Telegram

 

 


@Hyperion