Class SimpleMovingAverage
Represents the Simple Moving Average overlay technical indicator.
Inheritance
Implements
Inherited Members
Namespace: FancyCandles.Indicators
Assembly: FancyCandles.dll
Syntax
[JsonObject(MemberSerialization.OptIn)]
public sealed class SimpleMovingAverage : OverlayIndicator, INotifyPropertyChanged
Remarks
A Simple Moving Average is the overlay technical indicator calculated by the following formulae:
SMA(i, N) = [C(i) + C(i - 1) + ... + C(i - N + 1)] / N
where:- SMA(i, N) is the N-period Simple Moving Average value at a time period i;
- N is the number of periods over which the average price is calculated;
- C(i) is the Close price value at a time period i.
Properties
| Improve this Doc View SourceFullName
Gets the full name of this OverlayIndicator object. Implements the FullName abstract property inherited from the OverlayIndicator base class.
Declaration
public override string FullName { get; }
Property Value
Type | Description |
---|---|
System.String | The full name of this OverlayIndicator object. |
Overrides
Remarks
The full name of an OverlayIndicator object usually contains some of its property values.
N
Gets or sets the Number of periods over which the average price is calculated.
Declaration
[JsonProperty]
public int N { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The Number of periods over which the average price is calculated. The default value is |
Pen
Gets or sets the Pen to draw the indicator chart.
Declaration
[JsonProperty]
public Pen Pen { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Media.Pen | The Pen to draw the indicator chart. The default value is |
PropertiesEditorXAML
Gets the XAML snippet representing a property editor for this OverlayIndicator object. Implements the PropertiesEditorXAML abstract property inherited from the OverlayIndicator base class.
Declaration
public override string PropertiesEditorXAML { get; }
Property Value
Type | Description |
---|---|
System.String | The String of XAML snippet representing a property editor for this OverlayIndicator object. |
Overrides
Remarks
This XAML snippet can be loaded dynamically to instantiate a new element - the OverlayIndicator property editor.
ShortName
Gets the short name of this OverlayIndicator object. Implements the ShortName abstract property inherited from the OverlayIndicator base class.
Declaration
public override string ShortName { get; }
Property Value
Type | Description |
---|---|
System.String | The short name of this OverlayIndicator object. |
Overrides
Remarks
The short name of an OverlayIndicator object usually contains no instance parameter values.
StaticName
Gets the static name of this OverlayIndicator.
Declaration
public static string StaticName { get; }
Property Value
Type | Description |
---|---|
System.String | The static name of this OverlayIndicator. |
Methods
| Improve this Doc View SourceGetIndicatorValue(Int32)
Implements the GetIndicatorValue(Int32) abstract method inherited from the OverlayIndicator base class.
Declaration
public override double GetIndicatorValue(int candle_i)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | candle_i | Specifies the time period at which the OverlayIndicator value is calculated. |
Returns
Type | Description |
---|---|
System.Double | The OverlayIndicator value at a specified time period. |
Overrides
| Improve this Doc View SourceOnLastCandleChanged()
Declaration
protected override void OnLastCandleChanged()
Overrides
| Improve this Doc View SourceOnNewCandleAdded()
Declaration
protected override void OnNewCandleAdded()
Overrides
| Improve this Doc View SourceOnRender(DrawingContext, IntRange, CandleExtremums, Double, Double, Double)
Implements the OnRender(DrawingContext, IntRange, CandleExtremums, Double, Double, Double) abstract method inherited from the OverlayIndicator base class.
Declaration
public override void OnRender(DrawingContext drawingContext, IntRange visibleCandlesRange, CandleExtremums visibleCandlesExtremums, double candleWidth, double gapBetweenCandles, double RenderHeight)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.DrawingContext | drawingContext | Provides methods for drawing lines and shapes on the price chart area. |
IntRange | visibleCandlesRange | Specifies the time span currently shown on the price chart area. The range of the candles currently visible on the price chart. |
CandleExtremums | visibleCandlesExtremums | The maximal High and minimal Low of the candles in visibleCandlesRange. |
System.Double | candleWidth | The Width of candle of the price chart, in device-independent units. |
System.Double | gapBetweenCandles | The Gap between candles of the price chart, in device-independent units. |
System.Double | RenderHeight | The height of the price chart area, in device-independent units. |
Overrides
Remarks
This is an analog of the UIElement.OnRender() method. Participates in rendering operations that are directed by the layout system. The rendering instructions for this indicator are not used directly when this method is invoked, and are instead preserved for later asynchronous use by layout and drawing.
ReCalcAllIndicatorValues()
Declaration
protected override void ReCalcAllIndicatorValues()