Get all time high/low of a given symbol
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!
Replies
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
Hi Panagiotis,
That's clear. Thanks!
@ncel01
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));
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));
Need Help? Join us on Telegram
@Hyperion
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
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous