Files
QuanTAlib/quantower/Volatility/AtrIndicator.cs
T

25 lines
701 B
C#
Raw Normal View History

2024-09-30 06:46:07 -07:00
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class AtrIndicator : IndicatorBarBase
{
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 20;
private Atr? atr;
2024-10-07 21:41:26 -07:00
protected override AbstractBase QuanTAlib => atr!;
2024-09-30 06:46:07 -07:00
public override string ShortName => $"ATR {Period}";
public AtrIndicator()
{
Name = "ATR - Average True Range";
2024-10-11 18:02:09 -07:00
Description = "Measures market volatility by calculating the average range between high and low prices.";
2024-09-30 06:46:07 -07:00
SeparateWindow = true;
}
protected override void InitIndicator()
{
atr = new(Period);
MinHistoryDepths = atr!.WarmupPeriod;
}
2024-10-11 18:02:09 -07:00
}