// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
[Description("Enter the description of your new custom indicator here")]
public class GoslinTrigger2 : Indicator
{
#region Variables
// Wizard generated variables
private int myInput0 = 1; // Default setting for MyInput0
// 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()
{
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "GosOsc"));
Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line, "GosTrig"));
CalculateOnBarClose = true;
Overlay = false;
PriceTypeSupported = false;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{ If (CurrentBar < 16) return;
//Calculate Goslin Osc.
double GosOsc = SMA(Close[0],3)[0];
//Calculate Goslin Trigger
double GosTrig = SMA(SMA(Close[0],3)[0]-SMA(Close[0],10),16)[0];
// Use this method for calculating your indicator values. Assign a value to each
// plot below by replacing 'Close[0]' with your own formula.
GosOsc.Set(GosOsc);
GosTrig.Set(GosTrig);
}
#region Properties
[Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
public DataSeries GosOsc
{
get { return Values[0]; }
}
[Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
public DataSeries GosTrig
{
get { return Values[1]; }
}
[Description("")]
[Category("Parameters")]
public int MyInput0
{
get { return myInput0; }
set { myInput0 = 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 GoslinTrigger2[] cacheGoslinTrigger2 = null;
private static GoslinTrigger2 checkGoslinTrigger2 = new GoslinTrigger2();
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public GoslinTrigger2 GoslinTrigger2(int myInput0)
{
return GoslinTrigger2(Input, myInput0);
}
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public GoslinTrigger2 GoslinTrigger2(Data.IDataSeries input, int myInput0)
{
checkGoslinTrigger2.MyInput0 = myInput0;
myInput0 = checkGoslinTrigger2.MyInput0;
if (cacheGoslinTrigger2 != null)
for (int idx = 0; idx < cacheGoslinTrigger2.Length; idx++)
if (cacheGoslinTrigger2[idx].MyInput0 == myInput0 && cacheGoslinTrigger2[idx].EqualsInput(input))
return cacheGoslinTrigger2[idx];
GoslinTrigger2 indicator = new GoslinTrigger2();
indicator.BarsRequired = BarsRequired;
indicator.CalculateOnBarClose = CalculateOnBarClose;
indicator.Input = input;
indicator.MyInput0 = myInput0;
indicator.SetUp();
GoslinTrigger2[] tmp = new GoslinTrigger2[cacheGoslinTrigger2 == null ? 1 : cacheGoslinTrigger2.Length + 1];
if (cacheGoslinTrigger2 != null)
cacheGoslinTrigger2.CopyTo(tmp, 0);
tmp[tmp.Length - 1] = indicator;
cacheGoslinTrigger2 = 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>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.GoslinTrigger2 GoslinTrigger2(int myInput0)
{
return _indicator.GoslinTrigger2(Input, myInput0);
}
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public Indicator.GoslinTrigger2 GoslinTrigger2(Data.IDataSeries input, int myInput0)
{
return _indicator.GoslinTrigger2(input, myInput0);
}
}
}
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
public partial class Strategy : StrategyBase
{
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.GoslinTrigger2 GoslinTrigger2(int myInput0)
{
return _indicator.GoslinTrigger2(Input, myInput0);
}
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public Indicator.GoslinTrigger2 GoslinTrigger2(Data.IDataSeries input, int myInput0)
{
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.GoslinTrigger2(input, myInput0);
}
}
}
#endregion
Comment