Market price of the current bar

Created at 25 Jul 2021, 13:34
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!
80

8089669

Joined 31.07.2019

Market price of the current bar
25 Jul 2021, 13:34


Hello everyone,

I am trying to build my own bot and need some help.

Could someone help me how to find the current market price of the bar.

Just like Bars.OpenPrices.Last(0), Bars.ClosePrices.Last(0), Bars.HighPrices.Last(0), Bars.LowPrices.Last(0), is there a method(or other way) to find the current price.

Any help is much appreciated.

Thank you.


@8089669
Replies

amusleh
26 Jul 2021, 08:44

Hi,

You can use Symbol.Bid or Symbol.Ask if you want to get the latest Bid/Ask price of a symbol.

If you want to get the latest bar close Price you can use Bars.ClosePrices.LastValue.

For historical bars, you can use the Bars collection index and iterate over them.


@amusleh

8089669
27 Jul 2021, 00:32

RE:

Thank you Amusleh,

I realized that Symbol.Bid or Symbol.Ask can be used after posting the query in the forum.

But Bars.ClosePrices.LastValue is something new i learnt. Thank you.

 

amusleh said:

Hi,

You can use Symbol.Bid or Symbol.Ask if you want to get the latest Bid/Ask price of a symbol.

If you want to get the latest bar close Price you can use Bars.ClosePrices.LastValue.

For historical bars, you can use the Bars collection index and iterate over them.

 


@8089669