And here is the code I'm using (the division is the variable rk5_a and the EMA rk6_a):
Thanks for any help
#region Using declarations
using System;
using System.Collections.Generic;
using System.ComponentModel;
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.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Gui;
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
//This namespace holds Indicators in this folder and is required. Do not change it.
namespace NinjaTrader.NinjaScript.Indicators
{
public class ensayo : Indicator
{
private Series<double> Ys1;
private EMA rk3_a;
private StdDev rk4_a;
private Series<double> nom;
private Series<double> den;
private Series<double> rk5_a;
private EMA rk6_a;
private EMA up_a;
private EMA down_a;
//private Series<double> Ys1;
//private Series<double> rk3_a;
//private double rk3_a;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Enter the description for your new custom Indicator here.";
Name = "ensayo";
Calculate = Calculate.OnBarClose;
IsOverlay = false;
DisplayInDataBox = true;
DrawOnPricePanel = true;
DrawHorizontalGridLines = true;
DrawVerticalGridLines = true;
PaintPriceMarkers = true;
ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
//Disable this property if your indicator requires custom values that cumulate with each new market data event.
//See Help Guide for additional information.
IsSuspendedWhileInactive = true;
AddPlot(Brushes.Orange, "Ys1_a");
}
else if (State == State.Configure)
{
Ys1 = new Series<double>(this);
rk3_a = EMA(Ys1,50);
rk4_a = StdDev(rk3_a,50);
nom = new Series<double>(this);
den = new Series<double>(this);
rk5_a = new Series<double>(this);
rk6_a = EMA(rk5_a,50);
}
}
protected override void OnBarUpdate()
{
//Add your custom indicator logic here.
Ys1[0] = (High[0]+Low[0]+(Close[0]*2.0))/4.0;
//rk5_a[0] = (((Ys1[0]-rk3_a[0])*100) / (rk4_a[0]));
nom[0] = (Ys1[0]-rk3_a[0])*100;
den[0] = rk4_a[0];
rk5_a[0] = (nom[0])/(den[0]);
Ys1_a[0] = rk6_a[0];
}
#region Properties
[Browsable(false)]
[XmlIgnore]
public Series<double> Ys1_a
{
get { return Values[0]; }
}
#endregion
}
}
#region NinjaScript generated code. Neither change nor remove.
namespace NinjaTrader.NinjaScript.Indicators
{
public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
{
private ensayo[] cacheensayo;
public ensayo ensayo()
{
return ensayo(Input);
}
public ensayo ensayo(ISeries<double> input)
{
if (cacheensayo != null)
for (int idx = 0; idx < cacheensayo.Length; idx++)
if (cacheensayo[idx] != null && cacheensayo[idx].EqualsInput(input))
return cacheensayo[idx];
return CacheIndicator<ensayo>(new ensayo(), input, ref cacheensayo);
}
}
}
namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
{
public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
{
public Indicators.ensayo ensayo()
{
return indicator.ensayo(Input);
}
public Indicators.ensayo ensayo(ISeries<double> input )
{
return indicator.ensayo(input);
}
}
}
namespace NinjaTrader.NinjaScript.Strategies
{
public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
{
public Indicators.ensayo ensayo()
{
return indicator.ensayo(Input);
}
public Indicators.ensayo ensayo(ISeries<double> input )
{
return indicator.ensayo(input);
}
}
}
#endregion
Comment