From de3397870ec313bfe6f661203db37cc7f47298b5 Mon Sep 17 00:00:00 2001 From: moshferatu Date: Fri, 7 Jun 2024 06:11:26 -0700 Subject: [PATCH] Calculate moving average on price change rather than on bar close --- indicators/MovingAverage.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/indicators/MovingAverage.cs b/indicators/MovingAverage.cs index c7f03e1..55809e5 100644 --- a/indicators/MovingAverage.cs +++ b/indicators/MovingAverage.cs @@ -1,13 +1,9 @@ #region Using declarations -using System; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Windows.Media; using System.Xml.Serialization; -using NinjaTrader.Cbi; using NinjaTrader.Gui; -using NinjaTrader.Gui.Chart; -using NinjaTrader.NinjaScript; #endregion // Do not change the namespace. @@ -21,8 +17,9 @@ namespace NinjaTrader.NinjaScript.Indicators { if (State == State.SetDefaults) { - Description = "Simple moving average indicator"; + Description = "Basic moving average indicator"; Name = "Moving Average"; + Calculate = Calculate.OnPriceChange; IsOverlay = true; IsSuspendedWhileInactive = true; Period = 20;