Get symbol all time high/low

Created at 02 Aug 2024, 08:40
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 symbol all time high/low
02 Aug 2024, 08:40


Hello,

How to easily get the all time high/low prices for any symbol?

Thanks.


@ncel01
Replies

PanagiotisCharalampous
02 Aug 2024, 08:58

Hi there,

You would need to get all the bars from the server and check the high/low. Try M1 to save time.

Best regards,

Panagiotis


@PanagiotisCharalampous

ncel01
02 Aug 2024, 09:43

RE: Get symbol all time high/low

PanagiotisCharalampous said: 

Hi there,

You would need to get all the bars from the server and check the high/low. Try M1 to save time.

Best regards,

Panagiotis

Hi Panagiotis,

How can that be achieved programmatically?

Symbol.AllTimeHigh would be straight forward but I believe there is no such property available. So, what can be a work around here?

Thank you.


@ncel01

PanagiotisCharalampous
04 Aug 2024, 06:34

RE: RE: Get symbol all time high/low

ncel01 said: 

PanagiotisCharalampous said: 

Hi there,

You would need to get all the bars from the server and check the high/low. Try M1 to save time.

Best regards,

Panagiotis

Hi Panagiotis,

How can that be achieved programmatically?

Symbol.AllTimeHigh would be straight forward but I believe there is no such property available. So, what can be a work around here?

Thank you.

Hi ncel01,

You can load all the bars by using Bars.LoadMoreHistory(). Then you can use Bars.HighPrices.Maximum(Bars.Count) and Bars.LowPrices.Minimum(Bars.Count) to get the respective high and low.

Best regards,

Panagiotis


@PanagiotisCharalampous

ncel01
04 Aug 2024, 22:24 ( Updated at: 05 Aug 2024, 05:38 )

RE: RE: RE: Get symbol all time high/low

PanagiotisCharalampous said: 

ncel01 said: 

PanagiotisCharalampous said: 

Hi there,

You would need to get all the bars from the server and check the high/low. Try M1 to save time.

Best regards,

Panagiotis

Hi Panagiotis,

How can that be achieved programmatically?

Symbol.AllTimeHigh would be straight forward but I believe there is no such property available. So, what can be a work around here?

Thank you.

Hi ncel01,

You can load all the bars by using Bars.LoadMoreHistory(). Then you can use Bars.HighPrices.Maximum(Bars.Count) and Bars.LowPrices.Minimum(Bars.Count) to get the respective high and low.

Best regards,

Panagiotis

Panagiotis,

Thanks.

Bars.LoadMoreHistory() does not seem to change anything, no matter the time frame.
On the other hand, it looks like max/min historical prices are only caught when using monthly bars : 

var bars = MarketData.GetBars(TimeFrame.Monthly);
var maxHistorical = bars.HighPrices.Maximum(bars.Count);
var minHistorical = bars.LowPrices.Minimum(bars.Count));

@ncel01

PanagiotisCharalampous
05 Aug 2024, 06:02

RE: RE: RE: RE: Get symbol all time high/low

ncel01 said: 

PanagiotisCharalampous said: 

ncel01 said: 

PanagiotisCharalampous said: 

Hi there,

You would need to get all the bars from the server and check the high/low. Try M1 to save time.

Best regards,

Panagiotis

Hi Panagiotis,

How can that be achieved programmatically?

Symbol.AllTimeHigh would be straight forward but I believe there is no such property available. So, what can be a work around here?

Thank you.

Hi ncel01,

You can load all the bars by using Bars.LoadMoreHistory(). Then you can use Bars.HighPrices.Maximum(Bars.Count) and Bars.LowPrices.Minimum(Bars.Count) to get the respective high and low.

Best regards,

Panagiotis

Panagiotis,

Thanks.

Bars.LoadMoreHistory() does not seem to change anything, no matter the time frame.
On the other hand, it looks like max/min historical prices are only caught when using monthly bars : 

var bars = MarketData.GetBars(TimeFrame.Monthly);var maxHistorical = bars.HighPrices.Maximum(bars.Count);var minHistorical = bars.LowPrices.Minimum(bars.Count));

Hi there,

Note that Bars.LoadMoreHistory() currently works only in real time execution and you need to call it until it returns 0, so that all bars have been loaded.

Best regards,

Panagiotis


@PanagiotisCharalampous

ncel01
05 Aug 2024, 20:27 ( Updated at: 06 Aug 2024, 05:38 )

RE: RE: RE: RE: RE: Get symbol all time high/low

PanagiotisCharalampous said: 

ncel01 said: 

PanagiotisCharalampous said: 

ncel01 said: 

PanagiotisCharalampous said: 

Hi there,

You would need to get all the bars from the server and check the high/low. Try M1 to save time.

Best regards,

Panagiotis

Hi Panagiotis,

How can that be achieved programmatically?

Symbol.AllTimeHigh would be straight forward but I believe there is no such property available. So, what can be a work around here?

Thank you.

Hi ncel01,

You can load all the bars by using Bars.LoadMoreHistory(). Then you can use Bars.HighPrices.Maximum(Bars.Count) and Bars.LowPrices.Minimum(Bars.Count) to get the respective high and low.

Best regards,

Panagiotis

Panagiotis,

Thanks.

Bars.LoadMoreHistory() does not seem to change anything, no matter the time frame.
On the other hand, it looks like max/min historical prices are only caught when using monthly bars : 

var bars = MarketData.GetBars(TimeFrame.Monthly);var maxHistorical = bars.HighPrices.Maximum(bars.Count);var minHistorical = bars.LowPrices.Minimum(bars.Count));

Hi there,

Note that Bars.LoadMoreHistory() currently works only in real time execution and you need to call it until it returns 0, so that all bars have been loaded.

Best regards,

Panagiotis

Right. I was testing it in real time but I was not aware that multiple calls would be (maybe) needed.

However, it looks like for shorter time frames it is not possible go as far back in time, even when all bars are loaded (Bars.LoadMoreHistory() = 0), leading to different results.


@ncel01

PanagiotisCharalampous
06 Aug 2024, 05:56

RE: RE: RE: RE: RE: RE: Get symbol all time high/low

ncel01 said: 

PanagiotisCharalampous said: 

ncel01 said: 

PanagiotisCharalampous said: 

ncel01 said: 

PanagiotisCharalampous said: 

Hi there,

You would need to get all the bars from the server and check the high/low. Try M1 to save time.

Best regards,

Panagiotis

Hi Panagiotis,

How can that be achieved programmatically?

Symbol.AllTimeHigh would be straight forward but I believe there is no such property available. So, what can be a work around here?

Thank you.

Hi ncel01,

You can load all the bars by using Bars.LoadMoreHistory(). Then you can use Bars.HighPrices.Maximum(Bars.Count) and Bars.LowPrices.Minimum(Bars.Count) to get the respective high and low.

Best regards,

Panagiotis

Panagiotis,

Thanks.

Bars.LoadMoreHistory() does not seem to change anything, no matter the time frame.
On the other hand, it looks like max/min historical prices are only caught when using monthly bars : 

var bars = MarketData.GetBars(TimeFrame.Monthly);var maxHistorical = bars.HighPrices.Maximum(bars.Count);var minHistorical = bars.LowPrices.Minimum(bars.Count));

Hi there,

Note that Bars.LoadMoreHistory() currently works only in real time execution and you need to call it until it returns 0, so that all bars have been loaded.

Best regards,

Panagiotis

Right. I was testing it in real time but I was not aware that multiple calls would be (maybe) needed.

However, it looks like for shorter time frames it is not possible go as far back in time, even when all bars are loaded (Bars.LoadMoreHistory() = 0), leading to different results.

Hi ncel01,

It always depends on how much data is available by your broker.

Best regards,

Panagiotis


@PanagiotisCharalampous

ncel01
06 Aug 2024, 20:40 ( Updated at: 07 Aug 2024, 05:28 )

RE: RE: RE: RE: RE: RE: RE: Get symbol all time high/low

PanagiotisCharalampous said: 

ncel01 said: 

PanagiotisCharalampous said: 

ncel01 said: 

PanagiotisCharalampous said: 

ncel01 said: 

PanagiotisCharalampous said: 

Hi there,

You would need to get all the bars from the server and check the high/low. Try M1 to save time.

Best regards,

Panagiotis

Hi Panagiotis,

How can that be achieved programmatically?

Symbol.AllTimeHigh would be straight forward but I believe there is no such property available. So, what can be a work around here?

Thank you.

Hi ncel01,

You can load all the bars by using Bars.LoadMoreHistory(). Then you can use Bars.HighPrices.Maximum(Bars.Count) and Bars.LowPrices.Minimum(Bars.Count) to get the respective high and low.

Best regards,

Panagiotis

Panagiotis,

Thanks.

Bars.LoadMoreHistory() does not seem to change anything, no matter the time frame.
On the other hand, it looks like max/min historical prices are only caught when using monthly bars : 

var bars = MarketData.GetBars(TimeFrame.Monthly);var maxHistorical = bars.HighPrices.Maximum(bars.Count);var minHistorical = bars.LowPrices.Minimum(bars.Count));

Hi there,

Note that Bars.LoadMoreHistory() currently works only in real time execution and you need to call it until it returns 0, so that all bars have been loaded.

Best regards,

Panagiotis

Right. I was testing it in real time but I was not aware that multiple calls would be (maybe) needed.

However, it looks like for shorter time frames it is not possible go as far back in time, even when all bars are loaded (Bars.LoadMoreHistory() = 0), leading to different results.

Hi ncel01,

It always depends on how much data is available by your broker.

Best regards,

Panagiotis

Panagiotis,

I see. Thanks for the tips!


@ncel01