Algo.Bars extra features

Created at 30 Jul 2023, 15:21
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!
EK

ekalyvio

Joined 13.06.2023

Algo.Bars extra features
30 Jul 2023, 15:21


It would be nice to have the following inside the Algo.Bars:

    1) A property that indicates the CloseTime of the previous bar before the First() bar (the prior bar of the `Bars[0]`).

Explanation: Currently there is no clear indication of how cTrader loads the bar data. Is the first bar the really first bar of a session or it might start giving data mid-session? Also, we can't know if the first bar of the session is the first day of week or month. eg. If the first bar received was at 14:30 UTC time (when Nasdaq starts) of January 3rd (Tuesday), we can't know if it was the first day of the month or not. In reality, January 2nd (Monday) it was bank holiday. If we had the CloseTime of the prior bar before the first bar in the collection we would take something like Friday, December 30th 2022 21:00 (UTC). This way, we would know that we are in a brand new trading week and brand new trading month.

    2) In the Bars.LoadMoreHistory() it would be nice if we can have as a parameter the first day of the history to load and/or having a parameter of type int to indicate how many more bars we want.

Explanation: Since the Bars.LoadMoreHistory() returns the number of items that got added to the data, we can have something like Bars.LoadMoreHistory(new Datetime("2023/01/02")) and/or Bars.LoadMoreHistory(1). In the first case (with the date), we should get a return value of 0 in case the first bar item was on January 3rd 14:30 UTC.  In the second case we would get one more bar at Friday, December 30th 2022 21:00 (UTC). This way would have also solved the above problem (1) and would also give us the ability to fine tune how many data exactly we need. eg. Someone might want to calculate the VWAP anchored on the start of each month. As such s/he might request data that start at the fist day of the month and not later in order to calculate the VWAP correctly.

    3) It could also be nice if cTrader had the ability to return us the historical OpenTimes & CloseTimes for each market session in a list. eg, consider the following:

public class TradingSession {
	public DateTime StartTime { get; }
	public DateTime EndTime { get; }
}

List<TradingSession> TradingSessionHours;

TradingSessionHours = MarketData.GetTradingSessionHours(fromDay, toDay);

@ekalyvio
Replies

firemyst
02 Aug 2023, 12:01

You need to post this in the “Suggestions” forum


@firemyst

ekalyvio
02 Aug 2023, 13:49

RE: Algo.Bars extra features

firemyst said: 

You need to post this in the “Suggestions” forum

Hah… I didn't know there is a separate forum page for that. I will re-post it there.

Thanks!


@ekalyvio