Remove unused imports and use Input rather than Close in order to support smoothing other indicator values

This commit is contained in:
moshferatu 2024-04-26 08:09:51 -07:00
parent 901488bc5a
commit 1bec3c5011

View File

@ -1,24 +1,9 @@
#region Using declarations #region Using declarations
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Gui; using NinjaTrader.Gui;
using NinjaTrader.Gui.Chart; using NinjaTrader.Gui.Chart;
using NinjaTrader.Gui.SuperDom;
using NinjaTrader.Gui.Tools;
using NinjaTrader.Data;
using NinjaTrader.NinjaScript;
using NinjaTrader.Core.FloatingPoint;
using NinjaTrader.NinjaScript.DrawingTools;
#endregion #endregion
//This namespace holds Indicators in this folder and is required. Do not change it. //This namespace holds Indicators in this folder and is required. Do not change it.
@ -70,11 +55,11 @@ namespace NinjaTrader.NinjaScript.Indicators
{ {
if (CurrentBar < 3) // Need at least 3 bars. if (CurrentBar < 3) // Need at least 3 bars.
{ {
Value[0] = Close[0]; Value[0] = Input[0];
return; return;
} }
Value[0] = c1 * (Close[0] + Close[1]) / 2 + c2 * Value[1] + c3 * Value[2]; Value[0] = c1 * (Input[0] + Input[1]) / 2 + c2 * Value[1] + c3 * Value[2];
} }
public override string DisplayName public override string DisplayName