protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"Calculate %chg spread for the underlining pair"; Name = "GIPairPctSpd"; Calculate = Calculate.OnPriceChange; IsOverlay = false; DisplayInDataBox = true; DrawOnPricePanel = false; DrawHorizontalGridLines = true; DrawVerticalGridLines = false; 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; RocPeriod = 8; TM_OpenStartH = 8; TM_OpenStartM = 0; TM_OpenEndH = 9; TM_OpenEndM = 2; TM_ClosingH = 10; TM_ClosingM = 45; PctChgMaxBip = -1; PctChgMinBip = -1; BarsRequiredToPlot = 128; MaximumBarsLookBack = MaximumBarsLookBack.Infinite; AddPlot(Brushes.Red, "PlotPctSpd"); AddPlot(Brushes.Orange, "PlotRocSpd"); AddLine(Brushes.Blue, 0, "LineZero"); } else if (State == State.Configure) { //AddDataSeries("NQ 06-20", Data.BarsPeriodType.Minute, 13, Data.MarketDataType.Last); //AddDataSeries("RTY 06-20", Data.BarsPeriodType.Minute, 13, Data.MarketDataType.Last); //AddDataSeries("NRGU", Data.BarsPeriodType.Minute, 1, Data.MarketDataType.Last); AddDataSeries(SecondSymbol, Data.BarsPeriodType.Minute, ChartMinutes, Data.MarketDataType.Last); } else if (State == State.DataLoaded) { PctChg1 = new Series <double>(this); PctChg2 = new Series <double>(this); PctSpd = new Series <double>(this); RocChg = new Series <double>(this); Print(String.Format("{0}: DataLoaded...BarsArray.Length={1}", this.GetType().Name, BarsArray.Length)); smaClose1 = SMA(Closes[0], 5); smaClose2 = SMA(Closes[1], 5); smaPctChgRatio = SMA(RocChg, 50); stdDev = StdDev(PlotPctSpd, 7); //AddChartIndicator(stdDev); } }
//private GIATRRatio giAtrRatio; protected override void OnStateChange() { if (State == State.SetDefaults) { Description = "Pair spread by points or ratio"; Name = "GISpdRS"; IsOverlay = false; IsSuspendedWhileInactive = true; Calculate = Calculate.OnPriceChange; NumStdDevUp = 1.6; NumStdDevDown = 1.6; NumStdDevUpMin = 0.5; NumStdDevDownMin = 0.5; MAPeriod = 10; PairPriceRatio = 1.5; TM_OpenStartH = 8; TM_OpenStartM = 0; TM_OpenEndH = 8; TM_OpenEndM = 34; TM_ClosingH = 10; TM_ClosingM = 45; BarsRequiredToPlot = 128; MaximumBarsLookBack = MaximumBarsLookBack.Infinite; AddPlot(new Stroke(Brushes.Blue), PlotStyle.Dot, "Spread"); AddPlot(new Stroke(Brushes.Gold), PlotStyle.Dot, "Mean"); AddPlot(Brushes.Red, "Upper band"); //AddPlot(Brushes.Orange, "Middle band"); AddPlot(Brushes.Green, "Lower band"); } else if (State == State.Configure) { if (ChartMinutes > 0) { AddDataSeries(SecondSymbol, BarsPeriodType.Minute, ChartMinutes, MarketDataType.Last); } else { AddDataSeries(SecondSymbol, BarsPeriodType.Day, 1, MarketDataType.Last); } //Spread[0] = Closes[0][0] - Closes[1][0]; sma = SMA(Spread, MAPeriod); stdDev = StdDev(Spread, MAPeriod); PairATRRatio = GIATRRatio(ATRPeriod, SecondSymbol, ChartMinutes); this.CtxPairSpreadDaily = new CtxPairSpdDaily(); } else if (State == State.DataLoaded) { UpperMin = new Series <double>(this); LowerMin = new Series <double>(this); } }
protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"Enter the description for your new custom Indicator here."; Name = "PBS"; Calculate = Calculate.OnBarClose; IsOverlay = true; 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; Longs = true; Shorts = true; MAFilter = true; showBkg = true; Opacity = 0.1; AlertPBS = @"ES_EnteringLongZone.wav"; AlertPSS = @"ES_EnteringShortZone.wav"; AlertApproach = @"ES_ZoneTrigger.wav"; showGreen = false; maxLoss = 500.0; maxGain = 500.0; targetTicks = 8; stopTicks = 8; breakEvenTicks = 7; useBreakEven = false; } else if (State == State.Configure) { AddDataSeries("DIA", Data.BarsPeriodType.Minute, 3, Data.MarketDataType.Last); AddDataSeries("SPY", Data.BarsPeriodType.Minute, 3, Data.MarketDataType.Last); AddDataSeries("QQQ", Data.BarsPeriodType.Minute, 3, Data.MarketDataType.Last); AddDataSeries("IWM", Data.BarsPeriodType.Minute, 3, Data.MarketDataType.Last); } else if (State == State.DataLoaded) { smaFast = SMA(20); smaSlow = SMA(40); ninja_Start_Time = startTime * 100; ninja_End_Time = endTime * 100; ClearOutputWindow(); } }
protected override void OnStateChange() { if (State == State.SetDefaults) { Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionDMIndex; Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameDMIndex; IsSuspendedWhileInactive = true; IsOverlay = false; Smooth = 3; AddPlot(Brushes.DarkCyan, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameDMIndex); } else if (State == State.DataLoaded) { stdDev = StdDev(5); sma = SMA(stdDev, 10); } }
protected override void OnStateChange() { if (State == State.SetDefaults) { Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionBOP; Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameBOP; IsSuspendedWhileInactive = true; Smooth = 14; IsOverlay = false; AddPlot(new Stroke(Brushes.DodgerBlue, 2), PlotStyle.Bar, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameBOP); } else if (State == State.DataLoaded) { bop = new Series <double>(this); sma = SMA(bop, Smooth); } }
protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"Enter the description for your new custom Indicator here."; Name = "PBS Simple"; Calculate = Calculate.OnBarClose; IsOverlay = true; DisplayInDataBox = true; DrawOnPricePanel = true; DrawHorizontalGridLines = true; DrawVerticalGridLines = true; PaintPriceMarkers = true; ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right; IsSuspendedWhileInactive = true; Longs = true; Shorts = true; MAFilter = true; showBkg = true; Opacity = 0.1; AlertPBS = @"ES_EnteringLongZone.wav"; AlertPSS = @"ES_EnteringShortZone.wav"; AlertApproach = @"ES_ZoneTrigger.wav"; showGreen = false; maxLoss = 500.0; maxGain = 500.0; targetTicks = 8; stopTicks = 8; breakEvenTicks = 7; useBreakEven = false; deBug = false; } else if (State == State.Configure) { } else if (State == State.DataLoaded) { smaFast = SMA(20); smaSlow = SMA(40); ninja_Start_Time = startTime * 100; ninja_End_Time = endTime * 100; ClearOutputWindow(); } }
protected override void OnStateChange() { if (State == State.SetDefaults) { Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionStochasticsFast; Name = String.Format("Enhanced{0}", NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameStochasticsFast); IsSuspendedWhileInactive = true; PeriodD = 3; PeriodK = 14; DColor = Brushes.DodgerBlue; KColor = Brushes.Goldenrod; DetectTrends = false; Strength = 1; } else if (State == State.Configure) { AddPlot(DColor, NinjaTrader.Custom.Resource.StochasticsD); AddPlot(KColor, NinjaTrader.Custom.Resource.StochasticsK); AddPlot(new Stroke(Brushes.LightBlue, DashStyleHelper.Solid, 1), PlotStyle.Square, "TrendInfo"); AddLine(Brushes.PaleGoldenrod, 20, NinjaTrader.Custom.Resource.NinjaScriptIndicatorLower); AddLine(Brushes.PaleGoldenrod, 80, NinjaTrader.Custom.Resource.NinjaScriptIndicatorUpper); } else if (State == State.DataLoaded) { den = new Series <double>(this); nom = new Series <double>(this); min = MIN(Low, PeriodK); max = MAX(High, PeriodK); smaK = SMA(K, PeriodD); unique = Guid.NewGuid().ToString(); signal = new Series <int>(this); direction = new Series <int>(this); trendPrice = new Series <double>(this); trendStartPrice = new Series <double>(this); trendEndPrice = new Series <double>(this); crossBelowUpperThreshold = new Series <bool>(this); crossAboveLowerThreshold = new Series <bool>(this); } }
protected override void OnStateChange() { if (State == State.SetDefaults) { Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionBollinger; Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameBollinger; IsOverlay = true; IsSuspendedWhileInactive = true; NumStdDev = 2; Period = 14; AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.BollingerUpperBand); AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.BollingerMiddleBand); AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.BollingerLowerBand); } else if (State == State.DataLoaded) { sma = SMA(Period); stdDev = StdDev(Period); } }
protected override void OnStateChange() { if (State == State.SetDefaults) { Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionCCI; Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameCCI; IsSuspendedWhileInactive = true; Period = 14; AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameCCI); AddLine(Brushes.DarkGray, 200, NinjaTrader.Custom.Resource.CCILevel2); AddLine(Brushes.DarkGray, 100, NinjaTrader.Custom.Resource.CCILevel1); AddLine(Brushes.DarkGray, 0, NinjaTrader.Custom.Resource.NinjaScriptIndicatorZeroLine); AddLine(Brushes.DarkGray, -100, NinjaTrader.Custom.Resource.CCILevelMinus1); AddLine(Brushes.DarkGray, -200, NinjaTrader.Custom.Resource.CCILevelMinus2); } else if (State == State.DataLoaded) { sma = SMA(Typical, Period); } }
protected override void OnStateChange() { if (State == State.SetDefaults) { Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionDMI; Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameDMI; IsSuspendedWhileInactive = true; Period = 14; AddPlot(Brushes.DarkCyan, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameDMI); } else if (State == State.DataLoaded) { dmMinus = new Series <double>(this); dmPlus = new Series <double>(this); tr = new Series <double>(this); smaTr = SMA(tr, Period); smaDmMinus = SMA(dmMinus, Period); smaDmPlus = SMA(dmPlus, Period); } }
protected override void OnStateChange() { if (State == State.SetDefaults) { Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionBollinger; Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameBollinger; IsOverlay = true; IsSuspendedWhileInactive = true; NumStdDev = 2; Period = 14; AddPlot(Brushes.Orange, "Upper band"); AddPlot(Brushes.Orange, "Middle band"); AddPlot(Brushes.Orange, "Lower band"); } else if (State == State.Configure) { sma = SMA(Period); stdDev = StdDev(Period); } }
protected override void OnStateChange() { if (State == State.SetDefaults) { Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionKeltnerChannel; Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameKelterChannel; Period = 10; IsOverlay = true; IsSuspendedWhileInactive = true; OffsetMultiplier = 1.5; AddPlot(Brushes.DarkGray, NinjaTrader.Custom.Resource.KeltnerChannelMidline); AddPlot(Brushes.DodgerBlue, NinjaTrader.Custom.Resource.NinjaScriptIndicatorUpper); AddPlot(Brushes.DodgerBlue, NinjaTrader.Custom.Resource.NinjaScriptIndicatorLower); } else if (State == State.DataLoaded) { diff = new Series <double>(this); smaDiff = SMA(diff, Period); smaTypical = SMA(Typical, Period); } }
protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"4 SMA / 4"; Name = "BBI"; Calculate = Calculate.OnEachTick; IsOverlay = true; 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; MA1 = 3; MA2 = 6; MA3 = 12; MA4 = 24; AddPlot(Brushes.DeepSkyBlue, "BullBear"); } else if (State == State.Configure) { } else if (State == State.DataLoaded) { // initialize the SMA using the primary series and assign to sma1 sma1 = SMA(Close, Convert.ToInt32(MA1)); sma2 = SMA(Close, Convert.ToInt32(MA2)); sma3 = SMA(Close, Convert.ToInt32(MA3)); sma4 = SMA(Close, Convert.ToInt32(MA4)); } }
/// <summary> /// TTM params /// </summary> //private Series<int> barsSinceSqueeze; protected override void OnStateChange() { if (State == State.SetDefaults) { Description = "TTM = Bollinger+Keltner Channels"; Name = "GITTM"; IsOverlay = true; IsSuspendedWhileInactive = true; //BB NumStdDev = 2; Period_BB = 20; AddPlot(Brushes.Magenta, "UpperBB"); //AddPlot(Brushes.LightGray, "Middle band"); AddPlot(Brushes.Magenta, "LowerBB"); //KC Period_KC = 10; KCOffset = 1.5; //AddPlot(Brushes.DarkGray, "Midline"); AddPlot(Brushes.Blue, "UpperKC"); AddPlot(Brushes.Blue, "LowerKC"); } else if (State == State.Configure) { //BB SmaVal = SMA(Period_BB); stdDev = StdDev(Period_BB); //KC hilo_diff = new Series <double>(this); smaDiff = SMA(hilo_diff, Period_KC); smaTypical = SMA(Typical, Period_KC); //TTM BarsSinceSqueeze = new Series <int>(this); } }
protected override void OnStateChange() { if (State == State.SetDefaults) { Description = "SMA-based MACD"; Name = "SMACD"; Fast = 10; IsSuspendedWhileInactive = true; Slow = 30; Smooth = 5; AddPlot(Brushes.DarkCyan, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameMACD); AddPlot(Brushes.Crimson, NinjaTrader.Custom.Resource.NinjaScriptIndicatorAvg); AddPlot(new Stroke(Brushes.DodgerBlue, 2), PlotStyle.Bar, NinjaTrader.Custom.Resource.NinjaScriptIndicatorDiff); AddLine(Brushes.DarkGray, 0, NinjaTrader.Custom.Resource.NinjaScriptIndicatorZeroLine); } else if (State == State.DataLoaded) { fastMA = SMA(Fast); slowMA = SMA(Slow); signal = SMA(Value, Smooth); } }
//private int testCond = 0; protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"Enter the description for your new custom Indicator here."; Name = "Market Condition"; Calculate = Calculate.OnEachTick; IsOverlay = true; 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. /// show plots showBands = true; showVolatilityText = false; IsSuspendedWhileInactive = true; AddPlot(Brushes.DarkGray, "Upper"); // Stored in Plots[0] AddPlot(Brushes.DarkGray, "Lower"); // Stored in Plots[1] } else if (State == State.Configure) { atrPctSeries = new Series <double>(this, MaximumBarsLookBack.Infinite); marketCond = new Series <int>(this, MaximumBarsLookBack.Infinite); } else if (State == State.DataLoaded) { sma = SMA(200); atr = ATR(14); stdDev = StdDev(100); ClearOutputWindow(); } }
protected override void OnStateChange() { if (State == State.SetDefaults) { Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionStochasticsFast; Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameStochasticsFast; IsSuspendedWhileInactive = true; PeriodD = 3; PeriodK = 14; AddPlot(Brushes.DodgerBlue, NinjaTrader.Custom.Resource.StochasticsD); AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.StochasticsK); AddLine(Brushes.DarkCyan, 20, NinjaTrader.Custom.Resource.NinjaScriptIndicatorLower); AddLine(Brushes.DarkCyan, 80, NinjaTrader.Custom.Resource.NinjaScriptIndicatorUpper); } else if (State == State.DataLoaded) { den = new Series <double>(this); nom = new Series <double>(this); min = MIN(Low, PeriodK); max = MAX(High, PeriodK); smaK = SMA(K, PeriodD); } }
protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"SPY, QQQ and IWM Pair scalper using CV as price"; Name = "GISQRCVSpd"; Calculate = Calculate.OnPriceChange; IsOverlay = false; DisplayInDataBox = true; DrawOnPricePanel = false; DrawHorizontalGridLines = true; DrawVerticalGridLines = false; 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; CoVarPeriod = 5; CoVarScale = 10000; // CoVarHighBip = -1; // CoVarMidBip = -1; // CoVarLowBip = -1; NumStdDevUp = 1.6; NumStdDevDown = 2.6; NumStdDevUpMin = 0.5; NumStdDevDownMin = 0.5; ChartMinutes = 4; TM_OpenStartH = 11; TM_OpenStartM = 15; TM_OpenEndH = 12; TM_OpenEndM = 45; TM_ClosingH = 13; TM_ClosingM = 15; //PctChgMaxBip = -1; //PctChgMinBip = -1; BarsRequiredToPlot = 128; MaximumBarsLookBack = MaximumBarsLookBack.Infinite; QQQSymbol = "QQQ"; IWMSymbol = "IWM"; SpyLnSymbol = "SPXL"; SpyStSymbol = "SH"; QQQLnSymbol = "QLD"; QQQStSymbol = "SQQQ"; IWMLnSymbol = "TNA"; IWMStSymbol = "TZA"; SpyLnSymbolRatio = 3; //"SPXL"; SpyStSymbolRatio = 1; //"SH"; QQQLnSymbolRatio = 2; //"QLD"; QQQStSymbolRatio = 3; //"SQQQ"; IWMLnSymbolRatio = 3; //"TNA"; IWMStSymbolRatio = 3; //"TZA"; AddPlot(new Stroke(Brushes.Black), PlotStyle.Dot, "SPY"); AddPlot(new Stroke(Brushes.Orange), PlotStyle.Dot, "QQQ"); AddPlot(new Stroke(Brushes.LightSkyBlue), PlotStyle.Dot, "IWM"); AddPlot(new Stroke(Brushes.Magenta), PlotStyle.Dot, "MxMiSpread"); AddPlot(Brushes.Gray, "Mean"); AddPlot(Brushes.Red, "UpperBB"); AddPlot(Brushes.Green, "LowerBB"); //AddLine(Brushes.Blue, 0, "IWM"); } else if (State == State.Configure) { //AddDataSeries("NQ 06-20", Data.BarsPeriodType.Minute, 13, Data.MarketDataType.Last); //AddDataSeries("RTY 06-20", Data.BarsPeriodType.Minute, 13, Data.MarketDataType.Last); //AddDataSeries("NRGU", Data.BarsPeriodType.Minute, 1, Data.MarketDataType.Last); AddDataSeries(QQQSymbol, Data.BarsPeriodType.Minute, ChartMinutes, Data.MarketDataType.Last); AddDataSeries(IWMSymbol, Data.BarsPeriodType.Minute, ChartMinutes, Data.MarketDataType.Last); AddDataSeries(SpyLnSymbol, Data.BarsPeriodType.Minute, ChartMinutes, Data.MarketDataType.Last); AddDataSeries(SpyStSymbol, Data.BarsPeriodType.Minute, ChartMinutes, Data.MarketDataType.Last); AddDataSeries(QQQLnSymbol, Data.BarsPeriodType.Minute, ChartMinutes, Data.MarketDataType.Last); AddDataSeries(QQQStSymbol, Data.BarsPeriodType.Minute, ChartMinutes, Data.MarketDataType.Last); AddDataSeries(IWMLnSymbol, Data.BarsPeriodType.Minute, ChartMinutes, Data.MarketDataType.Last); AddDataSeries(IWMStSymbol, Data.BarsPeriodType.Minute, ChartMinutes, Data.MarketDataType.Last); CoVarHighBip = new Series <int>(this); CoVarMidBip = new Series <int>(this); CoVarLowBip = new Series <int>(this); //bol = Bollinger(CoVarHiLoSpread, 1.6, CoVarPeriod); } else if (State == State.DataLoaded) { // RocChg = new Series<double>(this); Print(String.Format("{0}: DataLoaded...BarsArray.Length={1}", this.GetType().Name, BarsArray.Length)); SmaSpy = SMA(BarsArray[BipSpy], CoVarPeriod); StdDevSpy = StdDev(BarsArray[BipSpy], CoVarPeriod); //CoVarSpy = StdDevSpy/SmaSpy; SmaQQQ = SMA(BarsArray[BipQQQ], CoVarPeriod); StdDevQQQ = StdDev(BarsArray[BipQQQ], CoVarPeriod); SmaIWM = SMA(BarsArray[BipIWM], CoVarPeriod); StdDevIWM = StdDev(BarsArray[BipIWM], CoVarPeriod); sma = SMA(CoVarHiLoSpread, CoVarPeriod); stdDev = StdDev(CoVarHiLoSpread, CoVarPeriod); CoVarHiLoSpdMaxMin = new DailyMaxMin(); listRocHiLoMaxMin = new List <DailyMaxMin>(); DailyCoVarHiLoMidCross = new DailyCross <int>(); // CoVarHiLoSpreadMax = double.MinValue; // CoVarHiLoSpreadMin = double.MaxValue; // smaClose1 = SMA(Closes[0], 5); // smaClose2 = SMA(Closes[1], 5); // smaPctChgRatio = SMA(RocChg, 50); //stdDev = StdDev(PlotPctSpd, 7); //AddChartIndicator(stdDev); } }