Class CandleWidthExtensions
- Namespace
- WhalesSecret.TradeScriptLib.Entities.MarketData
- Assembly
- WhalesSecret.TradeScriptLib.dll
Extensions and helpers related to CandleWidth.
public static class CandleWidthExtensions
- Inheritance
-
CandleWidthExtensions
- Inherited Members
Fields
- ValidCandleWidthCount
Number of different valid candle widths.
Methods
- AdjustCandleTime(CandleWidth, DateTime)
From the candle time received from the exchange, form a candle time that starts at the time we expect the candle to start. Final start time is always the same as the input time or an earlier time.
- ExtractCandleTimeFrame(CandleWidth, DateTime, out TimeSpan?)
Checks that a candle of the given width can start at the given time and extracts the length of the candle.
- FromTimeSpan(TimeSpan)
Converts TimeSpan to CandleWidth .
- GetNextCandleSetTime(CandleWidth, DateTime)
Starting with a valid time of a candle set, this method calculates the start time of the following candle set. For candle widths up to Day1 a candle set always represents 1 day.
- GetNextCandleSetTime(CandleWidth, DateTime, out TimeSpan)
Starting with a valid time of a candle set, this method calculates the start time of the following candle set. For candle widths up to Day1 a candle set always represents 1 day.
- GetThisOrNextTimeFrameStart(CandleWidth, DateTime, out DateTime?)
Determines the start of the time frame that follows the given time for the given candle width. For example, if we have the weekly candle width and the given time is Wednesday morning, the start of the time frame is Monday midnight that follows the Wednesday morning.
- GetTimeFrameCandleCount(CandleWidth, DateTime, DateTime)
Calculates the number of candles of the given width in the specified time frame. A candle is counted as in the time frame if its timestamp (i.e. the start time of the candle) is greater or equal to
startTime
and less thanendTime
.
- GetTimeFrameStart(CandleWidth, DateTime, out DateTime?)
Determines the start of the time frame that covers the given time for the given candle width. For example, if we have the weekly candle width and the given time is Wednesday morning, the start of the time frame is Monday midnight that precedes the Wednesday morning.
- ToTimeSpan(CandleWidth, out TimeSpan?)
Converts CandleWidth to TimeSpan.
- TryGetNextCandleSetTime(CandleWidth, DateTime, out DateTime?, out TimeSpan?)
Calculates the start time of the following candle set. For candle widths up to Day1 a candle set always represents 1 day.