#region Using declarations
using System;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.ComponentModel;
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
{
///
///
///
[Description("")]
[Gui.Design.DisplayName("CycleIdentifierGreen")]
public class CycleIdentifierGreen : Indicator
{
#region Variables
// Wizard generated variables
private int pPriceActionFilter=1;
private int pLength=3;
private int pMajorCycleStrength=4;
private bool pUseCycleFilter=false;
private int pUseFilterSMAorRSI=1;
private int pFilterStrengthSMA=12;
private int pFilterStrengthRSI=21;
private DataSeries ZL1, CyclePrice;
private BoolSeries buySig, sellSig;
private double Strength =0.0, SweepA = 0.0, SweepB = 0.0;
private int Switch = 0, Switch2 = 0,SwitchA = 0, SwitchB = 0, SwitchC = 0, SwitchD = 0, SwitchE = 0, SwitchAA = 0, SwitchBB = 0;
private double Price1BuyA = 0.0, Price2BuyA = 0.0;
private int Price1BuyB = 1, Price2BuyB = 1;
private double Price1SellA = 0.0, Price2SellA = 0.0;
private int Price1SellB = 0, Price2SellB = 0;
private bool ActiveSwitch = true, BuySwitchA = false, BuySwitchB = false, SellSwitchA = false, SellSwitchB = false;
private int BuySellFac = 01;
private double PanelMax = 1.2, PanelMin=-1.2;
private int[] PriorSignals = new int [5] {0,0,0,0,0};
private int[] PriorDirections = new int [5] {0,0,0,0,0};
private int PriorSignalPtr = 0;
private const int BUY = 1;
private const int SELL = 2;
private const int MAJOR_BUY = 1; //these are the Plots id's for the signal, DO NOT CHANGE
private const int MAJOR_SELL = 2; //these are the Plots id's for the signal, DO NOT CHANGE
private const int MINOR_BUY = 3; //these are the Plots id's for the signal, DO NOT CHANGE
private const int MINOR_SELL = 4; //these are the Plots id's for the signal, DO NOT CHANGE
private bool Condition1, Condition2, Condition3, Condition6, RunInit=true;
private int BarOfNewSignal = -1, BarOfLastSignal = -1;
private int DirectionOfLastSignal = -1;
#endregion
///
/// This method is used to configure the indicator and is called once before any bar data is loaded.
/// This version paints dots and is cleaner
///
protected override void Initialize()
{
//NOTE: Do not change the sequence of these next 5 statements, they have constants declared above
// that identify their Plots location.
Add(new Plot(new Pen(Color.Navy,2), PlotStyle.Line, "Line"));
Add(new Plot(new Pen(Color.Lime,4), PlotStyle.Bar, "MajorCycleBuy"));
Add(new Plot(new Pen(Color.Red,4), PlotStyle.Bar, "MajorCycleSell"));
Add(new Plot(new Pen(Color.DarkGreen,2), PlotStyle.Bar, "MinorCycleBuy"));
Add(new Plot(new Pen(Color.Brown,2), PlotStyle.Bar, "MinorCycleSell"));
Add(new Plot(new Pen(Color.DarkGreen,3), PlotStyle.Dot, "BuyDot"));
Add(new Plot(new Pen(Color.Red,3), PlotStyle.Dot, "SellDot"));
Add(new Plot(new Pen(Color.Purple,4), PlotStyle.Bar, "FalseSignal"));
Add(new Line(new Pen(Color.White,1),0,"Zero"));
Add(new Line(new Pen(Color.White,1),1.2,"Max"));
Add(new Line(new Pen(Color.White,1),-1.2,"Min"));
CyclePrice = new DataSeries(this);
ZL1 = new DataSeries(this);
buySig = new BoolSeries(this);
sellSig = new BoolSeries(this);
Overlay = false;
PriceTypeSupported = false;
RunInit = true;
}
///
/// Called on each bar update event (incoming tick)
///
protected override void OnBarUpdate()
{
if(RunInit) {
Lines[1].Pen.Color = ChartControl.BackColor;
Lines[2].Pen.Color = ChartControl.BackColor;
PanelMax = Lines[1].Value * 0.8;
PanelMin = Lines[2].Value * 0.8;
RunInit = false;
}
int rnglength = 250;
if(CurrentBar=CurrentBar) break;
j++;
srange = srange + (High[i] - Low[i]);
}
range = srange / j * pLength;
if(pPriceActionFilter<=1) CyclePrice.Set(Close[0]);
else CyclePrice.Set(SMA(Close, pPriceActionFilter)[0]);
if (pUseFilterSMAorRSI == 1)
ZL1.Set(ZeroLag(CyclePrice[0], pFilterStrengthSMA, 0));
if (pUseFilterSMAorRSI == 2) {
ZL1.Set(ZeroLag(RSI_DataSeriesInput(14,1,CyclePrice)[pFilterStrengthRSI], pFilterStrengthRSI, 0));
}
if (ZL1[0] > ZL1[1])
SwitchC = 1;
if (ZL1[0] < ZL1[1])
SwitchC = 2;
if (Strength == 0)
SweepA = range;
else
SweepA = Strength;
if (RunInit)
{
RunInit=false;
Price1BuyA = CyclePrice[0];
Price1SellA = CyclePrice[0];
}
BarOfLastSignal = BarOfNewSignal;
buySig.Set(false);
sellSig.Set(false);
if (Switch > -1)
{
if (CyclePrice[0] < Price1BuyA)
{
int b=CurrentBar - Price1BuyB;
if (pUseCycleFilter && (SwitchC == 2) && BuySwitchA )
{
FalseSignal.Set(b, PanelMin);
MinorCycleBuy.Set(b, 0);
TheLine.Set(b, 0);
BarOfNewSignal = Price1BuyB;
PriorDirections[PriorSignalPtr] = BUY;
PriorSignalPtr = AddLastSignal(PriorSignalPtr, BarOfNewSignal, MINOR_BUY);
}
if (!pUseCycleFilter && BuySwitchA)
{
FalseSignal.Set(b, PanelMin);
MinorCycleBuy.Set(b, 0);
TheLine.Set(b, 0);
BarOfNewSignal = Price1BuyB;
PriorDirections[PriorSignalPtr] = BUY;
PriorSignalPtr = AddLastSignal(PriorSignalPtr, BarOfNewSignal, MINOR_BUY);
}
Price1BuyA = CyclePrice[0];
Price1BuyB = CurrentBar;
BuySwitchA = true;
}
else if (CyclePrice[0] > Price1BuyA)
{
SwitchA = CurrentBar - Price1BuyB;
if (!pUseCycleFilter)
{
MinorCycleBuy.Set(SwitchA, PanelMin);//MinorBuySell - DarkGreen
TheLine.Set(SwitchA, PanelMin);//line
BarOfNewSignal = Price1BuyB;
PriorDirections[PriorSignalPtr] = BUY;
PriorSignalPtr = AddLastSignal(PriorSignalPtr, BarOfNewSignal, MINOR_BUY);
}
if (pUseCycleFilter && SwitchC == 1)
{
MinorCycleBuy.Set(SwitchA, PanelMin); //MinorBuySell
TheLine.Set(SwitchA, PanelMin); //line
BarOfNewSignal = Price1BuyB;
PriorDirections[PriorSignalPtr] = BUY;
PriorSignalPtr = AddLastSignal(PriorSignalPtr, BarOfNewSignal, MINOR_BUY);
SwitchD = 1;
}
else
SwitchD = 0;
BuySwitchA = true;
double cyclePrice1;
if(pPriceActionFilter <= 1) cyclePrice1 = Close[SwitchA];
else cyclePrice1 = SMA(Close, pPriceActionFilter)[SwitchA];
if (ActiveSwitch)
{
Condition1 = CyclePrice[0] - cyclePrice1 >= SweepA;
}
else
{
Condition1 = CyclePrice[0] >= cyclePrice1 * (1.0 + SweepA / 1000.0);
}
if (Condition1 && SwitchA >= BuySellFac)
{
Switch = -1;
Price1SellA = CyclePrice[0];
Price1SellB = CurrentBar;
SellSwitchA = false;
BuySwitchA = false;
}
}
}
if(Switch < 1)
{
if (CyclePrice[0] > Price1SellA)
{
int b = CurrentBar - Price1SellB;
if (pUseCycleFilter && SwitchC == 1 && SellSwitchA )
{
FalseSignal.Set(b, PanelMax);
MinorCycleSell.Set(b, 0);
TheLine.Set(b, 0);
BarOfNewSignal = Price1SellB;
PriorDirections[PriorSignalPtr] = SELL;
PriorSignalPtr = AddLastSignal(PriorSignalPtr, BarOfNewSignal, MINOR_SELL);
}
if (!pUseCycleFilter && SellSwitchA )
{
FalseSignal.Set(b, PanelMax);
MinorCycleSell.Set(b, 0);
TheLine.Set(b, 0);
BarOfNewSignal = Price1SellB;
PriorDirections[PriorSignalPtr] = SELL;
PriorSignalPtr = AddLastSignal(PriorSignalPtr, BarOfNewSignal, MINOR_SELL);
}
Price1SellA = CyclePrice[0];
Price1SellB = CurrentBar;
SellSwitchA = true;
}
else if (CyclePrice[0] < Price1SellA)
{
SwitchA = CurrentBar - Price1SellB;
if (!pUseCycleFilter)
{
MinorCycleSell.Set(SwitchA, PanelMax);
TheLine.Set(SwitchA, PanelMax);
BarOfNewSignal = Price1SellB;
PriorDirections[PriorSignalPtr] = SELL;
PriorSignalPtr = AddLastSignal(PriorSignalPtr, BarOfNewSignal, MINOR_SELL);
}
if (pUseCycleFilter && SwitchC == 2)
{
MinorCycleSell.Set(SwitchA, PanelMax);
TheLine.Set(SwitchA, PanelMax);
BarOfNewSignal = Price1SellB;
PriorDirections[PriorSignalPtr] = SELL;
PriorSignalPtr = AddLastSignal(PriorSignalPtr, BarOfNewSignal, MINOR_SELL);
SwitchD = 2;
}
else
SwitchD = 0;
SellSwitchA = true;
double cyclePrice2 = SMA(Close, pPriceActionFilter)[SwitchA];
if (ActiveSwitch)
Condition1 = (cyclePrice2 - CyclePrice[0]) >= SweepA;
else
Condition1 = CyclePrice[0] <= (cyclePrice2 * (1.0 - SweepA / 1000.0));
if (Condition1 && SwitchA >= BuySellFac)
{
Switch = 1;
Price1BuyA = CyclePrice[0];
Price1BuyB = CurrentBar;
SellSwitchA = false;
BuySwitchA = false;
}
}
}
TheLine.Set(0);
MinorCycleBuy.Set(0);
MinorCycleSell.Set(0);
if (Strength == 0)
SweepB = range * pMajorCycleStrength;
else
SweepB = Strength * pMajorCycleStrength;
if (CurrentBar == 1)
{
Price2BuyA = CyclePrice[0];
Price2SellA = CyclePrice[0];
}
#region Major Cycle
if (CurrentBar > 1)
{
if (Switch2 > - 1)
{
if (CyclePrice[0] < Price2BuyA)
{
int b = CurrentBar - Price2BuyB;
if (pUseCycleFilter && SwitchC == 2 && BuySwitchB )
{
MajorCycleBuy.Set(b, 0);
}
if (!pUseCycleFilter && BuySwitchB )
{
MajorCycleBuy.Set(b, 0);
}
Price2BuyA = CyclePrice[0];
Price2BuyB = CurrentBar;
BuySwitchB = true;
}
else if (CyclePrice[0] > Price2BuyA)
{
SwitchB = CurrentBar - Price2BuyB;
if (!pUseCycleFilter)
{
MajorCycleBuy.Set(SwitchB, PanelMin);
}
if (pUseCycleFilter && SwitchC == 1)
{
MajorCycleBuy.Set(SwitchB, PanelMin);
SwitchE = 1;
}
else
SwitchE = 0;
BuySwitchB = true;
double cyclePrice3;
if(pPriceActionFilter == 1) cyclePrice3 = Close[SwitchB];
else cyclePrice3 = SMA(Close, pPriceActionFilter)[SwitchB];
if (ActiveSwitch)
Condition6 = CyclePrice[0] - cyclePrice3 >= SweepB;
else
Condition6 = CyclePrice[0] >= cyclePrice3 * (1.0 + SweepB / 1000.0);
if (Condition6 && SwitchB >= BuySellFac)
{
Switch2 = -1;
Price2SellA = CyclePrice[0];
Price2SellB = CurrentBar;
SellSwitchB = false;
BuySwitchB = false;
}
}
}
if (Switch2 < 1)
{
if (CyclePrice[0] > Price2SellA )
{
int b = CurrentBar - Price2SellB;
if (pUseCycleFilter && SwitchC == 1 && SellSwitchB )
{
MajorCycleSell.Set(b, 0);
}
if (!pUseCycleFilter && SellSwitchB )
{
MajorCycleSell.Set(b, 0);
}
Price2SellA = CyclePrice[0];
Price2SellB = CurrentBar;
SellSwitchB = true;
}
else if (CyclePrice[0] < Price2SellA)
{
SwitchB = CurrentBar - Price2SellB ;
if (!pUseCycleFilter)
{
MajorCycleSell.Set(SwitchB, PanelMax);
}
if (pUseCycleFilter && SwitchC == 2)
{
MajorCycleSell.Set(SwitchB, PanelMax);
SwitchE = 2;
}
else
SwitchE = 0;
SellSwitchB = true;
double cyclePrice4;
if(pPriceActionFilter == 1) cyclePrice4 = Close[SwitchB];
else cyclePrice4 = SMA(Close, pPriceActionFilter)[SwitchB];
if (ActiveSwitch)
Condition6 = cyclePrice4 - CyclePrice[0] >= SweepB;
else
Condition6 = CyclePrice[0] <= cyclePrice4 * (1.0 - SweepB / 1000.0);
if (Condition6 && SwitchB >= BuySellFac)
{
Switch2 = 1;
Price2BuyA = CyclePrice[0];
Price2BuyB = CurrentBar;
SellSwitchB = false;
BuySwitchB = false;
}
}
}
}
#endregion
TheLine.Set(0);
MajorCycleSell.Set(0);
MajorCycleBuy.Set(0);
if(DirectionOfLastSignal == BUY) {BuyDot.Set(0);}
if(DirectionOfLastSignal == BUY)
{
buySig.Set(true);
sellSig.Set(false);
//BackColor = Color.LimeGreen;
}
if(DirectionOfLastSignal == SELL) {SellDot.Set(0);}
if(DirectionOfLastSignal == SELL)
{
buySig.Set(false);
sellSig.Set(true);
//BackColor = Color.PaleVioletRed;
}
Print("Indicator Test2 Time: " + Time[0] + " BuySignal: " + buySig + " SellSignal: " + sellSig);
}
private double ZeroLag(double price, int length, int pos)
{
if (length < 3)
return(price);
double aa = Math.Exp(-1.414*3.14159 / length);
double bb = 2*aa*Math.Cos(1.414*180 / length);
double CB = bb;
double CC = -aa*aa;
double CA = 1 - CB - CC;
double CD = CA*price + CB*ZL1[pos+1] + CC*ZL1[pos+2];
return(CD);
}
//===========================================================================
private int AddLastSignal(int PriorSignalPtr, int SignalBar, int SignalId)
{
int ptr = PriorSignalPtr - 1;
if(ptr<0) ptr = PriorSignals.Length-1;
if(PriorSignals[ptr] == SignalBar) return PriorSignalPtr;
ptr = PriorSignalPtr;
PriorSignals[PriorSignalPtr]=SignalBar;
PriorSignalPtr++;
if(PriorSignalPtr>=PriorSignals.Length) PriorSignalPtr = 0;
if(SignalId == MINOR_BUY) {DirectionOfLastSignal=BUY;}// Print(ptr+" Adding MinorBuy to "+SignalBar);}
if(SignalId == MINOR_SELL) {DirectionOfLastSignal=SELL;}// Print(ptr+" Adding MinorSell to "+SignalBar);}
if(SignalId == MAJOR_BUY) {DirectionOfLastSignal=BUY;}// Print(ptr+" Adding MajorBuy to "+SignalBar);}
if(SignalId == MAJOR_SELL) {DirectionOfLastSignal=SELL;}// Print(ptr+" Adding MajorSell to "+SignalBar);}
for(int b = 0; b <= CurrentBar-SignalBar; b++) {
if (PriorDirections[ptr] == BUY) {BuyDot.Set(b,0); SellDot.Reset(b);}
else if(PriorDirections[ptr] == SELL) {SellDot.Set(b,0); BuyDot.Reset(b);}
}
return PriorSignalPtr;
}
//===========================================================================
private int DeleteLastSignal(int PriorSignalPtr, int AbsoluteBarToDelete, int SignalId)
{
int ptr = PriorSignalPtr-1;
if(ptr<0) ptr = PriorSignals.Length-1;
if(PriorSignals[ptr] != AbsoluteBarToDelete) return PriorSignalPtr; //exit out, not the right bar to delete
if(SignalId == MINOR_BUY) Print(ptr+" Deleting MinorBuy from "+PriorSignals[ptr]);
if(SignalId == MINOR_SELL) Print(ptr+" Deleting MinorSell from "+PriorSignals[ptr]);
if(SignalId == MAJOR_BUY) Print(ptr+" Deleting MajorBuy from "+PriorSignals[ptr]);
if(SignalId == MAJOR_SELL) Print(ptr+" Deleting MajorSell from "+PriorSignals[ptr]);
int s = ptr-1; //'s' now points to the actual last signal
if(s<0) s = PriorSignals.Length-1;
BarOfNewSignal = PriorSignals[s];
if (PriorDirections[s] == SELL) {DirectionOfLastSignal = SELL;}
else if(PriorDirections[s] == BUY) {DirectionOfLastSignal = BUY;}
for(int b = 0; b <= CurrentBar - BarOfNewSignal; b++) {
if (DirectionOfLastSignal == BUY) {BuyDot.Set(b,0); SellDot.Reset(b);}
else if(DirectionOfLastSignal == SELL) {SellDot.Set(b,0); BuyDot.Reset(b);}
}
return ptr;
}
//===========================================================================
#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 TheLine
{
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 MajorCycleBuy
{
get { return Values[1]; }
}
[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 MajorCycleSell
{
get { return Values[2]; }
}
[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 MinorCycleBuy
{
get { return Values[3]; }
}
[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 MinorCycleSell
{
get { return Values[4]; }
}
[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 BuyDot
{
get { return Values[5]; }
}
[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 SellDot
{
get { return Values[6]; }
}
[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 FalseSignal
{
get { return Values[7]; }
}
[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 BoolSeries BuySig
{
get { return buySig; }
}
[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 BoolSeries SellSig
{
get { return sellSig; }
}
[Description("")]
[Category("Parameters")]
public int Length
{
get { return pLength; }
set { pLength = value; }
}
[Description("")]
[Category("Parameters")]
public int MajorCycleStrength
{
get { return pMajorCycleStrength; }
set { pMajorCycleStrength = value; }
}
[Description("")]
[Category("Parameters")]
public int FilterStrengthSMA
{
get { return pFilterStrengthSMA; }
set { pFilterStrengthSMA = value; }
}
[Description("")]
[Category("Parameters")]
public int FilterStrengthRSI
{
get { return pFilterStrengthRSI; }
set { pFilterStrengthRSI = value; }
}
[Description("")]
[Category("Parameters")]
public int PriceActionFilter
{
get { return pPriceActionFilter; }
set { pPriceActionFilter = value; }
}
[Description("")]
[Category("Parameters")]
public int UseFilterSMAorRSI
{
get { return pUseFilterSMAorRSI; }
set { pUseFilterSMAorRSI = value; }
}
[Description("")]
[Category("Parameters")]
public bool UseCycleFilter
{
get { return pUseCycleFilter; }
set { pUseCycleFilter = 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 CycleIdentifierGreen[] cacheCycleIdentifierGreen = null;
private static CycleIdentifierGreen checkCycleIdentifierGreen = new CycleIdentifierGreen();
///
///
///
///
public CycleIdentifierGreen CycleIdentifierGreen(int filterStrengthRSI, int filterStrengthSMA, int length, int majorCycleStrength, int priceActionFilter, bool useCycleFilter, int useFilterSMAorRSI)
{
return CycleIdentifierGreen(Input, filterStrengthRSI, filterStrengthSMA, length, majorCycleStrength, priceActionFilter, useCycleFilter, useFilterSMAorRSI);
}
///
///
///
///
public CycleIdentifierGreen CycleIdentifierGreen(Data.IDataSeries input, int filterStrengthRSI, int filterStrengthSMA, int length, int majorCycleStrength, int priceActionFilter, bool useCycleFilter, int useFilterSMAorRSI)
{
checkCycleIdentifierGreen.FilterStrengthRSI = filterStrengthRSI;
filterStrengthRSI = checkCycleIdentifierGreen.FilterStrengthRSI;
checkCycleIdentifierGreen.FilterStrengthSMA = filterStrengthSMA;
filterStrengthSMA = checkCycleIdentifierGreen.FilterStrengthSMA;
checkCycleIdentifierGreen.Length = length;
length = checkCycleIdentifierGreen.Length;
checkCycleIdentifierGreen.MajorCycleStrength = majorCycleStrength;
majorCycleStrength = checkCycleIdentifierGreen.MajorCycleStrength;
checkCycleIdentifierGreen.PriceActionFilter = priceActionFilter;
priceActionFilter = checkCycleIdentifierGreen.PriceActionFilter;
checkCycleIdentifierGreen.UseCycleFilter = useCycleFilter;
useCycleFilter = checkCycleIdentifierGreen.UseCycleFilter;
checkCycleIdentifierGreen.UseFilterSMAorRSI = useFilterSMAorRSI;
useFilterSMAorRSI = checkCycleIdentifierGreen.UseFilterSMAorRSI;
if (cacheCycleIdentifierGreen != null)
for (int idx = 0; idx < cacheCycleIdentifierGreen.Length; idx++)
if (cacheCycleIdentifierGreen[idx].FilterStrengthRSI == filterStrengthRSI && cacheCycleIdentifierGreen[idx].FilterStrengthSMA == filterStrengthSMA && cacheCycleIdentifierGreen[idx].Length == length && cacheCycleIdentifierGreen[idx].MajorCycleStrength == majorCycleStrength && cacheCycleIdentifierGreen[idx].PriceActionFilter == priceActionFilter && cacheCycleIdentifierGreen[idx].UseCycleFilter == useCycleFilter && cacheCycleIdentifierGreen[idx].UseFilterSMAorRSI == useFilterSMAorRSI && cacheCycleIdentifierGreen[idx].EqualsInput(input))
return cacheCycleIdentifierGreen[idx];
CycleIdentifierGreen indicator = new CycleIdentifierGreen();
indicator.BarsRequired = BarsRequired;
indicator.CalculateOnBarClose = CalculateOnBarClose;
indicator.Input = input;
indicator.FilterStrengthRSI = filterStrengthRSI;
indicator.FilterStrengthSMA = filterStrengthSMA;
indicator.Length = length;
indicator.MajorCycleStrength = majorCycleStrength;
indicator.PriceActionFilter = priceActionFilter;
indicator.UseCycleFilter = useCycleFilter;
indicator.UseFilterSMAorRSI = useFilterSMAorRSI;
indicator.SetUp();
CycleIdentifierGreen[] tmp = new CycleIdentifierGreen[cacheCycleIdentifierGreen == null ? 1 : cacheCycleIdentifierGreen.Length + 1];
if (cacheCycleIdentifierGreen != null)
cacheCycleIdentifierGreen.CopyTo(tmp, 0);
tmp[tmp.Length - 1] = indicator;
cacheCycleIdentifierGreen = 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
{
///
///
///
///
[Gui.Design.WizardCondition("Indicator")]
public Indicator.CycleIdentifierGreen CycleIdentifierGreen(int filterStrengthRSI, int filterStrengthSMA, int length, int majorCycleStrength, int priceActionFilter, bool useCycleFilter, int useFilterSMAorRSI)
{
return _indicator.CycleIdentifierGreen(Input, filterStrengthRSI, filterStrengthSMA, length, majorCycleStrength, priceActionFilter, useCycleFilter, useFilterSMAorRSI);
}
///
///
///
///
public Indicator.CycleIdentifierGreen CycleIdentifierGreen(Data.IDataSeries input, int filterStrengthRSI, int filterStrengthSMA, int length, int majorCycleStrength, int priceActionFilter, bool useCycleFilter, int useFilterSMAorRSI)
{
return _indicator.CycleIdentifierGreen(input, filterStrengthRSI, filterStrengthSMA, length, majorCycleStrength, priceActionFilter, useCycleFilter, useFilterSMAorRSI);
}
}
}
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
public partial class Strategy : StrategyBase
{
///
///
///
///
[Gui.Design.WizardCondition("Indicator")]
public Indicator.CycleIdentifierGreen CycleIdentifierGreen(int filterStrengthRSI, int filterStrengthSMA, int length, int majorCycleStrength, int priceActionFilter, bool useCycleFilter, int useFilterSMAorRSI)
{
return _indicator.CycleIdentifierGreen(Input, filterStrengthRSI, filterStrengthSMA, length, majorCycleStrength, priceActionFilter, useCycleFilter, useFilterSMAorRSI);
}
///
///
///
///
public Indicator.CycleIdentifierGreen CycleIdentifierGreen(Data.IDataSeries input, int filterStrengthRSI, int filterStrengthSMA, int length, int majorCycleStrength, int priceActionFilter, bool useCycleFilter, int useFilterSMAorRSI)
{
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.CycleIdentifierGreen(input, filterStrengthRSI, filterStrengthSMA, length, majorCycleStrength, priceActionFilter, useCycleFilter, useFilterSMAorRSI);
}
}
}
#endregion