I'm not a programmer but I'm trying to learn. I'm making a simple ema cross over that plots an up arrow when the fast EMA crosses above the slow EMA and vice-versa. Here is my code. I keep getting an error on line 59 CS0102. I've highlight the error in red "inputfast" Please help.
#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
#endregion
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
/// <summary>
/// Ema arrow test indicator
/// </summary>
[Description("Ema arrow test indicator")]
public class EMAarrowtest : Indicator
{
#region Variables
// Wizard generated variables
private int Inputfast = 3; // Default setting for fastema
private int Inputslow = 14; //Default setting for slowema
// User defined variables (add any user defined variables below)
#endregion
/// <summary>
/// This method is used to configure the indicator and is called once before any bar data is loaded.
/// </summary>
protected override void Initialize()
{
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (CrossAbove(EMA(Inputfast), EMA(InputSlow), 1))
{
DrawArrowUp("My up arrow" + CurrentBar, false, 0, 0, Color.Lime);
}
// Condition set 2
if (CrossBelow(EMA(Inputfast), EMA(InputSlow), 1))
{
DrawArrowDown("My down arrow" + CurrentBar, false, 0, 0, Color.Red);
}
}
#region Properties
[Description("Fast description input")]
[Category("Parameters")]
public int Inputfast
{
get { return inputfast; }
set { inputfast = Math.Max(1, value); }
}
[Description("Slow description input")]
[Category("Parameters")]
public int InputSlow
{
get { return inputSlow; }
set { inputSlow = Math.Max(1, value); }
}
#endregion
}
}
#region NinjaScript generated code. Neither change nor remove.
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
public partial class Indicator : IndicatorBase
{
private EMAarrowtest[] cacheEMAarrowtest = null;
private static EMAarrowtest checkEMAarrowtest = new EMAarrowtest();
/// <summary>
/// Ema arrow test indicator
/// </summary>
/// <returns></returns>
public EMAarrowtest EMAarrowtest(int inputfast, int inputSlow)
{
return EMAarrowtest(Input, inputfast, inputSlow);
}
/// <summary>
/// Ema arrow test indicator
/// </summary>
/// <returns></returns>
public EMAarrowtest EMAarrowtest(Data.IDataSeries input, int inputfast, int inputSlow)
{
checkEMAarrowtest.Inputfast = inputfast;
inputfast = checkEMAarrowtest.Inputfast;
checkEMAarrowtest.InputSlow = inputSlow;
inputSlow = checkEMAarrowtest.InputSlow;
if (cacheEMAarrowtest != null)
for (int idx = 0; idx < cacheEMAarrowtest.Length; idx++)
if (cacheEMAarrowtest[idx].Inputfast == inputfast && cacheEMAarrowtest[idx].InputSlow == inputSlow && cacheEMAarrowtest[idx].EqualsInput(input))
return cacheEMAarrowtest[idx];
EMAarrowtest indicator = new EMAarrowtest();
indicator.BarsRequired = BarsRequired;
indicator.CalculateOnBarClose = CalculateOnBarClose;
indicator.Input = input;
indicator.Inputfast = inputfast;
indicator.InputSlow = inputSlow;
indicator.SetUp();
EMAarrowtest[] tmp = new EMAarrowtest[cacheEMAarrowtest == null ? 1 : cacheEMAarrowtest.Length + 1];
if (cacheEMAarrowtest != null)
cacheEMAarrowtest.CopyTo(tmp, 0);
tmp[tmp.Length - 1] = indicator;
cacheEMAarrowtest = tmp;
Indicators.Add(indicator);
return indicator;
}
}
}
// This namespace holds all market analyzer column definitions and is required. Do not change it.
namespace NinjaTrader.MarketAnalyzer
{
public partial class Column : ColumnBase
{
/// <summary>
/// Ema arrow test indicator
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.EMAarrowtest EMAarrowtest(int inputfast, int inputSlow)
{
return _indicator.EMAarrowtest(Input, inputfast, inputSlow);
}
/// <summary>
/// Ema arrow test indicator
/// </summary>
/// <returns></returns>
public Indicator.EMAarrowtest EMAarrowtest(Data.IDataSeries input, int inputfast, int inputSlow)
{
return _indicator.EMAarrowtest(input, inputfast, inputSlow);
}
}
}
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
public partial class Strategy : StrategyBase
{
/// <summary>
/// Ema arrow test indicator
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.EMAarrowtest EMAarrowtest(int inputfast, int inputSlow)
{
return _indicator.EMAarrowtest(Input, inputfast, inputSlow);
}
/// <summary>
/// Ema arrow test indicator
/// </summary>
/// <returns></returns>
public Indicator.EMAarrowtest EMAarrowtest(Data.IDataSeries input, int inputfast, int inputSlow)
{
if (InInitialize && input == null)
throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");
return _indicator.EMAarrowtest(input, inputfast, inputSlow);
}
}
}
#endregion
Comment