-
Notifications
You must be signed in to change notification settings - Fork 246
/
Models.cs
36 lines (30 loc) · 1.05 KB
/
Models.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
namespace Skender.Stock.Indicators;
// CANDLESTICK MODELS
[Serializable]
public class CandleProperties : Quote
{
// raw sizes
internal decimal? Size => High - Low;
internal decimal? Body => (Open > Close) ? (Open - Close) : (Close - Open);
internal decimal? UpperWick => High - (Open > Close ? Open : Close);
internal decimal? LowerWick => (Open > Close ? Close : Open) - Low;
// percent sizes
internal double? BodyPct => (Size != 0) ? (double?)(Body / Size) : 1;
internal double? UpperWickPct => (Size != 0) ? (double?)(UpperWick / Size) : 1;
internal double? LowerWickPct => (Size != 0) ? (double?)(LowerWick / Size) : 1;
// directional info
internal bool IsBullish => Close > Open;
internal bool IsBearish => Close < Open;
}
[Serializable]
public class CandleResult : ResultBase
{
public CandleResult(DateTime date)
{
Date = date;
Candle = new CandleProperties();
}
public decimal? Price { get; set; }
public Match Match { get; set; }
public CandleProperties Candle { get; set; }
}