├── Indicators ├── NadarayaWatsonEnvelopeWithATRNonRepaint.cs ├── NadarayaWatsonEnvelopeWithKernelRegNR.cs ├── NadarayaWatsonRationalQuadraticKernel.cs ├── RangeFilterSimple.cs ├── RipsterEMAClouds.cs ├── TOSignals.cs └── TwinRangeFilter.cs ├── README.md ├── Strategies └── ArchReactor │ ├── AR_Blt_Crossovers.cs │ ├── AR_Dimati_VWAP_MACD.cs │ ├── AR_HMA_B4_Strategy.cs │ ├── AR_NQ_ES_EZ.cs │ ├── AR_NadarayaWatson_RSI_Strategy.cs │ ├── AR_Swing_Breakout.cs │ ├── AR_Swing_Breakout_With_RipsterEMA_Filter.cs │ ├── AR_gbrm_CL_BB_MACD.cs │ └── ArchReactorAlgoBase.cs ├── Templates └── Strategy │ ├── ArchReactor.AR_HMA_B4_Strategy │ ├── AR_HMA_B4_Runner_NQ_40_8_ShortTarget_NoRunner.xml │ ├── AR_HMA_B4_Runner_ShortTarget.xml │ ├── AR_HMA_B4_Strategy_ES_NinzaRenko_10-2_HMA16_12-15-23_smaller_target.xml │ ├── AR_HMA_B4_Strategy_ES_NinzaRenko_10-2_HMA22_12-20-23_2C-10TP-10Stop.xml │ ├── AR_HMA_B4_Strategy_ES_NinzaRenko_10-2_HMA22__2C-10TP-12Stop-1runner_RR_0.83 (2).xml │ ├── AR_HMA_B4_Strategy_ES_NinzaRenko_10-2_HMA22__2C-10TP-12Stop-1runner_RR_0.83.xml │ └── AR_HMA_B4_Strategy_ES_NinzaRenko_40-4_HMA16_12-13-23_medium_target.xml │ ├── ArchReactor.AR_NQ_ES_EZ │ └── AR_NQ_ES_EZ.xml │ ├── ArchReactor.AR_NadarayaWatson_RSI_Strategy │ ├── 1000_tick_no_runner.xml │ ├── 1000_tick_with_runner.xml │ ├── 45days_1.43.xml │ ├── AR_NadarayaWatson_RSI_Strategy_ES_5_Minute_12-14-24_small_target-stop.xml │ └── AR_Nadaraya_Watson_RSI_NQ_1000_Tick_SmallTarget_Runner_ATR_StopLoss.xml │ ├── ArchReactor.AR_Swing_Breakout │ ├── AR-Swing_for_ES_14-1_brick.xml │ ├── AR-Swing_for_NQ_24-2_brick.xml │ ├── AR_Swing_Breakout_CL_16-1_30TP-20STP-1.5Mult-15offsetRunner_20-10Trail-test_1730.xml │ ├── AR_Swing_Breakout_ES_22-2_Runner.xml │ ├── AR_Swing_Breakout_ES_22-2_Runner_NoTrail.xml │ ├── AR_Swing_Breakout_ES_Low_Strength-1C-1runner-ATRProffit-15STP_01-13-24.xml │ ├── AR_Swing_Breakout_M2K_16-1_20TP-12STP-RunnerATRTrail.xml │ ├── AR_Swing_Breakout_MCL_16-1Ninza_ATR-TP-15STP-Runner_20-14ATRTrail-01-10-24.xml │ ├── AR_Swing_Breakout_NQ_22-2_NoRunner.xml │ └── NQ_Rip_12-5am.xml │ └── ArchReactor.AR_Swing_Breakout_With_RipsterEMA_Filter │ ├── AR_Swing_Breakout_CL_16-1_30TP-20STP-1.5Mult-15offsetRunner_20-10Trail-test_1730.xml │ ├── AR_Swing_Breakout_MCL_16-1Ninza_ATR-TP-15STP-Runner_20-14ATRTrail-01-10-24.xml │ ├── AR_Swing_Ripster_ES_Runner_NoTrsil.xml │ ├── AR_Swing_With_Ripster_Runner_NoTrail.xml │ ├── ES_Swing-AR_with_Ripster.xml │ └── GC_Rip_12-5am.xml └── images └── istockphoto-508408464-612x612.jpg /Indicators/NadarayaWatsonEnvelopeWithATRNonRepaint.cs: -------------------------------------------------------------------------------- 1 | #region Using declarations 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.ComponentModel.DataAnnotations; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Xml.Serialization; 13 | using NinjaTrader.Cbi; 14 | using NinjaTrader.Gui; 15 | using NinjaTrader.Gui.Chart; 16 | using NinjaTrader.Gui.SuperDom; 17 | using NinjaTrader.Gui.Tools; 18 | using NinjaTrader.Data; 19 | using NinjaTrader.NinjaScript; 20 | using NinjaTrader.Core.FloatingPoint; 21 | using NinjaTrader.NinjaScript.DrawingTools; 22 | #endregion 23 | 24 | //This namespace holds Indicators in this folder and is required. Do not change it. 25 | namespace NinjaTrader.NinjaScript.Indicators 26 | { 27 | public class NadarayaWatsonEnvelopeWithATRNonRepaint : Indicator 28 | { 29 | private int size; 30 | private Series yhat1; 31 | private Series yhat2; 32 | 33 | private DashStyleHelper dash0Style = DashStyleHelper.Solid; 34 | private PlotStyle plot0Style = PlotStyle.Line; 35 | 36 | private Brush upColor = Brushes.Lime; 37 | private Brush downColor = Brushes.Red; 38 | double y1 = 0.0; 39 | double y2 = 0.0; 40 | private ADX adx; 41 | private Series trend; 42 | 43 | private Series signal; // for buy = 1 and sell = -1 44 | private Series midBandSignalChange; 45 | 46 | protected override void OnStateChange() 47 | { 48 | if (State == State.SetDefaults) 49 | { 50 | Description = @"Enter the description for your new custom Indicator here."; 51 | Name = "NadarayaWatsonEnvelopeWithATRNonRepaint"; 52 | Calculate = Calculate.OnEachTick; 53 | IsOverlay = true; 54 | DisplayInDataBox = true; 55 | DrawOnPricePanel = true; 56 | DrawHorizontalGridLines = true; 57 | DrawVerticalGridLines = true; 58 | PaintPriceMarkers = true; 59 | ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right; 60 | //Disable this property if your indicator requires custom values that cumulate with each new market data event. 61 | //See Help Guide for additional information. 62 | IsSuspendedWhileInactive = true; 63 | H = 8; 64 | R = 8; 65 | X_0 = 25; 66 | ShowMiddle = true; 67 | SmoothColors = false; 68 | Lag = 2; 69 | ATR_Length = 32; 70 | Multiplier = 2.7; 71 | ADX_Filter = true; // Adding RSI to filter out buy and sell signals; 72 | ADX_Period = 14; 73 | ADX_Min = 25; 74 | AddPlot(Brushes.AntiqueWhite, "MiddleBand"); 75 | AddPlot(Brushes.Chartreuse, "UpperBand"); 76 | AddPlot(Brushes.Crimson, "LowerBand"); 77 | AddPlot(new Stroke(Brushes.Green, 8), PlotStyle.TriangleUp, "UpSignal"); 78 | AddPlot(new Stroke(Brushes.Red, 8), PlotStyle.TriangleDown, "DnSignal"); 79 | AddPlot(new Stroke(Brushes.Red, 3), PlotStyle.Dot, "MidBandSignal"); 80 | 81 | } 82 | else if (State == State.Configure) 83 | { 84 | yhat1 = new Series(this, MaximumBarsLookBack.Infinite); 85 | yhat2 = new Series(this, MaximumBarsLookBack.Infinite); 86 | signal = new Series(this, MaximumBarsLookBack.Infinite); 87 | midBandSignalChange = new Series(this, MaximumBarsLookBack.Infinite); 88 | adx = ADX(Input, ADX_Period); 89 | trend = new Series(this); 90 | } 91 | } 92 | 93 | protected override void OnBarUpdate() 94 | { 95 | //Add your custom indicator logic here. 96 | 97 | if (CurrentBar < X_0) { 98 | LowerBand[0] = Input[0]; 99 | UpperBand[0] = Input[0]; 100 | MiddleBand[0] = Input[0]; 101 | size = 0; 102 | yhat1[0] = 0.0; 103 | yhat2[0] = 0.0; 104 | return; 105 | } 106 | 107 | size = Close.Count; 108 | 109 | yhat1[0] = kernel_regression(1, H); 110 | 111 | yhat2[0] = kernel_regression(1, H-Lag); 112 | 113 | bool wasBearish = yhat1[2] > yhat1[1]; 114 | bool wasBullish = yhat1[2] < yhat1[1]; 115 | bool isBearish = yhat1[1] > yhat1[0]; 116 | bool isBullish = yhat1[1] < yhat1[0]; 117 | bool isBearishChange = isBearish && wasBullish; 118 | bool isBullishChange = isBullish && wasBearish; 119 | 120 | bool isBullishCross = CrossAbove(yhat2, yhat1, 1); 121 | bool isBearishCross = CrossBelow(yhat2, yhat1, 1); 122 | bool isBullishSmooth = yhat2[0] > yhat1[0]; 123 | bool isBearishSmooth = yhat2[0] < yhat1[0]; 124 | 125 | Brush colorByCross = isBullishSmooth ? upColor : downColor; 126 | Brush colorByRate = isBullish ? upColor : downColor; 127 | 128 | 129 | Brush plotColor = SmoothColors ? colorByCross : colorByRate; 130 | 131 | MiddleBand[0] = yhat1[0]; 132 | 133 | PlotBrushes[0][0] = plotColor; 134 | PlotBrushes[5][0] = plotColor; 135 | if (SmoothColors) { 136 | if (isBearishCross) { 137 | MidBandSignal[0] = High[0]; 138 | midBandSignalChange[0] = -1; 139 | } else if (isBullishCross) { 140 | MidBandSignal[0] = Low[0]; 141 | midBandSignalChange[0] = 1; 142 | } 143 | } else { 144 | if (isBearishChange) { 145 | midBandSignalChange[0] = -1; 146 | MidBandSignal[0] = High[0]; 147 | } else if (isBullishChange) { 148 | MidBandSignal[0] = Low[0]; 149 | midBandSignalChange[0] = 1; 150 | } 151 | } 152 | 153 | if (isBullish) trend[0] = 1; 154 | if (isBearish) trend[0] = -1; 155 | 156 | UpperBand[0] = yhat1[0] + Multiplier*ATR(ATR_Length)[0]; 157 | LowerBand[0] = yhat1[0] - Multiplier*ATR(ATR_Length)[0]; 158 | signal[0] = 0; 159 | //if (Low[1] < LowerBand[1] && Close[1] < Open[1] && Close[0] > Open[0]) { 160 | if (Close[0] > Open[0] && Low[0] < LowerBand[0] && High[0] > LowerBand[0] && signal[1] != 1) { 161 | if (ADX_Filter) { 162 | if (adx[0] > ADX_Min) { 163 | UpSignal[0] = Low[0] - 2 * TickSize; 164 | signal[0] = 1; 165 | } 166 | } else { 167 | UpSignal[0] = Low[0] - 2 * TickSize; 168 | signal[0] = 1; 169 | } 170 | } 171 | //else if (High[1] > UpperBand[1] && Close[1] > Open[1] && Close[0] < Open[0]) { 172 | else if (Close[0] < Open[0] && High[0] > UpperBand[0] && Low[0] < UpperBand[0] && signal[1] != -1) { 173 | if (ADX_Filter) { 174 | if (adx[0] > ADX_Min) { 175 | DnSignal[0] = High[0] + 2 * TickSize; 176 | signal[0] = -1; 177 | } 178 | } else { 179 | DnSignal[0] = High[0] + 2 * TickSize; 180 | signal[0] = -1; 181 | } 182 | } 183 | } 184 | 185 | private double kernel_regression(int _size, double _h) { 186 | double _currentWeight = 0.0; 187 | double _cumulativeWeight = 0.0; 188 | for (int i = 0 ; i < (_size + X_0); i++) { 189 | double y = Close[i]; 190 | double w = Math.Pow(1 + (Math.Pow(i, 2) / ((Math.Pow(_h,2)*2*R))), -R); 191 | _currentWeight += y*w; 192 | _cumulativeWeight += w; 193 | } 194 | if (_cumulativeWeight != 0.0) 195 | { 196 | return _currentWeight / _cumulativeWeight; 197 | } 198 | else 199 | { 200 | return 0.0; // Handle division by zero or very small cumulativeWeight 201 | } 202 | } 203 | 204 | #region Properties 205 | [NinjaScriptProperty] 206 | [Range(3, double.MaxValue)] 207 | [Display(Name="H", Description="Lookback Window", Order=1, GroupName="Parameters")] 208 | public double H 209 | { get; set; } 210 | 211 | [NinjaScriptProperty] 212 | [Range(1, double.MaxValue)] 213 | [Display(Name="R", Description="Relative Weighting", Order=2, GroupName="Parameters")] 214 | public double R 215 | { get; set; } 216 | 217 | [NinjaScriptProperty] 218 | [Range(1, int.MaxValue)] 219 | [Display(Name="X_0", Description="Start Regression at Bar", Order=3, GroupName="Parameters")] 220 | public int X_0 221 | { get; set; } 222 | 223 | [NinjaScriptProperty] 224 | [Display(Name="ShowMiddle", Description="Show middle band", Order=4, GroupName="Parameters")] 225 | public bool ShowMiddle 226 | { get; set; } 227 | 228 | [NinjaScriptProperty] 229 | [Display(Name="SmoothColors", Description="Smooth Colors", Order=5, GroupName="Parameters")] 230 | public bool SmoothColors 231 | { get; set; } 232 | 233 | [NinjaScriptProperty] 234 | [Range(1, int.MaxValue)] 235 | [Display(Name="Lag", Order=6, GroupName="Parameters")] 236 | public int Lag 237 | { get; set; } 238 | 239 | [NinjaScriptProperty] 240 | [Range(1, int.MaxValue)] 241 | [Display(Name="ATR_Length", Description="ATR Length", Order=7, GroupName="Parameters")] 242 | public int ATR_Length 243 | { get; set; } 244 | 245 | [NinjaScriptProperty] 246 | [Range(1, double.MaxValue)] 247 | [Display(Name="Multiplier", Description="Multiplier", Order=8, GroupName="Parameters")] 248 | public double Multiplier 249 | { get; set; } 250 | 251 | [NinjaScriptProperty] 252 | [Display(Name="ADX Filtering", Description="Enable/Disable Buy Sell Signal Filtering with ADX", Order=9, GroupName="Buy Sell Signal Filtering with ADX")] 253 | public bool ADX_Filter 254 | { get; set; } 255 | 256 | [NinjaScriptProperty] 257 | [Range(1, int.MaxValue)] 258 | [Display(Name="ADX Period", Description="ADX Period", Order=10, GroupName="Buy Sell Signal Filtering with ADX")] 259 | public int ADX_Period 260 | { get; set; } 261 | 262 | [NinjaScriptProperty] 263 | [Range(1, int.MaxValue)] 264 | [Display(Name="ADX Minimum", Description="ADX Minimum value to filter", Order=10, GroupName="Buy Sell Signal Filtering with RSI")] 265 | public int ADX_Min 266 | { get; set; } 267 | 268 | [Browsable(false)] 269 | [XmlIgnore] 270 | public Series MiddleBand 271 | { 272 | get { return Values[0]; } 273 | } 274 | 275 | [Browsable(false)] 276 | [XmlIgnore] 277 | public Series UpperBand 278 | { 279 | get { return Values[1]; } 280 | } 281 | 282 | [Browsable(false)] 283 | [XmlIgnore] 284 | public Series LowerBand 285 | { 286 | get { return Values[2]; } 287 | } 288 | 289 | [Browsable(false)] 290 | [XmlIgnore] 291 | public Series UpSignal 292 | { 293 | get { return Values[3]; } 294 | } 295 | 296 | [Browsable(false)] 297 | [XmlIgnore] 298 | public Series DnSignal 299 | { 300 | get { return Values[4]; } 301 | } 302 | 303 | [Browsable(false)] 304 | [XmlIgnore] 305 | public Series MidBandSignal 306 | { 307 | get { return Values[5]; } 308 | } 309 | 310 | [Browsable(false)] 311 | [XmlIgnore] 312 | public Series Trend 313 | { 314 | get { return trend; } 315 | } 316 | 317 | [Browsable(false)] 318 | [XmlIgnore] 319 | public Series Signal 320 | { 321 | get { return signal; } 322 | } 323 | 324 | [Browsable(false)] 325 | [XmlIgnore] 326 | public Series MidBandSignalChange 327 | { 328 | get { return midBandSignalChange; } 329 | } 330 | #endregion 331 | 332 | } 333 | } 334 | 335 | #region NinjaScript generated code. Neither change nor remove. 336 | 337 | namespace NinjaTrader.NinjaScript.Indicators 338 | { 339 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase 340 | { 341 | private NadarayaWatsonEnvelopeWithATRNonRepaint[] cacheNadarayaWatsonEnvelopeWithATRNonRepaint; 342 | public NadarayaWatsonEnvelopeWithATRNonRepaint NadarayaWatsonEnvelopeWithATRNonRepaint(double h, double r, int x_0, bool showMiddle, bool smoothColors, int lag, int aTR_Length, double multiplier, bool aDX_Filter, int aDX_Period, int aDX_Min) 343 | { 344 | return NadarayaWatsonEnvelopeWithATRNonRepaint(Input, h, r, x_0, showMiddle, smoothColors, lag, aTR_Length, multiplier, aDX_Filter, aDX_Period, aDX_Min); 345 | } 346 | 347 | public NadarayaWatsonEnvelopeWithATRNonRepaint NadarayaWatsonEnvelopeWithATRNonRepaint(ISeries input, double h, double r, int x_0, bool showMiddle, bool smoothColors, int lag, int aTR_Length, double multiplier, bool aDX_Filter, int aDX_Period, int aDX_Min) 348 | { 349 | if (cacheNadarayaWatsonEnvelopeWithATRNonRepaint != null) 350 | for (int idx = 0; idx < cacheNadarayaWatsonEnvelopeWithATRNonRepaint.Length; idx++) 351 | if (cacheNadarayaWatsonEnvelopeWithATRNonRepaint[idx] != null && cacheNadarayaWatsonEnvelopeWithATRNonRepaint[idx].H == h && cacheNadarayaWatsonEnvelopeWithATRNonRepaint[idx].R == r && cacheNadarayaWatsonEnvelopeWithATRNonRepaint[idx].X_0 == x_0 && cacheNadarayaWatsonEnvelopeWithATRNonRepaint[idx].ShowMiddle == showMiddle && cacheNadarayaWatsonEnvelopeWithATRNonRepaint[idx].SmoothColors == smoothColors && cacheNadarayaWatsonEnvelopeWithATRNonRepaint[idx].Lag == lag && cacheNadarayaWatsonEnvelopeWithATRNonRepaint[idx].ATR_Length == aTR_Length && cacheNadarayaWatsonEnvelopeWithATRNonRepaint[idx].Multiplier == multiplier && cacheNadarayaWatsonEnvelopeWithATRNonRepaint[idx].ADX_Filter == aDX_Filter && cacheNadarayaWatsonEnvelopeWithATRNonRepaint[idx].ADX_Period == aDX_Period && cacheNadarayaWatsonEnvelopeWithATRNonRepaint[idx].ADX_Min == aDX_Min && cacheNadarayaWatsonEnvelopeWithATRNonRepaint[idx].EqualsInput(input)) 352 | return cacheNadarayaWatsonEnvelopeWithATRNonRepaint[idx]; 353 | return CacheIndicator(new NadarayaWatsonEnvelopeWithATRNonRepaint(){ H = h, R = r, X_0 = x_0, ShowMiddle = showMiddle, SmoothColors = smoothColors, Lag = lag, ATR_Length = aTR_Length, Multiplier = multiplier, ADX_Filter = aDX_Filter, ADX_Period = aDX_Period, ADX_Min = aDX_Min }, input, ref cacheNadarayaWatsonEnvelopeWithATRNonRepaint); 354 | } 355 | } 356 | } 357 | 358 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns 359 | { 360 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase 361 | { 362 | public Indicators.NadarayaWatsonEnvelopeWithATRNonRepaint NadarayaWatsonEnvelopeWithATRNonRepaint(double h, double r, int x_0, bool showMiddle, bool smoothColors, int lag, int aTR_Length, double multiplier, bool aDX_Filter, int aDX_Period, int aDX_Min) 363 | { 364 | return indicator.NadarayaWatsonEnvelopeWithATRNonRepaint(Input, h, r, x_0, showMiddle, smoothColors, lag, aTR_Length, multiplier, aDX_Filter, aDX_Period, aDX_Min); 365 | } 366 | 367 | public Indicators.NadarayaWatsonEnvelopeWithATRNonRepaint NadarayaWatsonEnvelopeWithATRNonRepaint(ISeries input , double h, double r, int x_0, bool showMiddle, bool smoothColors, int lag, int aTR_Length, double multiplier, bool aDX_Filter, int aDX_Period, int aDX_Min) 368 | { 369 | return indicator.NadarayaWatsonEnvelopeWithATRNonRepaint(input, h, r, x_0, showMiddle, smoothColors, lag, aTR_Length, multiplier, aDX_Filter, aDX_Period, aDX_Min); 370 | } 371 | } 372 | } 373 | 374 | namespace NinjaTrader.NinjaScript.Strategies 375 | { 376 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase 377 | { 378 | public Indicators.NadarayaWatsonEnvelopeWithATRNonRepaint NadarayaWatsonEnvelopeWithATRNonRepaint(double h, double r, int x_0, bool showMiddle, bool smoothColors, int lag, int aTR_Length, double multiplier, bool aDX_Filter, int aDX_Period, int aDX_Min) 379 | { 380 | return indicator.NadarayaWatsonEnvelopeWithATRNonRepaint(Input, h, r, x_0, showMiddle, smoothColors, lag, aTR_Length, multiplier, aDX_Filter, aDX_Period, aDX_Min); 381 | } 382 | 383 | public Indicators.NadarayaWatsonEnvelopeWithATRNonRepaint NadarayaWatsonEnvelopeWithATRNonRepaint(ISeries input , double h, double r, int x_0, bool showMiddle, bool smoothColors, int lag, int aTR_Length, double multiplier, bool aDX_Filter, int aDX_Period, int aDX_Min) 384 | { 385 | return indicator.NadarayaWatsonEnvelopeWithATRNonRepaint(input, h, r, x_0, showMiddle, smoothColors, lag, aTR_Length, multiplier, aDX_Filter, aDX_Period, aDX_Min); 386 | } 387 | } 388 | } 389 | 390 | #endregion 391 | -------------------------------------------------------------------------------- /Indicators/NadarayaWatsonEnvelopeWithKernelRegNR.cs: -------------------------------------------------------------------------------- 1 | #region Using declarations 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.ComponentModel.DataAnnotations; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Xml.Serialization; 13 | using NinjaTrader.Cbi; 14 | using NinjaTrader.Gui; 15 | using NinjaTrader.Gui.Chart; 16 | using NinjaTrader.Gui.SuperDom; 17 | using NinjaTrader.Gui.Tools; 18 | using NinjaTrader.Data; 19 | using NinjaTrader.NinjaScript; 20 | using NinjaTrader.Core.FloatingPoint; 21 | using NinjaTrader.NinjaScript.DrawingTools; 22 | #endregion 23 | 24 | //This namespace holds Indicators in this folder and is required. Do not change it. 25 | namespace NinjaTrader.NinjaScript.Indicators 26 | { 27 | public class NadarayaWatsonEnvelopeWithKernelRegNR : Indicator 28 | { 29 | private int size; 30 | private Series yhat_close; 31 | private Series yhat_high; 32 | private Series yhat_low; 33 | private Series yhat; 34 | 35 | private Series atr; 36 | 37 | private DashStyleHelper dash0Style = DashStyleHelper.Solid; 38 | private PlotStyle plot0Style = PlotStyle.Line; 39 | 40 | private Brush upColor = Brushes.Lime; 41 | private Brush downColor = Brushes.Red; 42 | 43 | private Series signalChange; 44 | protected override void OnStateChange() 45 | { 46 | if (State == State.SetDefaults) 47 | { 48 | Description = @"Enter the description for your new custom Indicator here."; 49 | Name = "NadarayaWatsonEnvelopeWithKernelRegNR"; 50 | Calculate = Calculate.OnEachTick; 51 | IsOverlay = true; 52 | DisplayInDataBox = true; 53 | DrawOnPricePanel = true; 54 | DrawHorizontalGridLines = true; 55 | DrawVerticalGridLines = true; 56 | PaintPriceMarkers = true; 57 | ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right; 58 | //Disable this property if your indicator requires custom values that cumulate with each new market data event. 59 | //See Help Guide for additional information. 60 | IsSuspendedWhileInactive = true; 61 | H = 8; 62 | Alpha = 8; 63 | X_0 = 25; 64 | ATR_Length = 60; 65 | Near_Factor = 1.5; 66 | Far_Factor = 8.0; 67 | AddPlot(new Stroke(Brushes.PaleGreen, 2), PlotStyle.Line, "UpperFar"); 68 | AddPlot(new Stroke(Brushes.LawnGreen, 2), PlotStyle.Line, "UpperAvg"); 69 | AddPlot(new Stroke(Brushes.Green, 2), PlotStyle.Line, "UpperNear"); 70 | AddPlot(new Stroke(Brushes.IndianRed, 2), PlotStyle.Line, "LowerFar"); 71 | AddPlot(new Stroke(Brushes.Crimson, 2), PlotStyle.Line, "LowerAvg"); 72 | AddPlot(new Stroke(Brushes.Red, 2), PlotStyle.Line, "LowerNear"); 73 | AddPlot(new Stroke(Brushes.White, 2), PlotStyle.Line, "NWEstimate"); 74 | } 75 | else if (State == State.Configure) 76 | { 77 | yhat_close = new Series(this, MaximumBarsLookBack.Infinite); 78 | yhat_high = new Series(this, MaximumBarsLookBack.Infinite); 79 | yhat_low = new Series(this, MaximumBarsLookBack.Infinite); 80 | yhat = new Series(this, MaximumBarsLookBack.Infinite); 81 | atr = new Series(this, MaximumBarsLookBack.Infinite); 82 | signalChange = new Series(this, MaximumBarsLookBack.Infinite); 83 | } 84 | } 85 | 86 | protected override void OnBarUpdate() 87 | { 88 | 89 | if (CurrentBar < X_0) { 90 | NWEstimate[0] = Input[0]; 91 | size = 0; 92 | yhat_close[0] = 0.0; 93 | yhat_high[0] = 0.0; 94 | yhat_low[0] = 0.0; 95 | yhat[0] = 0.0; 96 | signalChange[0] = 0; 97 | atr[0] = 0.0; 98 | return; 99 | } 100 | // Envelope Calculations 101 | yhat_close[0] = kernel_regression(Close, H, Alpha, X_0); 102 | yhat_high[0] = kernel_regression(High, H, Alpha, X_0); 103 | yhat_low[0] = kernel_regression(Low, H, Alpha, X_0); 104 | yhat[0] = yhat_close[0]; 105 | double ktr = kernel_atr(ATR_Length, yhat_high, yhat_low, yhat_close); 106 | double[] bounds = getBounds(ktr, Near_Factor, Far_Factor, yhat_close); 107 | 108 | UpperNear[0] = bounds[0]; 109 | UpperFar[0] = bounds[1]; 110 | UpperAvg[0] = bounds[2]; 111 | LowerNear[0] = bounds[3]; 112 | LowerFar[0] = bounds[4]; 113 | LowerAvg[0] = bounds[5]; 114 | NWEstimate[0] = yhat_close[0]; 115 | 116 | if (yhat[0] > yhat[1]) { 117 | PlotBrushes[6][0] = Brushes.Green; 118 | } else { 119 | PlotBrushes[6][0] = Brushes.Red; 120 | } 121 | 122 | Draw.Region(this, "UpNearAvg", 0, CurrentBar, UpperNear, UpperAvg, Brushes.DarkGreen,Brushes.Green, 60,0); 123 | Draw.Region(this, "UpAvgFar", 0, CurrentBar, UpperAvg, UpperFar, Brushes.LawnGreen,Brushes.PaleGreen, 60,0); 124 | Draw.Region(this, "LowNearAvg", 0, CurrentBar, LowerNear, LowerAvg, Brushes.DarkRed,Brushes.Red, 60,0); 125 | Draw.Region(this, "LowAvgFar", 0, CurrentBar, LowerAvg, LowerFar, Brushes.Crimson,Brushes.IndianRed, 60,0); 126 | 127 | 128 | 129 | } 130 | 131 | private double[] getBounds(double _atr, double _nearFactor, double _farFactor, Series _yhat) { 132 | double _upper_far = _yhat[0] + _farFactor*_atr; 133 | double _upper_near = _yhat[0] + _nearFactor*_atr; 134 | double _lower_near = _yhat[0] - _nearFactor*_atr; 135 | double _lower_far = _yhat[0] - _farFactor*_atr; 136 | double _upper_avg = (_upper_far + _upper_near) / 2; 137 | double _lower_avg = (_lower_far + _lower_near) / 2; 138 | return new double[] {_upper_near, _upper_far, _upper_avg, _lower_near, _lower_far, _lower_avg}; 139 | 140 | } 141 | 142 | private double kernel_atr(int length, ISeries _high, ISeries _low, ISeries _close) { 143 | double trueRange = 0.0; 144 | double smoothingFactor = 2.0 / (length + 1); 145 | if (_high[1] == 0.0) { 146 | trueRange = _high[0]-_low[0]; 147 | } else { 148 | trueRange = Math.Max(Math.Max(_high[0] - _low[0], Math.Abs(_high[0] - _close[1])), Math.Abs(_low[0] - _close[1])); 149 | } 150 | 151 | //if (atr.Count < 1) { 152 | // atr[0] = trueRange; 153 | //} else { 154 | atr[0] = (1 - smoothingFactor) * atr[1] + smoothingFactor * trueRange; 155 | //} 156 | return atr[0]; 157 | 158 | } 159 | 160 | private double kernel_regression(ISeries _src, double _h, double _r, int startAtBar) { 161 | double _currentWeight = 0.0; 162 | double _cumulativeWeight = 0.0; 163 | int _size = 1; 164 | for (int i = 0 ; i < (_size + startAtBar); i++) { 165 | Print("size "+_size); 166 | double y = _src[i]; 167 | double w = Math.Pow(1 + (Math.Pow(i, 2) / ((Math.Pow(_h,2)*2*_r))), -_r); 168 | _currentWeight += y*w; 169 | _cumulativeWeight += w; 170 | } 171 | if (_cumulativeWeight != 0.0) 172 | { 173 | return _currentWeight / _cumulativeWeight; 174 | } 175 | else 176 | { 177 | return 0.0; // Handle division by zero or very small cumulativeWeight 178 | } 179 | } 180 | 181 | #region Properties 182 | [NinjaScriptProperty] 183 | [Range(1, double.MaxValue)] 184 | [Display(Name="Lookback Window (H)", Description="Lookback Window", Order=1, GroupName="Parameters")] 185 | public double H 186 | { get; set; } 187 | 188 | [NinjaScriptProperty] 189 | [Range(1, double.MaxValue)] 190 | [Display(Name="Relative Weighting (Alpha)", Description="Relative Weighting", Order=2, GroupName="Parameters")] 191 | public double Alpha 192 | { get; set; } 193 | 194 | [NinjaScriptProperty] 195 | [Range(1, int.MaxValue)] 196 | [Display(Name="Start Regression at Bar (X_0)", Description="Start Regression at Bar", Order=3, GroupName="Parameters")] 197 | public int X_0 198 | { get; set; } 199 | 200 | [NinjaScriptProperty] 201 | [Range(1, int.MaxValue)] 202 | [Display(Name="ATR Length", Description="Length Of Atr", Order=4, GroupName="Parameters")] 203 | public int ATR_Length 204 | { get; set; } 205 | 206 | [NinjaScriptProperty] 207 | [Range(1, int.MaxValue)] 208 | [Display(Name="Near Factor", Description="Near ATR Factor", Order=5, GroupName="Parameters")] 209 | public double Near_Factor 210 | { get; set; } 211 | 212 | [NinjaScriptProperty] 213 | [Range(1, int.MaxValue)] 214 | [Display(Name="Far Factor", Description="Far ATR Factor", Order=6, GroupName="Parameters")] 215 | public double Far_Factor 216 | { get; set; } 217 | 218 | [Browsable(false)] 219 | [XmlIgnore] 220 | public Series UpperFar 221 | { 222 | get { return Values[0]; } 223 | } 224 | 225 | [Browsable(false)] 226 | [XmlIgnore] 227 | public Series UpperAvg 228 | { 229 | get { return Values[1]; } 230 | } 231 | 232 | [Browsable(false)] 233 | [XmlIgnore] 234 | public Series UpperNear 235 | { 236 | get { return Values[2]; } 237 | } 238 | 239 | [Browsable(false)] 240 | [XmlIgnore] 241 | public Series LowerFar 242 | { 243 | get { return Values[3]; } 244 | } 245 | 246 | [Browsable(false)] 247 | [XmlIgnore] 248 | public Series LowerAvg 249 | { 250 | get { return Values[4]; } 251 | } 252 | 253 | [Browsable(false)] 254 | [XmlIgnore] 255 | public Series LowerNear 256 | { 257 | get { return Values[5]; } 258 | } 259 | 260 | [Browsable(false)] 261 | [XmlIgnore] 262 | public Series NWEstimate 263 | { 264 | get { return Values[6]; } 265 | } 266 | #endregion 267 | 268 | } 269 | } 270 | 271 | #region NinjaScript generated code. Neither change nor remove. 272 | 273 | namespace NinjaTrader.NinjaScript.Indicators 274 | { 275 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase 276 | { 277 | private NadarayaWatsonEnvelopeWithKernelRegNR[] cacheNadarayaWatsonEnvelopeWithKernelRegNR; 278 | public NadarayaWatsonEnvelopeWithKernelRegNR NadarayaWatsonEnvelopeWithKernelRegNR(double h, double alpha, int x_0, int aTR_Length, double near_Factor, double far_Factor) 279 | { 280 | return NadarayaWatsonEnvelopeWithKernelRegNR(Input, h, alpha, x_0, aTR_Length, near_Factor, far_Factor); 281 | } 282 | 283 | public NadarayaWatsonEnvelopeWithKernelRegNR NadarayaWatsonEnvelopeWithKernelRegNR(ISeries input, double h, double alpha, int x_0, int aTR_Length, double near_Factor, double far_Factor) 284 | { 285 | if (cacheNadarayaWatsonEnvelopeWithKernelRegNR != null) 286 | for (int idx = 0; idx < cacheNadarayaWatsonEnvelopeWithKernelRegNR.Length; idx++) 287 | if (cacheNadarayaWatsonEnvelopeWithKernelRegNR[idx] != null && cacheNadarayaWatsonEnvelopeWithKernelRegNR[idx].H == h && cacheNadarayaWatsonEnvelopeWithKernelRegNR[idx].Alpha == alpha && cacheNadarayaWatsonEnvelopeWithKernelRegNR[idx].X_0 == x_0 && cacheNadarayaWatsonEnvelopeWithKernelRegNR[idx].ATR_Length == aTR_Length && cacheNadarayaWatsonEnvelopeWithKernelRegNR[idx].Near_Factor == near_Factor && cacheNadarayaWatsonEnvelopeWithKernelRegNR[idx].Far_Factor == far_Factor && cacheNadarayaWatsonEnvelopeWithKernelRegNR[idx].EqualsInput(input)) 288 | return cacheNadarayaWatsonEnvelopeWithKernelRegNR[idx]; 289 | return CacheIndicator(new NadarayaWatsonEnvelopeWithKernelRegNR(){ H = h, Alpha = alpha, X_0 = x_0, ATR_Length = aTR_Length, Near_Factor = near_Factor, Far_Factor = far_Factor }, input, ref cacheNadarayaWatsonEnvelopeWithKernelRegNR); 290 | } 291 | } 292 | } 293 | 294 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns 295 | { 296 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase 297 | { 298 | public Indicators.NadarayaWatsonEnvelopeWithKernelRegNR NadarayaWatsonEnvelopeWithKernelRegNR(double h, double alpha, int x_0, int aTR_Length, double near_Factor, double far_Factor) 299 | { 300 | return indicator.NadarayaWatsonEnvelopeWithKernelRegNR(Input, h, alpha, x_0, aTR_Length, near_Factor, far_Factor); 301 | } 302 | 303 | public Indicators.NadarayaWatsonEnvelopeWithKernelRegNR NadarayaWatsonEnvelopeWithKernelRegNR(ISeries input , double h, double alpha, int x_0, int aTR_Length, double near_Factor, double far_Factor) 304 | { 305 | return indicator.NadarayaWatsonEnvelopeWithKernelRegNR(input, h, alpha, x_0, aTR_Length, near_Factor, far_Factor); 306 | } 307 | } 308 | } 309 | 310 | namespace NinjaTrader.NinjaScript.Strategies 311 | { 312 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase 313 | { 314 | public Indicators.NadarayaWatsonEnvelopeWithKernelRegNR NadarayaWatsonEnvelopeWithKernelRegNR(double h, double alpha, int x_0, int aTR_Length, double near_Factor, double far_Factor) 315 | { 316 | return indicator.NadarayaWatsonEnvelopeWithKernelRegNR(Input, h, alpha, x_0, aTR_Length, near_Factor, far_Factor); 317 | } 318 | 319 | public Indicators.NadarayaWatsonEnvelopeWithKernelRegNR NadarayaWatsonEnvelopeWithKernelRegNR(ISeries input , double h, double alpha, int x_0, int aTR_Length, double near_Factor, double far_Factor) 320 | { 321 | return indicator.NadarayaWatsonEnvelopeWithKernelRegNR(input, h, alpha, x_0, aTR_Length, near_Factor, far_Factor); 322 | } 323 | } 324 | } 325 | 326 | #endregion 327 | -------------------------------------------------------------------------------- /Indicators/NadarayaWatsonRationalQuadraticKernel.cs: -------------------------------------------------------------------------------- 1 | #region Using declarations 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.ComponentModel.DataAnnotations; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Xml.Serialization; 13 | using NinjaTrader.Cbi; 14 | using NinjaTrader.Gui; 15 | using NinjaTrader.Gui.Chart; 16 | using NinjaTrader.Gui.SuperDom; 17 | using NinjaTrader.Gui.Tools; 18 | using NinjaTrader.Data; 19 | using NinjaTrader.NinjaScript; 20 | using NinjaTrader.Core.FloatingPoint; 21 | using NinjaTrader.NinjaScript.DrawingTools; 22 | #endregion 23 | 24 | //This namespace holds Indicators in this folder and is required. Do not change it. 25 | /** 26 | This is a convertion of Trading View Nadaraya-Watson: Rational Quadration Kernel Regression from the user @jdehorty 27 | https://www.tradingview.com/script/AWNvbPRM-Nadaraya-Watson-Rational-Quadratic-Kernel-Non-Repainting/ 28 | **/ 29 | namespace NinjaTrader.NinjaScript.Indicators 30 | { 31 | public class NadarayaWatsonRationalQuadraticKernel : Indicator 32 | { 33 | private int size; 34 | private Series yhat1; 35 | private Series yhat2; 36 | 37 | private DashStyleHelper dash0Style = DashStyleHelper.Solid; 38 | private PlotStyle plot0Style = PlotStyle.Line; 39 | 40 | private Brush upColor = Brushes.Lime; 41 | private Brush downColor = Brushes.Red; 42 | 43 | private Series signalChange; 44 | private Series trend; 45 | 46 | protected override void OnStateChange() 47 | { 48 | if (State == State.SetDefaults) 49 | { 50 | Description = @"Enter the description for your new custom Indicator here."; 51 | Name = "NadarayaWatsonRationalQuadraticKernel"; 52 | Calculate = Calculate.OnEachTick; 53 | IsOverlay = true; 54 | DisplayInDataBox = true; 55 | DrawOnPricePanel = true; 56 | DrawHorizontalGridLines = true; 57 | DrawVerticalGridLines = true; 58 | PaintPriceMarkers = true; 59 | ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right; 60 | //Disable this property if your indicator requires custom values that cumulate with each new market data event. 61 | //See Help Guide for additional information. 62 | IsSuspendedWhileInactive = true; 63 | H = 8; 64 | R = 8; 65 | X_0 = 25; 66 | Lag = 2; 67 | SmoothColors = false; 68 | AddPlot(new Stroke(Brushes.White, 2), PlotStyle.Line, "NWKernelLine"); 69 | AddPlot(new Stroke(Brushes.White, 8), PlotStyle.Dot, "Signal"); 70 | } 71 | else if (State == State.Configure) 72 | { 73 | yhat1 = new Series(this, MaximumBarsLookBack.Infinite); 74 | yhat2 = new Series(this, MaximumBarsLookBack.Infinite); 75 | signalChange = new Series(this, MaximumBarsLookBack.Infinite); 76 | trend = new Series(this, MaximumBarsLookBack.Infinite); 77 | 78 | } 79 | } 80 | 81 | protected override void OnBarUpdate() 82 | { 83 | //Add your custom indicator logic here. 84 | 85 | if (CurrentBar < X_0) { 86 | NWKernelLine[0] = Input[0]; 87 | size = 0; 88 | yhat1[0] = 0.0; 89 | yhat2[0] = 0.0; 90 | Signal[0] = 0.0; 91 | signalChange[0] = 0; 92 | return; 93 | } 94 | 95 | size = Close.Count; 96 | signalChange[0] = 0; 97 | 98 | yhat1[0] = kernel_regression(1, H); 99 | 100 | yhat2[0] = kernel_regression(1, H-Lag); 101 | 102 | bool wasBearish = yhat1[2] > yhat1[1]; 103 | bool wasBullish = yhat1[2] < yhat1[1]; 104 | bool isBearish = yhat1[1] > yhat1[0]; 105 | bool isBullish = yhat1[1] < yhat1[0]; 106 | bool isBearishChange = isBearish && wasBullish; 107 | bool isBullishChange = isBullish && wasBearish; 108 | 109 | bool isBullishCross = CrossAbove(yhat2, yhat1, 1); 110 | bool isBearishCross = CrossBelow(yhat2, yhat1, 1); 111 | bool isBullishSmooth = yhat2[0] > yhat1[0]; 112 | bool isBearishSmooth = yhat2[0] < yhat1[0]; 113 | 114 | Brush colorByCross = isBullishSmooth ? upColor : downColor; 115 | Brush colorByRate = isBullish ? upColor : downColor; 116 | 117 | Brush plotColor = SmoothColors ? colorByCross : colorByRate; 118 | 119 | NWKernelLine[0] = yhat1[0]; 120 | 121 | PlotBrushes[0][0] = plotColor; 122 | 123 | if (SmoothColors) { 124 | if (isBearishCross) { 125 | Signal[0] = High[0]; 126 | signalChange[0] = -1; 127 | } else if (isBullishCross) { 128 | Signal[0] = Low[0]; 129 | signalChange[0] = 1; 130 | } 131 | } else { 132 | if (isBearishChange) { 133 | Signal[0] = High[0]; 134 | signalChange[0] = -1; 135 | } else if (isBullishChange) { 136 | Signal[0] = Low[0]; 137 | signalChange[0] = 1; 138 | } 139 | } 140 | 141 | if (isBullish) trend[0] = 1; 142 | if (isBearish) trend[0] = -1; 143 | 144 | PlotBrushes[1][0] = plotColor; 145 | 146 | } 147 | 148 | private double kernel_regression(int _size, double _h) { 149 | double _currentWeight = 0.0; 150 | double _cumulativeWeight = 0.0; 151 | for (int i = 0 ; i < (_size + X_0); i++) { 152 | double y = Close[i]; 153 | double w = Math.Pow(1 + (Math.Pow(i, 2) / ((Math.Pow(_h,2)*2*R))), -R); 154 | _currentWeight += y*w; 155 | _cumulativeWeight += w; 156 | } 157 | if (_cumulativeWeight != 0.0) 158 | { 159 | return _currentWeight / _cumulativeWeight; 160 | } 161 | else 162 | { 163 | return 0.0; // Handle division by zero or very small cumulativeWeight 164 | } 165 | } 166 | 167 | #region Properties 168 | [NinjaScriptProperty] 169 | [Range(3, double.MaxValue)] 170 | [Display(Name="H", Description="Lookback Window", Order=1, GroupName="Parameters")] 171 | public double H 172 | { get; set; } 173 | 174 | [NinjaScriptProperty] 175 | [Range(1, double.MaxValue)] 176 | [Display(Name="R", Description="Relative Weighting", Order=2, GroupName="Parameters")] 177 | public double R 178 | { get; set; } 179 | 180 | [NinjaScriptProperty] 181 | [Range(1, int.MaxValue)] 182 | [Display(Name="X_0", Description="Start Regression at Bar", Order=3, GroupName="Parameters")] 183 | public int X_0 184 | { get; set; } 185 | 186 | [NinjaScriptProperty] 187 | [Range(1, int.MaxValue)] 188 | [Display(Name="Lag", Description="Lag", Order=4, GroupName="Parameters")] 189 | public int Lag 190 | { get; set; } 191 | 192 | [NinjaScriptProperty] 193 | [Display(Name="SmoothColors", Description="Smooth Colors", Order=5, GroupName="Parameters")] 194 | public bool SmoothColors 195 | { get; set; } 196 | 197 | [Browsable(false)] 198 | [XmlIgnore] 199 | public Series NWKernelLine 200 | { 201 | get { return Values[0]; } 202 | } 203 | 204 | [Browsable(false)] 205 | [XmlIgnore] 206 | public Series Signal 207 | { 208 | get { return Values[1]; } 209 | } 210 | 211 | [Browsable(false)] 212 | [XmlIgnore] 213 | public Series SignalChange 214 | { 215 | get { return signalChange; } 216 | } 217 | 218 | [Browsable(false)] 219 | [XmlIgnore] 220 | public Series Trend 221 | { 222 | get { return trend; } 223 | } 224 | #endregion 225 | 226 | } 227 | } 228 | 229 | #region NinjaScript generated code. Neither change nor remove. 230 | 231 | namespace NinjaTrader.NinjaScript.Indicators 232 | { 233 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase 234 | { 235 | private NadarayaWatsonRationalQuadraticKernel[] cacheNadarayaWatsonRationalQuadraticKernel; 236 | public NadarayaWatsonRationalQuadraticKernel NadarayaWatsonRationalQuadraticKernel(double h, double r, int x_0, int lag, bool smoothColors) 237 | { 238 | return NadarayaWatsonRationalQuadraticKernel(Input, h, r, x_0, lag, smoothColors); 239 | } 240 | 241 | public NadarayaWatsonRationalQuadraticKernel NadarayaWatsonRationalQuadraticKernel(ISeries input, double h, double r, int x_0, int lag, bool smoothColors) 242 | { 243 | if (cacheNadarayaWatsonRationalQuadraticKernel != null) 244 | for (int idx = 0; idx < cacheNadarayaWatsonRationalQuadraticKernel.Length; idx++) 245 | if (cacheNadarayaWatsonRationalQuadraticKernel[idx] != null && cacheNadarayaWatsonRationalQuadraticKernel[idx].H == h && cacheNadarayaWatsonRationalQuadraticKernel[idx].R == r && cacheNadarayaWatsonRationalQuadraticKernel[idx].X_0 == x_0 && cacheNadarayaWatsonRationalQuadraticKernel[idx].Lag == lag && cacheNadarayaWatsonRationalQuadraticKernel[idx].SmoothColors == smoothColors && cacheNadarayaWatsonRationalQuadraticKernel[idx].EqualsInput(input)) 246 | return cacheNadarayaWatsonRationalQuadraticKernel[idx]; 247 | return CacheIndicator(new NadarayaWatsonRationalQuadraticKernel(){ H = h, R = r, X_0 = x_0, Lag = lag, SmoothColors = smoothColors }, input, ref cacheNadarayaWatsonRationalQuadraticKernel); 248 | } 249 | } 250 | } 251 | 252 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns 253 | { 254 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase 255 | { 256 | public Indicators.NadarayaWatsonRationalQuadraticKernel NadarayaWatsonRationalQuadraticKernel(double h, double r, int x_0, int lag, bool smoothColors) 257 | { 258 | return indicator.NadarayaWatsonRationalQuadraticKernel(Input, h, r, x_0, lag, smoothColors); 259 | } 260 | 261 | public Indicators.NadarayaWatsonRationalQuadraticKernel NadarayaWatsonRationalQuadraticKernel(ISeries input , double h, double r, int x_0, int lag, bool smoothColors) 262 | { 263 | return indicator.NadarayaWatsonRationalQuadraticKernel(input, h, r, x_0, lag, smoothColors); 264 | } 265 | } 266 | } 267 | 268 | namespace NinjaTrader.NinjaScript.Strategies 269 | { 270 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase 271 | { 272 | public Indicators.NadarayaWatsonRationalQuadraticKernel NadarayaWatsonRationalQuadraticKernel(double h, double r, int x_0, int lag, bool smoothColors) 273 | { 274 | return indicator.NadarayaWatsonRationalQuadraticKernel(Input, h, r, x_0, lag, smoothColors); 275 | } 276 | 277 | public Indicators.NadarayaWatsonRationalQuadraticKernel NadarayaWatsonRationalQuadraticKernel(ISeries input , double h, double r, int x_0, int lag, bool smoothColors) 278 | { 279 | return indicator.NadarayaWatsonRationalQuadraticKernel(input, h, r, x_0, lag, smoothColors); 280 | } 281 | } 282 | } 283 | 284 | #endregion 285 | -------------------------------------------------------------------------------- /Indicators/RangeFilterSimple.cs: -------------------------------------------------------------------------------- 1 | #region Using declarations 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.ComponentModel.DataAnnotations; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Xml.Serialization; 13 | using NinjaTrader.Cbi; 14 | using NinjaTrader.Gui; 15 | using NinjaTrader.Gui.Chart; 16 | using NinjaTrader.Gui.SuperDom; 17 | using NinjaTrader.Gui.Tools; 18 | using NinjaTrader.Data; 19 | using NinjaTrader.NinjaScript; 20 | using NinjaTrader.Core.FloatingPoint; 21 | using NinjaTrader.NinjaScript.DrawingTools; 22 | #endregion 23 | 24 | //This namespace holds Indicators in this folder and is required. Do not change it. 25 | /** 26 | This is an NT8 Conversion of Range Filter from guikroth https://www.tradingview.com/script/J8GzFGfD-Range-Filter-Buy-and-Sell-5min-guikroth-version/ 27 | Credit goes to the user @tvenn 28 | **/ 29 | namespace NinjaTrader.NinjaScript.Indicators 30 | { 31 | public class RangeFilterSimple : Indicator 32 | { 33 | private Series x; 34 | private Series xCalc; 35 | private Series avrng; 36 | private Series rngfilt; 37 | private Series upward; 38 | private Series downward; 39 | private Series condIni; 40 | private Series Buy; 41 | private Series Sell; 42 | private Series trend; 43 | private SimpleFont font; 44 | protected override void OnStateChange() 45 | { 46 | if (State == State.SetDefaults) 47 | { 48 | Description = @"Enter the description for your new custom Indicator here."; 49 | Name = "RangeFilterSimple"; 50 | Calculate = Calculate.OnEachTick; 51 | IsOverlay = true; 52 | DisplayInDataBox = true; 53 | DrawOnPricePanel = true; 54 | DrawHorizontalGridLines = true; 55 | DrawVerticalGridLines = true; 56 | PaintPriceMarkers = true; 57 | ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right; 58 | //Disable this property if your indicator requires custom values that cumulate with each new market data event. 59 | //See Help Guide for additional information. 60 | IsSuspendedWhileInactive = true; 61 | Period = 100; 62 | AreaOpacity = 30; 63 | Multiplier = 3; 64 | AddPlot(Brushes.Green, "HBand"); 65 | AddPlot(Brushes.Red, "LBand"); 66 | AddPlot(new Stroke(Brushes.White, 5), PlotStyle.Line, "RangeFilter"); 67 | 68 | font = new Gui.Tools.SimpleFont("Arial", 12); 69 | } 70 | else if (State == State.Configure) 71 | { 72 | x = new Series(this, MaximumBarsLookBack.Infinite); 73 | xCalc = new Series(this, MaximumBarsLookBack.Infinite); 74 | avrng = new Series(this, MaximumBarsLookBack.Infinite); 75 | rngfilt = new Series(this, MaximumBarsLookBack.Infinite); 76 | upward = new Series(this, MaximumBarsLookBack.Infinite); 77 | downward = new Series(this, MaximumBarsLookBack.Infinite); 78 | condIni = new Series(this, MaximumBarsLookBack.Infinite); 79 | Buy = new Series(this, MaximumBarsLookBack.Infinite); 80 | Sell = new Series(this, MaximumBarsLookBack.Infinite); 81 | trend = new Series(this, MaximumBarsLookBack.Infinite); 82 | } 83 | } 84 | 85 | protected override void OnBarUpdate() 86 | { 87 | if (CurrentBar < 2) { 88 | x[0] = 0; 89 | xCalc[0] = 0; 90 | avrng[0] = 0; 91 | rngfilt[0] = 0; 92 | upward[0] = 0; 93 | downward[0] = 0; 94 | condIni[0] = 0; 95 | return; 96 | } 97 | 98 | x[0] = Close[0]; 99 | double smrng = smoothrng(Period, Multiplier); 100 | rngfilter(smrng); 101 | upward[0] = rngfilt[0] > rngfilt[1] ? upward[1] + 1 : rngfilt[0] < rngfilt[1] ? 0 : upward[1]; 102 | downward[0] = rngfilt[0] < rngfilt[1] ? downward[1] + 1 : rngfilt[0] > rngfilt[1] ? 0 : downward[1]; 103 | HBand[0] = rngfilt[0] + smrng; 104 | LBand[0] = rngfilt[0] - smrng; 105 | bool longCond = false; 106 | bool shortCond = false; 107 | longCond = Close[0] > rngfilt[0] && Close[0] > Close[1] && upward[0] > 0 || Close[0] > rngfilt[0] && Close[0] < Close[1] && upward[0] > 0; 108 | 109 | shortCond = Close[0] < rngfilt[0] && Close[0] < Close[1] && downward[0] > 0 || Close[0] < rngfilt[0] && Close[0] > Close[1] && downward[0] > 0; 110 | 111 | condIni[0] = longCond ? 1 : shortCond ? -1 : condIni[1]; 112 | bool longCondition = longCond && condIni[1] == -1; 113 | bool shortCondition = shortCond && condIni[1] == 1; 114 | 115 | if (longCondition) { 116 | Buy[0] = 1; 117 | //Draw.ArrowUp(this, "Buy-"+CurrentBar, true, 1 , Low[1] - TickSize, Brushes.Green); 118 | Draw.Text(this, "UpArrow-" + Convert.ToString(CurrentBars[0]), "▲", 0, (Low[0] + (-11 * TickSize)), Brushes.Green); 119 | //Draw.Text(this, "BuyText-"+Convert.ToString(CurrentBars[0]), true, "Buy",1, Low[1] - 15*TickSize, 0, Brushes.White, font, TextAlignment.Center, Brushes.Green, Brushes.DarkGreen, 100); 120 | } 121 | 122 | if (shortCondition) { 123 | Sell[0] = 1; 124 | //Draw.ArrowDown(this, "DownArrow-"+Convert.ToString(CurrentBars[0]), true, 1 , High[1] + TickSize, Brushes.Red); 125 | Draw.Text(this, "DownArrow-" + Convert.ToString(CurrentBars[0]), "▼", 0, (High[0] + (11 * TickSize)), Brushes.Red); 126 | //Draw.Text(this, "SellText-"+Convert.ToString(CurrentBars[0]), true, "Sell",1, High[1] + 15*TickSize, 0, Brushes.White, font, TextAlignment.Center, Brushes.Red, Brushes.DarkRed, 100); 127 | } 128 | 129 | RangeFilter[0] = rngfilt[0]; 130 | 131 | if (upward[0] > 0) { 132 | trend[0] = 1; 133 | } else if (downward[0] > 0) { 134 | trend[0] = -1; 135 | } else { 136 | trend[0] = 0; 137 | } 138 | 139 | 140 | 141 | if (AreaOpacity > 0) { 142 | Draw.Region(this, "HBandArea"+CurrentBar, 1, 0, rngfilt, HBand, null, Brushes.Green, AreaOpacity); 143 | 144 | Draw.Region(this, "LBandArea"+CurrentBar, 1, 0, rngfilt, LBand, null, Brushes.Red, AreaOpacity); 145 | } 146 | 147 | //neutral zone 148 | 149 | if (RangeFilter[0] == RangeFilter[1]) { 150 | PlotBrushes[2][0] = Brushes.Gray; 151 | return; 152 | } 153 | 154 | PlotBrushes[2][0] = upward[0] > 0 ? Brushes.Green : downward[0] > 0 ? Brushes.Red : Brushes.White; 155 | } 156 | 157 | private double smoothrng(int t, double m) { 158 | int wper = t * 2 - 1; 159 | xCalc[0] = Math.Abs(x[0] - x[1]); 160 | avrng[0] = EMA(xCalc, t)[0]; 161 | double smoothrng = EMA(avrng, wper)[0] * m; 162 | return smoothrng; 163 | } 164 | 165 | private void rngfilter(double r) { 166 | rngfilt[0] = x[0]; 167 | if (Double.IsNaN(rngfilt[1])) { 168 | rngfilt[1] = 0.0; 169 | } 170 | 171 | rngfilt[0] = (x[0] > rngfilt[1]) ? ((x[0] - r < rngfilt[1]) ? rngfilt[1] : x[0] - r) : x[0] + r > rngfilt[1] ? rngfilt[1] : x[0] + r; 172 | } 173 | 174 | #region Properties 175 | [NinjaScriptProperty] 176 | [Range(1, int.MaxValue)] 177 | [Display(Name="Period", Description="Sampling Period", Order=1, GroupName="Parameters")] 178 | public int Period 179 | { get; set; } 180 | 181 | [NinjaScriptProperty] 182 | [Range(0.1, double.MaxValue)] 183 | [Display(Name="Multiplier", Description="Multiplier", Order=2, GroupName="Parameters")] 184 | public double Multiplier 185 | { get; set; } 186 | 187 | [NinjaScriptProperty] 188 | [Range(1, int.MaxValue)] 189 | [Display(Name="Area Opacity", Description="Area Opacity", Order=3, GroupName="Parameters")] 190 | public int AreaOpacity 191 | { get; set; } 192 | 193 | [Browsable(false)] 194 | [XmlIgnore] 195 | public Series BuySignal 196 | { 197 | get { return Buy; } 198 | } 199 | 200 | [Browsable(false)] 201 | [XmlIgnore] 202 | public Series SellSignal 203 | { 204 | get { return Sell; } 205 | } 206 | 207 | [Browsable(false)] 208 | [XmlIgnore] 209 | public Series HBand 210 | { 211 | get { return Values[0]; } 212 | } 213 | 214 | [Browsable(false)] 215 | [XmlIgnore] 216 | public Series LBand 217 | { 218 | get { return Values[1]; } 219 | } 220 | 221 | [Browsable(false)] 222 | [XmlIgnore] 223 | public Series RangeFilter 224 | { 225 | get { return Values[2]; } 226 | } 227 | 228 | [Browsable(false)] 229 | [XmlIgnore] 230 | public Series Trend 231 | { 232 | get { return trend; } 233 | } 234 | #endregion 235 | 236 | } 237 | } 238 | 239 | #region NinjaScript generated code. Neither change nor remove. 240 | 241 | namespace NinjaTrader.NinjaScript.Indicators 242 | { 243 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase 244 | { 245 | private RangeFilterSimple[] cacheRangeFilterSimple; 246 | public RangeFilterSimple RangeFilterSimple(int period, double multiplier, int areaOpacity) 247 | { 248 | return RangeFilterSimple(Input, period, multiplier, areaOpacity); 249 | } 250 | 251 | public RangeFilterSimple RangeFilterSimple(ISeries input, int period, double multiplier, int areaOpacity) 252 | { 253 | if (cacheRangeFilterSimple != null) 254 | for (int idx = 0; idx < cacheRangeFilterSimple.Length; idx++) 255 | if (cacheRangeFilterSimple[idx] != null && cacheRangeFilterSimple[idx].Period == period && cacheRangeFilterSimple[idx].Multiplier == multiplier && cacheRangeFilterSimple[idx].AreaOpacity == areaOpacity && cacheRangeFilterSimple[idx].EqualsInput(input)) 256 | return cacheRangeFilterSimple[idx]; 257 | return CacheIndicator(new RangeFilterSimple(){ Period = period, Multiplier = multiplier, AreaOpacity = areaOpacity }, input, ref cacheRangeFilterSimple); 258 | } 259 | } 260 | } 261 | 262 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns 263 | { 264 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase 265 | { 266 | public Indicators.RangeFilterSimple RangeFilterSimple(int period, double multiplier, int areaOpacity) 267 | { 268 | return indicator.RangeFilterSimple(Input, period, multiplier, areaOpacity); 269 | } 270 | 271 | public Indicators.RangeFilterSimple RangeFilterSimple(ISeries input , int period, double multiplier, int areaOpacity) 272 | { 273 | return indicator.RangeFilterSimple(input, period, multiplier, areaOpacity); 274 | } 275 | } 276 | } 277 | 278 | namespace NinjaTrader.NinjaScript.Strategies 279 | { 280 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase 281 | { 282 | public Indicators.RangeFilterSimple RangeFilterSimple(int period, double multiplier, int areaOpacity) 283 | { 284 | return indicator.RangeFilterSimple(Input, period, multiplier, areaOpacity); 285 | } 286 | 287 | public Indicators.RangeFilterSimple RangeFilterSimple(ISeries input , int period, double multiplier, int areaOpacity) 288 | { 289 | return indicator.RangeFilterSimple(input, period, multiplier, areaOpacity); 290 | } 291 | } 292 | } 293 | 294 | #endregion 295 | -------------------------------------------------------------------------------- /Indicators/TOSignals.cs: -------------------------------------------------------------------------------- 1 | /* This script is a conversion of Trader Oracle Method on trading view https://www.tradingview.com/script/yE35zW1B-TraderOracle-Method/ 2 | I have only inckuded Trampoline and Shark Signals 3 | */ 4 | 5 | #region Using declarations 6 | using System; 7 | using System.Collections.Generic; 8 | using System.ComponentModel; 9 | using System.ComponentModel.DataAnnotations; 10 | using System.Linq; 11 | using System.Text; 12 | using System.Threading.Tasks; 13 | using System.Windows; 14 | using System.Windows.Input; 15 | using System.Windows.Media; 16 | using System.Xml.Serialization; 17 | using NinjaTrader.Cbi; 18 | using NinjaTrader.Gui; 19 | using NinjaTrader.Gui.Chart; 20 | using NinjaTrader.Gui.SuperDom; 21 | using NinjaTrader.Gui.Tools; 22 | using NinjaTrader.Data; 23 | using NinjaTrader.NinjaScript; 24 | using NinjaTrader.Core.FloatingPoint; 25 | using NinjaTrader.NinjaScript.DrawingTools; 26 | #endregion 27 | 28 | //This namespace holds Indicators in this folder and is required. Do not change it. 29 | namespace NinjaTrader.NinjaScript.Indicators.ArchReactor 30 | { 31 | public class TOSignals : Indicator 32 | { 33 | private Series rsiM; 34 | private Series bbw; 35 | private Series isRed; 36 | private Series isGreen; 37 | private Series upperBB; 38 | private Series lowerBB; 39 | private Series weGoUp; 40 | private Series weGoDown; 41 | private Series rsiChange1; 42 | private Series rsiChange2; 43 | private Series trampolineBuySell; 44 | private Series sharkOBOS; 45 | 46 | private bool isBarConfirmed = false; 47 | protected override void OnStateChange() 48 | { 49 | if (State == State.SetDefaults) 50 | { 51 | Description = @"Enter the description for your new custom Indicator here."; 52 | Name = "TOSignals"; 53 | Calculate = Calculate.OnEachTick; 54 | IsOverlay = true; 55 | DisplayInDataBox = true; 56 | DrawOnPricePanel = true; 57 | DrawHorizontalGridLines = true; 58 | DrawVerticalGridLines = true; 59 | PaintPriceMarkers = true; 60 | ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right; 61 | //Disable this property if your indicator requires custom values that cumulate with each new market data event. 62 | //See Help Guide for additional information. 63 | IsSuspendedWhileInactive = true; 64 | BollingerLowerThreshold = 0.0015; 65 | RSILowerThreshold = 25; 66 | RSIUpperThreshold = 72; 67 | RSILength = 14; 68 | BollingerBandsLength = 20; 69 | BollingerBandMult = 2; 70 | BollingerBandsOffset = 0; 71 | Apply25_75 = false; 72 | AddPlot(new Stroke(Brushes.White, 10), PlotStyle.Square, "TrampolineSignal"); 73 | } 74 | else if (State == State.Configure) 75 | { 76 | rsiM = new Series(this); 77 | bbw = new Series(this); 78 | isRed = new Series(this); 79 | isGreen = new Series(this); 80 | upperBB = new Series(this); 81 | lowerBB = new Series(this); 82 | weGoUp = new Series(this); 83 | weGoDown = new Series(this); 84 | rsiChange1 = new Series(this); 85 | rsiChange2 = new Series(this); 86 | trampolineBuySell = new Series(this); 87 | sharkOBOS = new Series(this); 88 | } 89 | } 90 | 91 | protected override void OnBarUpdate() 92 | { 93 | if (CurrentBar < 6) { 94 | return; 95 | } 96 | 97 | isRed[0] = Close[0] < Open[0]; 98 | isGreen[0] = Close[0] > Open[0]; 99 | bool isConfirmed = !Double.IsNaN(Close[0]); 100 | 101 | // STANDARD BOLLINGER BANDS 102 | double basisBB = SMA(Input, BollingerBandsLength)[0]; 103 | double devBB = BollingerBandMult * StdDev(Input, BollingerBandsLength)[0]; 104 | upperBB[0] = basisBB + devBB; 105 | lowerBB[0] = basisBB - devBB; 106 | bool downBB = Low[0] < lowerBB[0] || High[0] < lowerBB[0]; 107 | bool upBB = Low[0] > upperBB[0] || High[0] > upperBB[0]; 108 | bbw[0] = (upperBB[0] - lowerBB[0]) / basisBB; 109 | 110 | // RSI 111 | rsiChange1[0] = Math.Max(Input[0] - Input[1], 0); 112 | double up = WildersMovingAverage(rsiChange1, RSILength)[0]; 113 | rsiChange2[0] = -Math.Min(Input[0] - Input[1], 0); 114 | double down = WildersMovingAverage(rsiChange2, RSILength)[0]; 115 | rsiM[0] = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down)); 116 | 117 | bool back1 = isRed[1] && rsiM[1] <= RSILowerThreshold && Close[1] < lowerBB[1] && bbw[1] > BollingerLowerThreshold; 118 | bool back2 = isRed[2] && rsiM[2] <= RSILowerThreshold && Close[2] < lowerBB[2] && bbw[2] > BollingerLowerThreshold; 119 | bool back3 = isRed[3] && rsiM[3] <= RSILowerThreshold && Close[3] < lowerBB[3] && bbw[3] > BollingerLowerThreshold; 120 | bool back4 = isRed[4] && rsiM[4] <= RSILowerThreshold && Close[4] < lowerBB[4] && bbw[4] > BollingerLowerThreshold; 121 | bool back5 = isRed[5] && rsiM[5] <= RSILowerThreshold && Close[5] < lowerBB[5] && bbw[5] > BollingerLowerThreshold; 122 | 123 | bool for1 = isGreen[1] && rsiM[1] >= RSIUpperThreshold && Close[1] > upperBB[1] && bbw[1] > BollingerLowerThreshold; 124 | bool for2 = isGreen[2] && rsiM[2] >= RSIUpperThreshold && Close[2] > upperBB[2] && bbw[2] > BollingerLowerThreshold; 125 | bool for3 = isGreen[3] && rsiM[3] >= RSIUpperThreshold && Close[3] > upperBB[3] && bbw[3] > BollingerLowerThreshold; 126 | bool for4 = isGreen[4] && rsiM[4] >= RSIUpperThreshold && Close[4] > upperBB[4] && bbw[4] > BollingerLowerThreshold; 127 | bool for5 = isGreen[5] && rsiM[5] >= RSIUpperThreshold && Close[5] > upperBB[5] && bbw[5] > BollingerLowerThreshold; 128 | 129 | weGoUp[0]= isGreen[0] && (back1 || back2 || back3 || back4 || back5) && (High[0] > High[1]) && isConfirmed; 130 | bool upThrust = weGoUp[0] && !weGoUp[1] && !weGoUp[2] && !weGoUp[3] && !weGoUp[4]; 131 | weGoDown[0] = isRed[0] && (for1 || for2 || for3 || for4 || for5) && (Low[0] < Low[1]) && isConfirmed; 132 | bool downThrust = weGoDown[0] && !weGoDown[1] && !weGoDown[2] && !weGoDown[3] && !weGoDown[4]; 133 | TrampolineBuySell[0] = 0; 134 | SimpleFont font = new SimpleFont("Courier New", 12) {Bold = true }; 135 | if (upThrust) { 136 | TrampolineSignal[0] = Low[0] - 5*TickSize; 137 | trampolineBuySell[0] = 1; 138 | PlotBrushes[0][0] = Brushes.Lime; 139 | Draw.Text(this, "TrampolineBuy"+CurrentBar, true, "T", 0, Low[0] - 15*TickSize, 0, Brushes.White, font, TextAlignment.Center, Brushes.Green, Brushes.Lime, 20); 140 | } else if (downThrust) { 141 | TrampolineSignal[0] = High[0] + 5*TickSize; 142 | trampolineBuySell[0] = -1; 143 | PlotBrushes[0][0] = Brushes.Red; 144 | Draw.Text(this, "TrampolineSell"+CurrentBar, true, "T", 0, High[0] + 15*TickSize, 0, Brushes.White, font, TextAlignment.Center, Brushes.Red, Brushes.Salmon, 20); 145 | } 146 | 147 | 148 | double ema50 = EMA(Close, 50)[0]; 149 | double ema200 = EMA(Close, 200)[0]; 150 | double ema400 = EMA(Close, 400)[0]; 151 | double ema800 = EMA(Close, 800)[0]; 152 | double wapwap = VWAP(Close)[0]; 153 | 154 | bool bTouchedLine = (ema50Low[0]) || (ema200Low[0]) || (ema400Low[0]) || (ema800Low[0]) || (wapwapLow[0]); 155 | 156 | double basis5 = SMA(rsiM, 30)[0]; 157 | double dev = 2.0 * StdDev(rsiM, 30)[0]; 158 | double upper = basis5 + dev; 159 | double lower = basis5 - dev; 160 | 161 | bool bBelow25 = rsiM[0] < 26; 162 | bool bAbove75 = rsiM[0] > 74; 163 | if(Apply25_75 == false) { 164 | bBelow25 = true; 165 | bAbove75 = true; 166 | } 167 | 168 | bool bShowSharkDown = (rsiM[0] > upper && bAbove75) && isConfirmed; 169 | bool bShowSharkUp = (rsiM[0] < lower && bBelow25) && isConfirmed; 170 | 171 | if (bShowSharkDown == true) { 172 | sharkOBOS[0] = 1; 173 | Draw.Text(this, "SharkSell"+CurrentBar, true, "🦈", 0, High[0] + 15*TickSize, 0, Brushes.Green, font, TextAlignment.Center, Brushes.Transparent, Brushes.Transparent, 20); 174 | } else if (bShowSharkUp == true) 175 | { 176 | sharkOBOS[0] = -1; 177 | Draw.Text(this, "SharkBuy"+CurrentBar, true, "🦈", 0, Low[0] - 15*TickSize, 0, Brushes.Red, font, TextAlignment.Center, Brushes.Transparent, Brushes.Transparent, 20); 178 | } 179 | 180 | } 181 | 182 | #region Properties 183 | [NinjaScriptProperty] 184 | [Range(0, double.MaxValue)] 185 | [Display(Name="BollingerLowerThreshold", Description="0.003 for daily, 0.0015 for 30 min candles", Order=1, GroupName="Parameters")] 186 | public double BollingerLowerThreshold 187 | { get; set; } 188 | 189 | [NinjaScriptProperty] 190 | [Range(1, int.MaxValue)] 191 | [Display(Name="RSILowerThreshold", Description="Normally 25", Order=2, GroupName="1. Trampoline")] 192 | public int RSILowerThreshold 193 | { get; set; } 194 | 195 | [NinjaScriptProperty] 196 | [Range(1, int.MaxValue)] 197 | [Display(Name="RSIUpperThreshold", Description="Normally 75", Order=3, GroupName="1. Trampoline")] 198 | public int RSIUpperThreshold 199 | { get; set; } 200 | 201 | [NinjaScriptProperty] 202 | [Range(1, int.MaxValue)] 203 | [Display(Name="RSILength", Description="RSI Length", Order=4, GroupName="1. Trampoline")] 204 | public int RSILength 205 | { get; set; } 206 | 207 | [NinjaScriptProperty] 208 | [Range(1, int.MaxValue)] 209 | [Display(Name="BollingerBandsLength", Order=5, GroupName="1. Trampoline")] 210 | public int BollingerBandsLength 211 | { get; set; } 212 | 213 | [NinjaScriptProperty] 214 | [Range(0.001, double.MaxValue)] 215 | [Display(Name="BollingerBandMult", Order=6, GroupName="1. Trampoline")] 216 | public double BollingerBandMult 217 | { get; set; } 218 | 219 | [NinjaScriptProperty] 220 | [Range(-500, int.MaxValue)] 221 | [Display(Name="BollingerBandsOffset", Order=7, GroupName="1. Trampoline")] 222 | public int BollingerBandsOffset 223 | { get; set; } 224 | 225 | [Browsable(false)] 226 | [XmlIgnore] 227 | public Series TrampolineSignal 228 | { 229 | get { return Values[0]; } 230 | } 231 | 232 | [NinjaScriptProperty] 233 | [Display(Name="Apply25_75", Description="Apply the 25/75 Rule", Order=1, GroupName="2. Shark Signals")] 234 | public bool Apply25_75 235 | { get; set; } 236 | 237 | [Browsable(false)] 238 | [XmlIgnore] 239 | public Series TrampolineBuySell 240 | { 241 | get { return trampolineBuySell; } 242 | } 243 | 244 | [Browsable(false)] 245 | [XmlIgnore] 246 | public Series SharkOBOS 247 | { 248 | get { return sharkOBOS; } 249 | } 250 | #endregion 251 | 252 | } 253 | } 254 | 255 | #region NinjaScript generated code. Neither change nor remove. 256 | 257 | namespace NinjaTrader.NinjaScript.Indicators 258 | { 259 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase 260 | { 261 | private ArchReactor.TOSignals[] cacheTOSignals; 262 | public ArchReactor.TOSignals TOSignals(double bollingerLowerThreshold, int rSILowerThreshold, int rSIUpperThreshold, int rSILength, int bollingerBandsLength, double bollingerBandMult, int bollingerBandsOffset, bool apply25_75) 263 | { 264 | return TOSignals(Input, bollingerLowerThreshold, rSILowerThreshold, rSIUpperThreshold, rSILength, bollingerBandsLength, bollingerBandMult, bollingerBandsOffset, apply25_75); 265 | } 266 | 267 | public ArchReactor.TOSignals TOSignals(ISeries input, double bollingerLowerThreshold, int rSILowerThreshold, int rSIUpperThreshold, int rSILength, int bollingerBandsLength, double bollingerBandMult, int bollingerBandsOffset, bool apply25_75) 268 | { 269 | if (cacheTOSignals != null) 270 | for (int idx = 0; idx < cacheTOSignals.Length; idx++) 271 | if (cacheTOSignals[idx] != null && cacheTOSignals[idx].BollingerLowerThreshold == bollingerLowerThreshold && cacheTOSignals[idx].RSILowerThreshold == rSILowerThreshold && cacheTOSignals[idx].RSIUpperThreshold == rSIUpperThreshold && cacheTOSignals[idx].RSILength == rSILength && cacheTOSignals[idx].BollingerBandsLength == bollingerBandsLength && cacheTOSignals[idx].BollingerBandMult == bollingerBandMult && cacheTOSignals[idx].BollingerBandsOffset == bollingerBandsOffset && cacheTOSignals[idx].Apply25_75 == apply25_75 && cacheTOSignals[idx].EqualsInput(input)) 272 | return cacheTOSignals[idx]; 273 | return CacheIndicator(new ArchReactor.TOSignals(){ BollingerLowerThreshold = bollingerLowerThreshold, RSILowerThreshold = rSILowerThreshold, RSIUpperThreshold = rSIUpperThreshold, RSILength = rSILength, BollingerBandsLength = bollingerBandsLength, BollingerBandMult = bollingerBandMult, BollingerBandsOffset = bollingerBandsOffset, Apply25_75 = apply25_75 }, input, ref cacheTOSignals); 274 | } 275 | } 276 | } 277 | 278 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns 279 | { 280 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase 281 | { 282 | public Indicators.ArchReactor.TOSignals TOSignals(double bollingerLowerThreshold, int rSILowerThreshold, int rSIUpperThreshold, int rSILength, int bollingerBandsLength, double bollingerBandMult, int bollingerBandsOffset, bool apply25_75) 283 | { 284 | return indicator.TOSignals(Input, bollingerLowerThreshold, rSILowerThreshold, rSIUpperThreshold, rSILength, bollingerBandsLength, bollingerBandMult, bollingerBandsOffset, apply25_75); 285 | } 286 | 287 | public Indicators.ArchReactor.TOSignals TOSignals(ISeries input , double bollingerLowerThreshold, int rSILowerThreshold, int rSIUpperThreshold, int rSILength, int bollingerBandsLength, double bollingerBandMult, int bollingerBandsOffset, bool apply25_75) 288 | { 289 | return indicator.TOSignals(input, bollingerLowerThreshold, rSILowerThreshold, rSIUpperThreshold, rSILength, bollingerBandsLength, bollingerBandMult, bollingerBandsOffset, apply25_75); 290 | } 291 | } 292 | } 293 | 294 | namespace NinjaTrader.NinjaScript.Strategies 295 | { 296 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase 297 | { 298 | public Indicators.ArchReactor.TOSignals TOSignals(double bollingerLowerThreshold, int rSILowerThreshold, int rSIUpperThreshold, int rSILength, int bollingerBandsLength, double bollingerBandMult, int bollingerBandsOffset, bool apply25_75) 299 | { 300 | return indicator.TOSignals(Input, bollingerLowerThreshold, rSILowerThreshold, rSIUpperThreshold, rSILength, bollingerBandsLength, bollingerBandMult, bollingerBandsOffset, apply25_75); 301 | } 302 | 303 | public Indicators.ArchReactor.TOSignals TOSignals(ISeries input , double bollingerLowerThreshold, int rSILowerThreshold, int rSIUpperThreshold, int rSILength, int bollingerBandsLength, double bollingerBandMult, int bollingerBandsOffset, bool apply25_75) 304 | { 305 | return indicator.TOSignals(input, bollingerLowerThreshold, rSILowerThreshold, rSIUpperThreshold, rSILength, bollingerBandsLength, bollingerBandMult, bollingerBandsOffset, apply25_75); 306 | } 307 | } 308 | } 309 | 310 | #endregion 311 | -------------------------------------------------------------------------------- /Indicators/TwinRangeFilter.cs: -------------------------------------------------------------------------------- 1 | #region Using declarations 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.ComponentModel.DataAnnotations; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Xml.Serialization; 13 | using NinjaTrader.Cbi; 14 | using NinjaTrader.Gui; 15 | using NinjaTrader.Gui.Chart; 16 | using NinjaTrader.Gui.SuperDom; 17 | using NinjaTrader.Gui.Tools; 18 | using NinjaTrader.Data; 19 | using NinjaTrader.NinjaScript; 20 | using NinjaTrader.Core.FloatingPoint; 21 | using NinjaTrader.NinjaScript.DrawingTools; 22 | #endregion 23 | 24 | //This namespace holds Indicators in this folder and is required. Do not change it. 25 | namespace NinjaTrader.NinjaScript.Indicators.ArchReactor 26 | { 27 | public class TwinRangeFilter : Indicator 28 | { 29 | 30 | private Series x; 31 | private Series xCalc; 32 | private Series avrng; 33 | private Series rngfilt; 34 | private Series upward; 35 | private Series downward; 36 | private Series condIni; 37 | private Series Buy; 38 | private Series Sell; 39 | private Series trend; 40 | private Series HBand; 41 | private Series LBand; 42 | 43 | protected override void OnStateChange() 44 | { 45 | if (State == State.SetDefaults) 46 | { 47 | Description = @"Enter the description for your new custom Indicator here."; 48 | Name = "TwinRangeFilter"; 49 | Calculate = Calculate.OnEachTick; 50 | IsOverlay = true; 51 | DisplayInDataBox = true; 52 | DrawOnPricePanel = true; 53 | DrawHorizontalGridLines = true; 54 | DrawVerticalGridLines = true; 55 | PaintPriceMarkers = true; 56 | ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right; 57 | //Disable this property if your indicator requires custom values that cumulate with each new market data event. 58 | //See Help Guide for additional information. 59 | IsSuspendedWhileInactive = true; 60 | FastPeriod = 27; 61 | FastRange = 1.6; 62 | SlowPeriod = 55; 63 | SlowRange = 2; 64 | AddPlot(new Stroke(Brushes.Red, 8), PlotStyle.TriangleDown, "Short"); 65 | AddPlot(new Stroke(Brushes.Green, 8), PlotStyle.TriangleUp, "Long"); 66 | } 67 | else if (State == State.Configure) 68 | { 69 | x = new Series(this, MaximumBarsLookBack.Infinite); 70 | xCalc = new Series(this, MaximumBarsLookBack.Infinite); 71 | avrng = new Series(this, MaximumBarsLookBack.Infinite); 72 | rngfilt = new Series(this, MaximumBarsLookBack.Infinite); 73 | upward = new Series(this, MaximumBarsLookBack.Infinite); 74 | downward = new Series(this, MaximumBarsLookBack.Infinite); 75 | condIni = new Series(this, MaximumBarsLookBack.Infinite); 76 | Buy = new Series(this, MaximumBarsLookBack.Infinite); 77 | Sell = new Series(this, MaximumBarsLookBack.Infinite); 78 | trend = new Series(this, MaximumBarsLookBack.Infinite); 79 | HBand = new Series(this, MaximumBarsLookBack.Infinite); 80 | LBand = new Series(this, MaximumBarsLookBack.Infinite); 81 | } 82 | } 83 | 84 | protected override void OnBarUpdate() 85 | { 86 | if (CurrentBar < 2) { 87 | x[0] = 0; 88 | xCalc[0] = 0; 89 | avrng[0] = 0; 90 | rngfilt[0] = 0; 91 | upward[0] = 0; 92 | downward[0] = 0; 93 | condIni[0] = 0; 94 | return; 95 | } 96 | 97 | x[0] = Close[0]; 98 | double smrng1 = smoothrng(FastPeriod, FastRange); 99 | double smrng2 = smoothrng(SlowPeriod, SlowRange); 100 | double smrng = (smrng1 + smrng2) / 2; 101 | rngfilter(smrng); 102 | upward[0] = rngfilt[0] > rngfilt[1] ? upward[1] + 1 : rngfilt[0] < rngfilt[1] ? 0 : upward[1]; 103 | downward[0] = rngfilt[0] < rngfilt[1] ? downward[1] + 1 : rngfilt[0] > rngfilt[1] ? 0 : downward[1]; 104 | HBand[0] = rngfilt[0] + smrng; 105 | LBand[0] = rngfilt[0] - smrng; 106 | bool longCond = false; 107 | bool shortCond = false; 108 | longCond = Close[0] > rngfilt[0] && Close[0] > Close[1] && upward[0] > 0 || Close[0] > rngfilt[0] && Close[0] < Close[1] && upward[0] > 0; 109 | 110 | shortCond = Close[0] < rngfilt[0] && Close[0] < Close[1] && downward[0] > 0 || Close[0] < rngfilt[0] && Close[0] > Close[1] && downward[0] > 0; 111 | 112 | condIni[0] = longCond ? 1 : shortCond ? -1 : condIni[1]; 113 | bool longCondition = longCond && condIni[1] == -1; 114 | bool shortCondition = shortCond && condIni[1] == 1; 115 | 116 | if (longCondition == true) { 117 | Long[0] = Low[0] - 5*TickSize; 118 | } else if (shortCondition == true) { 119 | Short[0] = High[0] + 5*TickSize; 120 | } 121 | } 122 | 123 | private double smoothrng(int t, double m) { 124 | int wper = t * 2 - 1; 125 | xCalc[0] = Math.Abs(x[0] - x[1]); 126 | avrng[0] = EMA(xCalc, t)[0]; 127 | double smoothrng = EMA(avrng, wper)[0] * m; 128 | return smoothrng; 129 | } 130 | 131 | private void rngfilter(double r) { 132 | rngfilt[0] = x[0]; 133 | if (Double.IsNaN(rngfilt[1])) { 134 | rngfilt[1] = 0.0; 135 | } 136 | 137 | rngfilt[0] = (x[0] > rngfilt[1]) ? ((x[0] - r < rngfilt[1]) ? rngfilt[1] : x[0] - r) : x[0] + r > rngfilt[1] ? rngfilt[1] : x[0] + r; 138 | } 139 | 140 | #region Properties 141 | [NinjaScriptProperty] 142 | [Range(1, int.MaxValue)] 143 | [Display(Name="FastPeriod", Description="Fast Period", Order=1, GroupName="Parameters")] 144 | public int FastPeriod 145 | { get; set; } 146 | 147 | [NinjaScriptProperty] 148 | [Range(0.1, double.MaxValue)] 149 | [Display(Name="FastRange", Description="Fast Range", Order=2, GroupName="Parameters")] 150 | public double FastRange 151 | { get; set; } 152 | 153 | [NinjaScriptProperty] 154 | [Range(1, int.MaxValue)] 155 | [Display(Name="SlowPeriod", Description="Slow Period", Order=3, GroupName="Parameters")] 156 | public int SlowPeriod 157 | { get; set; } 158 | 159 | [NinjaScriptProperty] 160 | [Range(0.1, double.MaxValue)] 161 | [Display(Name="SlowRange", Description="Slow Range", Order=4, GroupName="Parameters")] 162 | public double SlowRange 163 | { get; set; } 164 | 165 | [Browsable(false)] 166 | [XmlIgnore] 167 | public Series Short 168 | { 169 | get { return Values[0]; } 170 | } 171 | 172 | [Browsable(false)] 173 | [XmlIgnore] 174 | public Series Long 175 | { 176 | get { return Values[1]; } 177 | } 178 | #endregion 179 | 180 | } 181 | } 182 | 183 | #region NinjaScript generated code. Neither change nor remove. 184 | 185 | namespace NinjaTrader.NinjaScript.Indicators 186 | { 187 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase 188 | { 189 | private ArchReactor.TwinRangeFilter[] cacheTwinRangeFilter; 190 | public ArchReactor.TwinRangeFilter TwinRangeFilter(int fastPeriod, double fastRange, int slowPeriod, double slowRange) 191 | { 192 | return TwinRangeFilter(Input, fastPeriod, fastRange, slowPeriod, slowRange); 193 | } 194 | 195 | public ArchReactor.TwinRangeFilter TwinRangeFilter(ISeries input, int fastPeriod, double fastRange, int slowPeriod, double slowRange) 196 | { 197 | if (cacheTwinRangeFilter != null) 198 | for (int idx = 0; idx < cacheTwinRangeFilter.Length; idx++) 199 | if (cacheTwinRangeFilter[idx] != null && cacheTwinRangeFilter[idx].FastPeriod == fastPeriod && cacheTwinRangeFilter[idx].FastRange == fastRange && cacheTwinRangeFilter[idx].SlowPeriod == slowPeriod && cacheTwinRangeFilter[idx].SlowRange == slowRange && cacheTwinRangeFilter[idx].EqualsInput(input)) 200 | return cacheTwinRangeFilter[idx]; 201 | return CacheIndicator(new ArchReactor.TwinRangeFilter(){ FastPeriod = fastPeriod, FastRange = fastRange, SlowPeriod = slowPeriod, SlowRange = slowRange }, input, ref cacheTwinRangeFilter); 202 | } 203 | } 204 | } 205 | 206 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns 207 | { 208 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase 209 | { 210 | public Indicators.ArchReactor.TwinRangeFilter TwinRangeFilter(int fastPeriod, double fastRange, int slowPeriod, double slowRange) 211 | { 212 | return indicator.TwinRangeFilter(Input, fastPeriod, fastRange, slowPeriod, slowRange); 213 | } 214 | 215 | public Indicators.ArchReactor.TwinRangeFilter TwinRangeFilter(ISeries input , int fastPeriod, double fastRange, int slowPeriod, double slowRange) 216 | { 217 | return indicator.TwinRangeFilter(input, fastPeriod, fastRange, slowPeriod, slowRange); 218 | } 219 | } 220 | } 221 | 222 | namespace NinjaTrader.NinjaScript.Strategies 223 | { 224 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase 225 | { 226 | public Indicators.ArchReactor.TwinRangeFilter TwinRangeFilter(int fastPeriod, double fastRange, int slowPeriod, double slowRange) 227 | { 228 | return indicator.TwinRangeFilter(Input, fastPeriod, fastRange, slowPeriod, slowRange); 229 | } 230 | 231 | public Indicators.ArchReactor.TwinRangeFilter TwinRangeFilter(ISeries input , int fastPeriod, double fastRange, int slowPeriod, double slowRange) 232 | { 233 | return indicator.TwinRangeFilter(input, fastPeriod, fastRange, slowPeriod, slowRange); 234 | } 235 | } 236 | } 237 | 238 | #endregion 239 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # This README is still a work in progress. 2 | # ArchReactor - Strategies 3 | Welcome to Strategies and indicators git hub. This is developed and maintained by archReactor. Its open for all to see and contribute. So that we can grow this github with custom strategies for everyone to use. 4 | 5 | ## Contributing to the repo 6 | The process to contributing repo is very simple. 7 | - Create a PR against the main branch. 8 | - You will not be able to merge the PR. It will need my approval. 9 | - Once a PR is made shoot me a DM and I will review it and comment or merge your changes if all looks good. 10 | 11 | ## Installation 12 | 13 | ## Strategies How to 14 | Click below on each strategies to get an explanation of how they work. 15 | - Base Order management Algo. 16 | - Swing bot with ADXVMA Filter. 17 | - Swing bot with Ripster EMA Filter. 18 | - HMA Wave and B4 19 | - NQ ES EZ. 20 | - Nadaraya Watson - RSI & TO Signals & Camarilla Pivots 21 | - Blt Trigger Lines Crossover 22 | 23 | ## Disclaimers 24 | - I have ZERO Knowledge about trading , but i know damn well how to implement an algorithm ... 25 | - Please Please try it in SIM or playback and be comfortable with settings .. the strategy templates are not mine , they have been tested by some discord users.. and compiled . 26 | - THIS IS NOT A GET RICH QUICK SCHEME .. SO DONT TREAT IT LIKE THAT. 27 | - I WILL NOT BE RESPOSIBLE FOR ANY LOSSES 😄 28 | - DONT BLOW UP YOUR ACCOUNT .. 😛 29 | - I am not a professional ninja coder.. just a self taught one so this will not be memory optimized... 16gb or higher ram may be recommended especially for ripster cloud..Also i am NOT a coder for hire.. have a 9-5 job lol .. so wont be able to do any custom coding for anyone.. this is purely Pro Bono work 😄. Also this may have some bugs and errors, report back so that i can fix it .. 🙂. Markets always change .. so with that strategy parameters should adapt and so change settings as per market conditions. 30 | -------------------------------------------------------------------------------- /Strategies/ArchReactor/AR_Blt_Crossovers.cs: -------------------------------------------------------------------------------- 1 | #region Using declarations 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.ComponentModel.DataAnnotations; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Xml.Serialization; 13 | using NinjaTrader.Cbi; 14 | using NinjaTrader.Gui; 15 | using NinjaTrader.Gui.Chart; 16 | using NinjaTrader.Gui.SuperDom; 17 | using NinjaTrader.Gui.Tools; 18 | using NinjaTrader.Data; 19 | using NinjaTrader.NinjaScript; 20 | using NinjaTrader.Core.FloatingPoint; 21 | using NinjaTrader.NinjaScript.Indicators; 22 | using NinjaTrader.NinjaScript.DrawingTools; 23 | using BltTriggerLines.Common; 24 | #endregion 25 | 26 | //This namespace holds Strategies in this folder and is required. Do not change it. 27 | namespace NinjaTrader.NinjaScript.Strategies.ArchReactor 28 | { 29 | public class AR_Blt_Crossovers : ArchReactorAlgoBase 30 | { 31 | private NinjaTrader.NinjaScript.Indicators.BltTriggerLines Fast_BltTriggerLines; 32 | private NinjaTrader.NinjaScript.Indicators.BltTriggerLines Slow_BltTriggerLines; 33 | protected override void OnStateChange() 34 | { 35 | base.OnStateChange(); 36 | if (State == State.SetDefaults) 37 | { 38 | Description = @"Blt Trigger Crossovers"; 39 | Name = "AR_Blt_Crossovers"; 40 | StrategyName = "AR_Blt_Crossovers"; 41 | StrategyVersion = "2.0"; 42 | 43 | #region BltTriggerLines 44 | Fast_TriggerMA = BltMAType.DEMA; 45 | Fast_TriggerMAPeriod = 10; 46 | Fast_AverageMA = BltMAType.EMA; 47 | Fast_AverageMAPeriod = 35; 48 | 49 | Filter_SlowBlt = true; 50 | Slow_TriggerMA = BltMAType.EMA; 51 | Slow_TriggerMAPeriod = 20; 52 | Slow_AverageMA = BltMAType.EMA; 53 | Slow_AverageMAPeriod = 15; 54 | #endregion 55 | } 56 | else if (State == State.Configure) 57 | { 58 | } 59 | } 60 | 61 | protected override void OnBarUpdate() 62 | { 63 | base.OnBarUpdate(); 64 | } 65 | 66 | protected override bool validateEntryLong() { 67 | 68 | if (Filter_SlowBlt == true) { 69 | if (CrossAbove(Slow_BltTriggerLines.Trigger, Slow_BltTriggerLines.Average, 1) && Fast_BltTriggerLines.Trigger[0] > Fast_BltTriggerLines.Average[0]) { 70 | return true; 71 | } 72 | } else { 73 | if (CrossAbove(Fast_BltTriggerLines.Trigger, Fast_BltTriggerLines.Average, 1)) { 74 | return true; 75 | } 76 | } 77 | return false; 78 | } 79 | 80 | protected override bool validateEntryShort() { 81 | if (Filter_SlowBlt == true) { 82 | if (CrossBelow(Slow_BltTriggerLines.Trigger, Slow_BltTriggerLines.Average, 1) && Fast_BltTriggerLines.Trigger[0] < Fast_BltTriggerLines.Average[0]) { 83 | return true; 84 | } 85 | } else { 86 | if (CrossBelow(Fast_BltTriggerLines.Trigger, Fast_BltTriggerLines.Average, 1)) { 87 | return true; 88 | } 89 | } 90 | return false; 91 | } 92 | 93 | protected override bool validateExitLong() { 94 | if (Filter_SlowBlt == false && CrossBelow(Fast_BltTriggerLines.Trigger, Fast_BltTriggerLines.Average, 1)) { 95 | return true; 96 | } 97 | return false; 98 | } 99 | 100 | protected override bool validateExitShort() { 101 | if (Filter_SlowBlt == false && CrossAbove(Fast_BltTriggerLines.Trigger, Fast_BltTriggerLines.Average, 1)) { 102 | return true; 103 | } 104 | return false; 105 | } 106 | 107 | 108 | #region Strategy Management 109 | protected override void initializeIndicators() { 110 | Fast_BltTriggerLines = BltTriggerLines(Fast_TriggerMA, Fast_TriggerMAPeriod, Fast_AverageMA, Fast_AverageMAPeriod, ColorStyle.RegionColors, false, 5, Brushes.Cyan, Brushes.Teal, true, 40, Brushes.Green, Brushes.Red, false, null, Brushes.Green, Brushes.Red, Brushes.Green, Brushes.Red); 111 | AddChartIndicator(Fast_BltTriggerLines); 112 | 113 | if (Filter_SlowBlt == true) { 114 | Slow_BltTriggerLines = BltTriggerLines(Slow_TriggerMA, Slow_TriggerMAPeriod, Slow_AverageMA, Slow_AverageMAPeriod, ColorStyle.RegionColors, true, 5, Brushes.Blue, Brushes.DeepPink, true, 40, Brushes.Blue, Brushes.DeepPink, false, null, Brushes.Blue, Brushes.DeepPink, Brushes.Blue, Brushes.DeepPink); 115 | AddChartIndicator(Slow_BltTriggerLines); 116 | } 117 | } 118 | 119 | #endregion 120 | 121 | #region Properties 122 | 123 | [NinjaScriptProperty] 124 | [Display(ResourceType = typeof(Custom.Resource), Name = "Fast_TriggerMA", GroupName = "1 Strategy Params - Fast BltTrigger", Order = 1)] 125 | public BltMAType Fast_TriggerMA 126 | { get; set; } 127 | 128 | [NinjaScriptProperty] 129 | [Range(0, int.MaxValue)] 130 | [Display(Name = "Fast_TriggerMAPeriod", Order = 2, GroupName = "1 Strategy Params - Fast BltTrigger")] 131 | public int Fast_TriggerMAPeriod 132 | { 133 | get; set; 134 | } 135 | 136 | [NinjaScriptProperty] 137 | [Display(ResourceType = typeof(Custom.Resource), Name = "Fast_AverageMA", GroupName = "1 Strategy Params - Fast BltTrigger", Order = 3)] 138 | public BltMAType Fast_AverageMA 139 | { get; set; } 140 | 141 | [NinjaScriptProperty] 142 | [Range(0, int.MaxValue)] 143 | [Display(Name = "Fast_AverageMAPeriod", Order = 4, GroupName = "1 Strategy Params - Fast BltTrigger")] 144 | public int Fast_AverageMAPeriod 145 | { 146 | get; set; 147 | } 148 | 149 | [NinjaScriptProperty] 150 | [Display(Name = "Filter_SlowBlt", Order = 1, GroupName = "1 Strategy Params - Slow BltTrigger")] 151 | public bool Filter_SlowBlt 152 | { get; set; } 153 | 154 | 155 | [NinjaScriptProperty] 156 | [Display(ResourceType = typeof(Custom.Resource), Name = "Slow_TriggerMA", GroupName = "1 Strategy Params - Slow BltTrigger", Order = 2)] 157 | public BltMAType Slow_TriggerMA 158 | { get; set; } 159 | 160 | [NinjaScriptProperty] 161 | [Range(0, int.MaxValue)] 162 | [Display(Name = "Slow_TriggerMAPeriod", Order = 3, GroupName = "1 Strategy Params - Slow BltTrigger")] 163 | public int Slow_TriggerMAPeriod 164 | { 165 | get; set; 166 | } 167 | 168 | [NinjaScriptProperty] 169 | [Display(ResourceType = typeof(Custom.Resource), Name = "Slow_AverageMA", GroupName = "1 Strategy Params - Slow BltTrigger", Order = 4)] 170 | public BltMAType Slow_AverageMA 171 | { get; set; } 172 | 173 | [NinjaScriptProperty] 174 | [Range(0, int.MaxValue)] 175 | [Display(Name = "Slow_AverageMAPeriod", Order = 5, GroupName = "1 Strategy Params - Slow BltTrigger")] 176 | public int Slow_AverageMAPeriod 177 | { 178 | get; set; 179 | } 180 | 181 | 182 | #endregion 183 | } 184 | } 185 | -------------------------------------------------------------------------------- /Strategies/ArchReactor/AR_Dimati_VWAP_MACD.cs: -------------------------------------------------------------------------------- 1 | #region Using declarations 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.ComponentModel.DataAnnotations; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Xml.Serialization; 13 | using NinjaTrader.Cbi; 14 | using NinjaTrader.Gui; 15 | using NinjaTrader.Gui.Chart; 16 | using NinjaTrader.Gui.SuperDom; 17 | using NinjaTrader.Gui.Tools; 18 | using NinjaTrader.Data; 19 | using NinjaTrader.NinjaScript; 20 | using NinjaTrader.Core.FloatingPoint; 21 | using NinjaTrader.NinjaScript.Indicators; 22 | using NinjaTrader.NinjaScript.DrawingTools; 23 | #endregion 24 | 25 | //This namespace holds Strategies in this folder and is required. Do not change it. 26 | namespace NinjaTrader.NinjaScript.Strategies.ArchReactor 27 | { 28 | public class AR_Dimati_VWAP_MACD : ArchReactorAlgoBase 29 | { 30 | private NinjaTrader.NinjaScript.Indicators.Prop_Trader_Tools.FreeVWAP Vwap; 31 | private MACD MACD1; 32 | protected override void OnStateChange() 33 | { 34 | base.OnStateChange(); 35 | 36 | if (State == State.SetDefaults) 37 | { 38 | Description = @"This is a strategy by user Dimati to be used in 5 min CL."; 39 | Name = "AR_Dimati_VWAP_MACD"; 40 | StrategyName = "AR_Dimati_VWAP_MACD"; 41 | Credits = "Strategy provided by discord user Dimati"; 42 | 43 | AnchorHour = 14; 44 | AnchorMinute = 0; 45 | 46 | Fast = 12; 47 | Slow = 26; 48 | Smooth = 9; 49 | MacdDiff = 0.005; 50 | } 51 | } 52 | 53 | protected override void OnBarUpdate() 54 | { 55 | base.OnBarUpdate(); 56 | } 57 | 58 | #region Strategy Management 59 | protected override void initializeIndicators() { 60 | Vwap = FreeVWAP("VWAP", false, false, false, 1,2,3, Brushes.Blue, 20, Brushes.Blue, 20, Brushes.Blue, 20, false, false, false, true, AnchorHour, AnchorMinute, false); 61 | AddChartIndicator(Vwap); 62 | 63 | MACD1 = MACD(Fast, Slow, Smooth); 64 | AddChartIndicator(MACD1); 65 | 66 | } 67 | 68 | protected override bool validateEntryLong() { 69 | if (Open[0] < Vwap.Vwap[0] 70 | && Close[0] > Vwap.Vwap[0] 71 | && MACD1.Diff[0] > MacdDiff){ 72 | return true; 73 | } 74 | return false; 75 | } 76 | 77 | protected override bool validateEntryShort() { 78 | if (Open[0] > Vwap.Vwap[0] 79 | && Close[0] < Vwap.Vwap[0] 80 | && MACD1.Diff[0] < MacdDiff){ 81 | return true; 82 | } 83 | return false; 84 | } 85 | 86 | #endregion 87 | 88 | #region Properties 89 | [NinjaScriptProperty] 90 | [Display(Name="AnchorHour", Order=1, GroupName="1.1 Strategy Params - Vwap")] 91 | public int AnchorHour 92 | { get; set; } 93 | 94 | [NinjaScriptProperty] 95 | [Display(Name="AnchorMinute", Order=2, GroupName="1.1 Strategy Params - Vwap")] 96 | public int AnchorMinute 97 | { get; set; } 98 | 99 | [NinjaScriptProperty] 100 | [Display(Name="Fast", Order=1, GroupName="1.1 Strategy Params - MACD")] 101 | public int Fast 102 | { get; set; } 103 | 104 | [NinjaScriptProperty] 105 | [Display(Name="Slow", Order=2, GroupName="1.1 Strategy Params - MACD")] 106 | public int Slow 107 | { get; set; } 108 | 109 | [NinjaScriptProperty] 110 | [Display(Name="Smooth", Order=3, GroupName="1.1 Strategy Params - MACD")] 111 | public int Smooth 112 | { get; set; } 113 | 114 | [NinjaScriptProperty] 115 | [Display(Name="MacdDiff", Order=4, GroupName="1.1 Strategy Params - MACD")] 116 | public double MacdDiff 117 | { get; set; } 118 | #endregion 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /Strategies/ArchReactor/AR_HMA_B4_Strategy.cs: -------------------------------------------------------------------------------- 1 | #region Using declarations 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.ComponentModel.DataAnnotations; 6 | using System.Diagnostics; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | using System.Windows; 11 | using System.Windows.Input; 12 | using System.Windows.Media; 13 | using System.Xml.Serialization; 14 | using NinjaTrader.Cbi; 15 | using NinjaTrader.Gui; 16 | using NinjaTrader.Gui.Chart; 17 | using NinjaTrader.Gui.SuperDom; 18 | using NinjaTrader.Gui.Tools; 19 | using NinjaTrader.Data; 20 | using NinjaTrader.NinjaScript; 21 | using NinjaTrader.Core.FloatingPoint; 22 | using NinjaTrader.NinjaScript.Indicators; 23 | using NinjaTrader.NinjaScript.DrawingTools; 24 | using BltTriggerLines.Common; 25 | #endregion 26 | 27 | namespace NinjaTrader.NinjaScript.Strategies.ArchReactor { 28 | public class AR_HMA_B4_Strategy : ArchReactorAlgoBase { 29 | 30 | #region Variables 31 | #region Strategy variables 32 | //private NinjaTrader.NinjaScript.Indicators.B4Signals.B4Indicator B4Indicator1; 33 | private NinjaTrader.NinjaScript.Indicators.BobC.HMAWaveSmoothFull HMAWaveSmoothFull1; 34 | private NinjaTrader.NinjaScript.Indicators.ADX ADX1; 35 | private NinjaTrader.NinjaScript.Indicators.LizardIndicators.amaADXVMA amaADXVMA1; 36 | private NinjaTrader.NinjaScript.Indicators.TradeSaber.ReversalTS ReversalTS1; 37 | private NinjaTrader.NinjaScript.Indicators.RipsterEMAClouds RipsterEMAClouds1; 38 | private NinjaTrader.NinjaScript.Indicators.BltTriggerLines BltTriggerLines1; 39 | private NinjaTrader.NinjaScript.Indicators.BltTriggerLines BltTriggerLines2; 40 | private NinjaTrader.NinjaScript.Indicators.B4v3 B4v31; 41 | #endregion 42 | private int currentReversalBarIdx = 1; 43 | 44 | private bool isProfitTargetHit = false; 45 | private double profitTargetPrice; 46 | #endregion 47 | 48 | #region OnStateChange 49 | protected override void OnStateChange() 50 | { 51 | base.OnStateChange(); 52 | 53 | if (State == State.SetDefaults) 54 | { 55 | Description = @"HMA Wave smooth indicator with B4 Signals, from Arch Reactor Algo"; 56 | Name = "AR_HMA_B4_Strategy"; 57 | StrategyName = "AR_HMS_B4"; 58 | 59 | #region Indicator Variable Initialization 60 | #region HMA Wave 61 | HMAWave_Period = 64; 62 | HMAWave_HMABack = 1; 63 | HMAWave_Smooth = 1; 64 | #endregion 65 | 66 | #region ADX 67 | ADXFilter = true; 68 | ADX_Period = 5; 69 | ADX_Min = 40; 70 | #endregion 71 | 72 | #region ADXVMA 73 | ADXVMAFilter = false; 74 | ADXVMA_Period = 5; 75 | #endregion 76 | 77 | #region B4 LookBack 78 | EnableB4_Lookback = false; 79 | B4_Lookback = 4; 80 | #endregion 81 | 82 | #region EMA Trend 83 | Enable_EMA_Trend_Filter = true; 84 | #endregion 85 | #endregion 86 | } 87 | } 88 | #endregion 89 | 90 | #region onBarUpdate 91 | protected override void OnBarUpdate() 92 | { 93 | if (EnableB4_Lookback == true) { 94 | if (ReversalTS1.CurrentReversalBar[0] == 1 || ReversalTS1.CurrentReversalBar[0] == -1) { 95 | currentReversalBarIdx = CurrentBar; 96 | } 97 | } 98 | base.OnBarUpdate(); 99 | } 100 | #endregion 101 | 102 | #region Strategy Management 103 | protected override void initializeIndicators() { 104 | // B4Indicator1 = B4Indicator(Close, false, true, false, true, true, true, true, @"1.0.0"); 105 | B4v31 = B4v3(true, true, true, true, 5, 12, 26, 15, 1, 11, 23.6, true, 30); 106 | HMAWaveSmoothFull1 = HMAWaveSmoothFull(Close, HMAWave_Period, 11, Brushes.DodgerBlue, Brushes.Khaki, 3, @"", 0, true, 11, HMAWave_HMABack, HMAWave_Smooth); 107 | AddChartIndicator(B4v31); 108 | AddChartIndicator(HMAWaveSmoothFull1); 109 | if (ADXFilter == true) { 110 | ADX1 = ADX(ADX_Period); 111 | AddChartIndicator(ADX1); 112 | } 113 | 114 | if (ADXVMAFilter == true) { 115 | amaADXVMA1 = amaADXVMA(ADXVMA_Period); 116 | AddChartIndicator(amaADXVMA1); 117 | } 118 | 119 | if (EnableB4_Lookback == true) { 120 | ReversalTS1 = ReversalTS(0, 0, 0, true, Brushes.Violet, Brushes.Yellow, false, Brushes.Transparent, false); 121 | AddChartIndicator(ReversalTS1); 122 | } 123 | 124 | if (Enable_EMA_Trend_Filter == true) { 125 | RipsterEMAClouds1 = RipsterEMAClouds(8, 9, 5, 12, 34, 50, 72, 89, 180, 200, 0, 3); 126 | AddChartIndicator(RipsterEMAClouds1); 127 | } 128 | 129 | /*BltTriggerLines1 = BltTriggerLines(BltMAType.WMA, 21, BltMAType.EMA,13,ColorStyle.RegionColors, false, 0, null, null, false, 0, null, null, false, null, Brushes.Green, Brushes.Red, Brushes.Green, Brushes.Red); 130 | AddChartIndicator(BltTriggerLines1); 131 | 132 | BltTriggerLines2 = BltTriggerLines(BltMAType.EMA, 63, BltMAType.EMA,21,ColorStyle.RegionColors, false, 0, null, null, false, 0, null, null, false, null, Brushes.Green, Brushes.Red, Brushes.Green, Brushes.Red); 133 | AddChartIndicator(BltTriggerLines2);*/ 134 | } 135 | 136 | protected override bool validateEntryLong() { 137 | if ((B4v31.BuySellOutput[0] == 1) 138 | && (HMAWaveSmoothFull1.Trend[0] == 1) 139 | && validateFiltersLong() == true 140 | && validateB4SignalLookBack() == true 141 | && validateRipsterCloud(false) == true) { 142 | return true; 143 | } 144 | return false; 145 | } 146 | 147 | private bool validateRipsterCloud(bool isShort) { 148 | if (Enable_EMA_Trend_Filter == false) { 149 | return true; 150 | } 151 | 152 | if (isShort == false) { 153 | if (RipsterEMAClouds1.EMA1Trend[0] == 1 && RipsterEMAClouds1.EMA2Trend[0] == 1 && RipsterEMAClouds1.EMA3Trend[0] == 1) { 154 | return true; 155 | } 156 | } else { 157 | if (RipsterEMAClouds1.EMA1Trend[0] == -1 && RipsterEMAClouds1.EMA2Trend[0] == -1 && RipsterEMAClouds1.EMA3Trend[0] == -1) { 158 | return true; 159 | } 160 | } 161 | return false; 162 | } 163 | 164 | protected override bool validateEntryShort() { 165 | if ((B4v31.BuySellOutput[0] == -1) 166 | && (HMAWaveSmoothFull1.Trend[0] == -1) 167 | && validateFiltersShort() == true 168 | && validateB4SignalLookBack() == true 169 | && validateRipsterCloud(true) == true) { 170 | return true; 171 | } 172 | return false; 173 | } 174 | 175 | private bool validateB4SignalLookBack() { 176 | if (EnableB4_Lookback == true) { 177 | return (CurrentBar - currentReversalBarIdx) <= B4_Lookback; 178 | } else 179 | return true; 180 | } 181 | 182 | 183 | private bool validateFiltersLong() { 184 | bool isADXValid = true; 185 | if (ADXFilter == true) { 186 | if (ADX1[0] >= ADX_Min) 187 | isADXValid = true; 188 | else 189 | isADXValid = false; 190 | } 191 | 192 | bool isADXVMAValid = true; 193 | if (ADXVMAFilter == true) { 194 | if(amaADXVMA1.Trend[0] == 1.0) 195 | isADXVMAValid = true; 196 | else 197 | isADXVMAValid = false; 198 | } 199 | 200 | return isADXValid == true && isADXVMAValid == true; 201 | } 202 | 203 | private bool validateFiltersShort() { 204 | bool isADXValid = true; 205 | if (ADXFilter == true) { 206 | if (ADX1[0] >= ADX_Min) 207 | isADXValid = true; 208 | else 209 | isADXValid = false; 210 | } 211 | 212 | bool isADXVMAValid = true; 213 | if (ADXVMAFilter == true) { 214 | if(amaADXVMA1.Trend[0] == -1.0) 215 | isADXVMAValid = true; 216 | else 217 | isADXVMAValid = false; 218 | } 219 | 220 | return isADXValid == true && isADXVMAValid == true; 221 | } 222 | 223 | protected override bool validateExitLong() { 224 | if (HMAWaveSmoothFull1 != null && HMAWaveSmoothFull1.Trend[0] == -1) { 225 | return true; 226 | } 227 | return false; 228 | } 229 | 230 | protected override bool validateExitShort() { 231 | if (HMAWaveSmoothFull1 != null && HMAWaveSmoothFull1.Trend[0] == 1) { 232 | return true; 233 | } 234 | return false; 235 | } 236 | #endregion 237 | 238 | #region Properties 239 | 240 | [NinjaScriptProperty] 241 | [Range(1, int.MaxValue)] 242 | [Display(Name="HMAWave_Period", Order=1, GroupName="1.1 Strategy Params - HMA Wave")] 243 | public int HMAWave_Period 244 | { get; set; } 245 | 246 | [NinjaScriptProperty] 247 | [Range(1, int.MaxValue)] 248 | [Display(Name="HMAWave_HMABack", Order=2, GroupName="1.1 Strategy Params - HMA Wave")] 249 | public int HMAWave_HMABack 250 | { get; set; } 251 | 252 | [NinjaScriptProperty] 253 | [Range(1, int.MaxValue)] 254 | [Display(Name="HMAWave_Smooth", Order=3, GroupName="1.1 Strategy Params - HMA Wave")] 255 | public int HMAWave_Smooth 256 | { get; set; } 257 | 258 | [NinjaScriptProperty] 259 | [Display(Name = "ADXFilter", Order = 1, GroupName = "1.2 Strategy Params - ADX")] 260 | public bool ADXFilter 261 | { 262 | get; set; 263 | } 264 | 265 | [NinjaScriptProperty] 266 | [Range(1, int.MaxValue)] 267 | [Display(Name="ADX_Period", Order=2, GroupName="1.2 Strategy Params - ADX")] 268 | public int ADX_Period 269 | { get; set; } 270 | 271 | [NinjaScriptProperty] 272 | [Range(1, int.MaxValue)] 273 | [Display(Name="ADX_Min", Order=3, GroupName="1.2 Strategy Params - ADX")] 274 | public int ADX_Min 275 | { get; set; } 276 | 277 | [NinjaScriptProperty] 278 | [Display(Name = "ADXVMAFilter", Order = 1, GroupName = "1.3 Strategy Params - ADXVMA")] 279 | public bool ADXVMAFilter 280 | { 281 | get; set; 282 | } 283 | 284 | [NinjaScriptProperty] 285 | [Range(1, int.MaxValue)] 286 | [Display(Name="ADXVMA_Period", Order=2, GroupName="1.3 Strategy Params - ADXVMA")] 287 | public int ADXVMA_Period 288 | { get; set; } 289 | 290 | [NinjaScriptProperty] 291 | [Display(Name="EnableB4_Lookback", Description="How far from the reversal candle , should the signal appear and be valid to trade.", Order=1, GroupName="1.4 Strategy Params - B4 Signals")] 292 | public bool EnableB4_Lookback 293 | { get; set; } 294 | 295 | [NinjaScriptProperty] 296 | [Range(1, int.MaxValue)] 297 | [Display(Name="B4_Lookback", Order=2, GroupName="1.4 Strategy Params - B4 Signals")] 298 | public int B4_Lookback 299 | { get; set; } 300 | 301 | [NinjaScriptProperty] 302 | [Display(Name="Enable_EMA_Trend_Filter", Order=2, GroupName="1.4 Strategy Params - Ripster EMA Trend Filter")] 303 | public bool Enable_EMA_Trend_Filter 304 | { get; set; } 305 | #endregion 306 | 307 | } 308 | } -------------------------------------------------------------------------------- /Strategies/ArchReactor/AR_NQ_ES_EZ.cs: -------------------------------------------------------------------------------- 1 | #region Using declarations 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.ComponentModel.DataAnnotations; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Xml.Serialization; 13 | using NinjaTrader.Cbi; 14 | using NinjaTrader.Gui; 15 | using NinjaTrader.Gui.Chart; 16 | using NinjaTrader.Gui.SuperDom; 17 | using NinjaTrader.Gui.Tools; 18 | using NinjaTrader.Data; 19 | using NinjaTrader.NinjaScript; 20 | using NinjaTrader.Core.FloatingPoint; 21 | using NinjaTrader.NinjaScript.Indicators; 22 | using NinjaTrader.NinjaScript.DrawingTools; 23 | #endregion 24 | 25 | //This namespace holds Strategies in this folder and is required. Do not change it. 26 | namespace NinjaTrader.NinjaScript.Strategies.ArchReactor 27 | { 28 | public class AR_NQ_ES_EZ : ArchReactorAlgoBase 29 | { 30 | private LinReg LinReg1; 31 | private LinReg LinReg2; 32 | private NinjaTrader.NinjaScript.Indicators.RipsterEMAClouds RipsterEMAClouds1; 33 | private NinjaTrader.NinjaScript.Indicators.ADX ADX1; 34 | private NinjaTrader.NinjaScript.Indicators.LizardIndicators.amaADXVMA amaADXVMA1; 35 | private bool isProfitTargetHit = false; 36 | private double profitTargetPrice; 37 | private bool jumpToProfitSet = false; 38 | protected override void OnStateChange() 39 | { 40 | base.OnStateChange(); 41 | 42 | if (State == State.SetDefaults) 43 | { 44 | Description = @"NQ ES EZ, from Arch Reactor Algo ( added my order management but the strategy logic is from elite futures discord"; 45 | Name = "AR_NQ_ES_EZ"; 46 | StrategyName = "AR_NQ_ES_EZ"; 47 | 48 | #region Indicator Variable Initialization 49 | #region LinReg 50 | Use_Filter = false; 51 | Filter_Period = 70; 52 | #endregion 53 | 54 | #region ADX 55 | ADX_Filter = true; 56 | ADX_Period = 5; 57 | ADX_Min = 40; 58 | #endregion 59 | 60 | #endregion 61 | } else if (State == State.DataLoaded) { 62 | 63 | } 64 | 65 | 66 | } 67 | 68 | protected override void OnBarUpdate() 69 | { 70 | base.OnBarUpdate(); 71 | } 72 | 73 | 74 | #region Strategy Management 75 | protected override void initializeIndicators() { 76 | LinReg1 = LinReg(Close, Convert.ToInt32(Filter_Period)); 77 | LinReg2 = LinReg(Close, Convert.ToInt32(Filter_Period)); 78 | LinReg1.Plots[0].Brush = Brushes.SeaShell; 79 | AddChartIndicator(LinReg1); 80 | 81 | if (ADX_Filter == true) { 82 | ADX1 = ADX(ADX_Period); 83 | AddChartIndicator(ADX1); 84 | } 85 | } 86 | 87 | private bool validateFiltersShort() { 88 | bool isADXValid = true; 89 | if (ADX_Filter == true) { 90 | if (ADX1[0] >= ADX_Min) 91 | isADXValid = true; 92 | else 93 | isADXValid = false; 94 | } 95 | 96 | return isADXValid == true; 97 | } 98 | 99 | private bool validateFiltersLong() { 100 | bool isADXValid = true; 101 | if (ADX_Filter == true) { 102 | if (ADX1[0] >= ADX_Min) 103 | isADXValid = true; 104 | else 105 | isADXValid = false; 106 | } 107 | 108 | return isADXValid == true; 109 | } 110 | 111 | protected override bool validateEntryLong() { 112 | if ((Open[0] > (Close[0] + (-31 * TickSize)) ) 113 | && (Close[2] < Open[0]) 114 | && (Close[1] > Open[1]) 115 | && (Close[0] > Open[0]) 116 | // Filter 117 | && ((Use_Filter == false) 118 | || (LinReg1[0] > LinReg2[1])) 119 | && (GetCurrentBid(0) > LinReg2[0]) 120 | && validateFiltersLong() == true) { 121 | return true; 122 | } 123 | return false; 124 | } 125 | 126 | protected override bool validateEntryShort() { 127 | if ((Close[1] < (Close[0] + (31 * TickSize)) ) 128 | && (Close[2] > Open[0]) 129 | && (Close[1] < Open[1]) 130 | && (Close[0] < Open[0]) 131 | // Filter 132 | && ((Use_Filter == false) 133 | || (LinReg1[0] < LinReg2[1])) 134 | && (GetCurrentBid(0) < LinReg2[0]) 135 | && validateFiltersShort() == true) { 136 | return true; 137 | } 138 | return false; 139 | } 140 | 141 | #endregion 142 | 143 | #region Properties 144 | [NinjaScriptProperty] 145 | [Display(Name="Use_Filter", Order=3, GroupName="1.1 Strategy Params - LinReg")] 146 | public bool Use_Filter 147 | { get; set; } 148 | 149 | [NinjaScriptProperty] 150 | [Range(0, int.MaxValue)] 151 | [Display(Name="Filter_Period", Order=4, GroupName="1.1 Strategy Params - LinReg")] 152 | public int Filter_Period 153 | { get; set; } 154 | 155 | [NinjaScriptProperty] 156 | [Display(Name = "ADX_Filter", Order = 1, GroupName = "1.2 Strategy Params - ADX")] 157 | public bool ADX_Filter 158 | { 159 | get; set; 160 | } 161 | 162 | [NinjaScriptProperty] 163 | [Range(1, int.MaxValue)] 164 | [Display(Name="ADX_Period", Order=2, GroupName="1.2 Strategy Params - ADX")] 165 | public int ADX_Period 166 | { get; set; } 167 | 168 | [NinjaScriptProperty] 169 | [Range(1, int.MaxValue)] 170 | [Display(Name="ADX_Min", Order=3, GroupName="1.2 Strategy Params - ADX")] 171 | public int ADX_Min 172 | { get; set; } 173 | 174 | [NinjaScriptProperty] 175 | [Display(Name = "ADXVMA_Filter", Order = 1, GroupName = "1.3 Strategy Params - ADXVMA")] 176 | public bool ADXVMA_Filter 177 | { 178 | get; set; 179 | } 180 | 181 | [NinjaScriptProperty] 182 | [Range(1, int.MaxValue)] 183 | [Display(Name="ADXVMA_Period", Order=2, GroupName="1.3 Strategy Params - ADXVMA")] 184 | public int ADXVMA_Period 185 | { get; set; } 186 | 187 | #endregion 188 | } 189 | } 190 | -------------------------------------------------------------------------------- /Strategies/ArchReactor/AR_NadarayaWatson_RSI_Strategy.cs: -------------------------------------------------------------------------------- 1 | // @Version: 2.0 2 | // This strategy is developed in collaboration with few members from TraderRob's discord server. Please test this on SIM account before you use it live. 3 | 4 | #region Using declarations 5 | using System; 6 | using System.Collections.Generic; 7 | using System.ComponentModel; 8 | using System.ComponentModel.DataAnnotations; 9 | using System.Diagnostics; 10 | using System.Linq; 11 | using System.Text; 12 | using System.Threading.Tasks; 13 | using System.Windows; 14 | using System.Windows.Input; 15 | using System.Windows.Media; 16 | using System.Xml.Serialization; 17 | using NinjaTrader.Cbi; 18 | using NinjaTrader.Gui; 19 | using NinjaTrader.Gui.Chart; 20 | using NinjaTrader.Gui.SuperDom; 21 | using NinjaTrader.Gui.Tools; 22 | using NinjaTrader.Data; 23 | using NinjaTrader.NinjaScript; 24 | using NinjaTrader.Core.FloatingPoint; 25 | using NinjaTrader.NinjaScript.Indicators; 26 | using NinjaTrader.NinjaScript.DrawingTools; 27 | #endregion 28 | 29 | namespace NinjaTrader.NinjaScript.Strategies.ArchReactor { 30 | public class AR_NadarayaWatson_RSI_Strategy : ArchReactorAlgoBase { 31 | 32 | #region Variables 33 | #region Strategy variables 34 | private NinjaTrader.NinjaScript.Indicators.VolBuySellMomentumV4VolMA VolBuySellMomentumV4VolMA1; 35 | private NinjaTrader.NinjaScript.Indicators.NadarayaWatsonEnvelopeWithATRNonRepaint NadarayaWatsonEnvelopeWithATRNonRepaint1; 36 | private NinjaTrader.NinjaScript.Indicators.RSI RSI1; 37 | private NinjaTrader.NinjaScript.Indicators.ArchReactor.TOSignals TOSignals1; 38 | private NinjaTrader.NinjaScript.Indicators.LizardIndicators.amaCamarillaPivotsDaily amaCamarillaPivotsDaily1; 39 | #endregion 40 | #endregion 41 | 42 | #region OnStateChange 43 | protected override void OnStateChange() 44 | { 45 | base.OnStateChange(); 46 | 47 | if (State == State.SetDefaults) 48 | { 49 | Description = @"Nadaraya Watson Envelope and RSI (version 2.1)"; 50 | Name = "AR_NadarayaWatson_RSI_Strategy_v2.1"; 51 | StrategyName = "AR_NadarayaWatson_RSI version 2.1"; 52 | Calculate = Calculate.OnBarClose; 53 | 54 | #region Indicator Variable Initialization 55 | #region RSI 56 | RSI_Period = 14; 57 | RSI_Smooth = 3; 58 | RSI_High = 70; 59 | RSI_Low = 30; 60 | #endregion 61 | 62 | #region NadarayaWatson RQK 63 | NW_H = 8; 64 | NW_R = 8; 65 | NW_X0 = 25; 66 | NW_Lag = 2; 67 | NW_SmoothColors = false; 68 | NW_Lag = 2; 69 | NW_ATR_Length = 32; 70 | NW_ATR_Mult = 2.7; 71 | NW_ADX_Filter = true; // Adding RSI to filter out buy and sell signals; 72 | NW_ADX_Period = 14; 73 | NW_ADX_Min = 25; 74 | #endregion 75 | 76 | #region TO Signals 77 | TradeTrampolineSignals = false; 78 | Tramp_BollingerLowerThreshold = 0.0015; 79 | Tramp_RSILowerThreshold = 25; 80 | Tramp_RSIUpperThreshold = 72; 81 | Tramp_RSILength = 14; 82 | Tramp_BollingerBandsLength = 20; 83 | Tramp_BollingerBandMult = 2; 84 | Tramp_BollingerBandsOffset = 0; 85 | Shark_Apply25_75 = false; 86 | ConfirmWithSharkSignals = false; 87 | #endregion 88 | 89 | #region Nadaraya watson RSI 90 | TradeOnConfirmationCandle = false; 91 | TradeNadarayaWatsonRSI = true; 92 | #endregion 93 | 94 | #region Camarilla Pivots 95 | TradeR3S3Reversal = false; 96 | TradeR4S4Breakout = false; 97 | #endregion 98 | #endregion 99 | } 100 | } 101 | #endregion 102 | 103 | #region onBarUpdate 104 | protected override void OnBarUpdate() 105 | { 106 | base.OnBarUpdate(); 107 | } 108 | #endregion 109 | 110 | #region Strategy Management 111 | protected override void initializeIndicators() { 112 | NadarayaWatsonEnvelopeWithATRNonRepaint1 = NadarayaWatsonEnvelopeWithATRNonRepaint(Close, NW_H, NW_R, Convert.ToInt32(NW_X0), true, NW_SmoothColors, NW_Lag, NW_ATR_Length, NW_ATR_Mult, NW_ADX_Filter, NW_ADX_Period, NW_ADX_Min); 113 | RSI1 = RSI(RSI_Period, RSI_Smooth); 114 | 115 | AddChartIndicator(NadarayaWatsonEnvelopeWithATRNonRepaint1); 116 | AddChartIndicator(RSI1); 117 | 118 | if (TradeTrampolineSignals == true) { 119 | TOSignals1 = TOSignals(Tramp_BollingerLowerThreshold, Tramp_RSILowerThreshold, Tramp_RSIUpperThreshold, Tramp_RSILength, Tramp_BollingerBandsLength, Tramp_BollingerBandMult, Tramp_BollingerBandsOffset, Shark_Apply25_75); 120 | AddChartIndicator(TOSignals1); 121 | } 122 | 123 | if (TradeR3S3Reversal == true || TradeR4S4Breakout == true) { 124 | amaCamarillaPivotsDaily1 = amaCamarillaPivotsDaily(amaSessionTypeCamD.Daily_Bars, amaCalcModeCamD.Daily_Data); 125 | amaCamarillaPivotsDaily1.Plots[3].Brush = Brushes.Red; 126 | amaCamarillaPivotsDaily1.Plots[4].Brush = Brushes.Blue; 127 | amaCamarillaPivotsDaily1.Plots[5].Brush = Brushes.Red; 128 | amaCamarillaPivotsDaily1.Plots[6].Brush = Brushes.Blue; 129 | amaCamarillaPivotsDaily1.Plots[7].Brush = Brushes.Red; 130 | amaCamarillaPivotsDaily1.Plots[8].Brush = Brushes.Blue; 131 | amaCamarillaPivotsDaily1.Plots[11].Brush = Brushes.Red; 132 | amaCamarillaPivotsDaily1.Plots[12].Brush = Brushes.Blue; 133 | amaCamarillaPivotsDaily1.Plots[13].Brush = Brushes.Red; 134 | amaCamarillaPivotsDaily1.Plots[14].Brush = Brushes.Blue; 135 | AddChartIndicator(amaCamarillaPivotsDaily1); 136 | } 137 | 138 | } 139 | 140 | protected override bool validateEntryLong() { 141 | 142 | if (TradeR3S3Reversal == true) { 143 | if (validateCamarillaPivotsReversalLong() == true) { 144 | Print("Entering Long Camarilla Reversal"); 145 | return true; 146 | } 147 | } 148 | 149 | if (TradeR4S4Breakout == true) { 150 | if (validateCamarillaPivotsBreakoutLong() == true) { 151 | Print("Entering Long Camarilla Breakout"); 152 | return true; 153 | } 154 | } 155 | 156 | if (TradeNadarayaWatsonRSI == true) { 157 | if (TradeOnConfirmationCandle == true) { 158 | if ((NadarayaWatsonEnvelopeWithATRNonRepaint1.Signal[1] == 1 || NadarayaWatsonEnvelopeWithATRNonRepaint1.Signal[1] == -1) 159 | && (Close[0] > High[1]) 160 | && (RSI1.Default[1] <= RSI_Low) 161 | && (Open[0] < Close[0]) 162 | // && VolBuySellMomentumV4VolMA1.PNVI_PEMA_Diff_Hist[0] > 0) 163 | ) { 164 | Print("Entering Long Nadaraya Watson - RSI on Confirmation Candle"); 165 | return true; 166 | } 167 | } else { 168 | if ((NadarayaWatsonEnvelopeWithATRNonRepaint1.Signal[0] == 1 || NadarayaWatsonEnvelopeWithATRNonRepaint1.Signal[0] == -1) 169 | && (RSI1.Default[0] <= RSI_Low) 170 | && (Open[0] < Close[0])) { 171 | //&& VolBuySellMomentumV4VolMA1.PNVI_PEMA_Diff_Hist[0] > 0) { 172 | Print("Entering Long Nadaraya Watson - RSI"); 173 | return true; 174 | } 175 | } 176 | } 177 | 178 | if (TradeTrampolineSignals == true) { 179 | bool confirmSharkSignal = (ConfirmWithSharkSignals == true) ? TOSignals1.SharkOBOS[1] == -1 : true; 180 | 181 | if (TOSignals1.TrampolineBuySell[0] == 1 && confirmSharkSignal == true && Close[0] < NadarayaWatsonEnvelopeWithATRNonRepaint1.LowerBand[0] ) { 182 | Print("Entering Long Trampoline"); 183 | return true; 184 | } 185 | } 186 | 187 | return false; 188 | } 189 | 190 | protected override bool validateEntryShort() { 191 | 192 | if (TradeR3S3Reversal == true) { 193 | if (validateCamarillaPivotsReversalShort() == true) { 194 | Print("Entering Short Camarilla Reversal"); 195 | return true; 196 | } 197 | } 198 | 199 | if (TradeR4S4Breakout == true) { 200 | if (validateCamarillaPivotsBreakoutShort() == true) { 201 | Print("Entering Short Camarilla Breakout"); 202 | return true; 203 | } 204 | } 205 | 206 | if (TradeNadarayaWatsonRSI == true) { 207 | if (TradeOnConfirmationCandle == true) { 208 | 209 | if ((NadarayaWatsonEnvelopeWithATRNonRepaint1.Signal[1] == -1) 210 | && (Close[0] < Low[1]) 211 | && (RSI1.Avg[1] >= RSI_High) 212 | // && IsFalling(RSI1.Default) 213 | && Open[0] > Close[0]) { 214 | // && VolBuySellMomentumV4VolMA1.PNVI_PEMA_Diff_Hist[0] < 0) { 215 | Print("Entering Short Nadaraya Watson - RSI on Confirmation Candle"); 216 | return true; 217 | } 218 | } else { 219 | if ((NadarayaWatsonEnvelopeWithATRNonRepaint1.Signal[0] == -1) 220 | && (RSI1.Avg[0] >= RSI_High) 221 | // && (barsAgo > 1 && barsAgo < 3) 222 | //&& IsFalling(RSI1.Default) 223 | && Open[0] > Close[0]) { 224 | //&& VolBuySellMomentumV4VolMA1.PNVI_PEMA_Diff_Hist[0] < 0) { 225 | Print("Entering Short Nadaraya Watson - RSI"); 226 | return true; 227 | } 228 | } 229 | } 230 | 231 | if (TradeTrampolineSignals == true) { 232 | bool confirmSharkSignal = (ConfirmWithSharkSignals == true) ? TOSignals1.SharkOBOS[1] == 1 : true; 233 | 234 | if (TOSignals1.TrampolineBuySell[0] == -1 && confirmSharkSignal == true && Close[0] > NadarayaWatsonEnvelopeWithATRNonRepaint1.UpperBand[0]) { 235 | Print("Entering Short Trampoline"); 236 | return true; 237 | } 238 | } 239 | 240 | return false; 241 | } 242 | 243 | private bool validateCamarillaPivotsReversalShort() { 244 | if ((Open[0] > Close[0]) 245 | && (Open[0] > amaCamarillaPivotsDaily1.R3[0]) 246 | && (Close[0] < amaCamarillaPivotsDaily1.R3[0]) 247 | && (NadarayaWatsonEnvelopeWithATRNonRepaint1.Trend[0] == -1)) 248 | //&& (NadarayaWatsonEnvelopeWithATRNonRepaint1.Tren)) 249 | //&& (Open[0] > Close[0]) 250 | // && (Open[0] >= amaCamarillaPivotsDaily1.S3[0])) 251 | { 252 | return true; 253 | } 254 | return false; 255 | } 256 | 257 | private bool validateCamarillaPivotsReversalLong() { 258 | if ((Open[0] < Close[0]) 259 | && (Open[0] < amaCamarillaPivotsDaily1.S3[0]) 260 | && (Close[0] > amaCamarillaPivotsDaily1.S3[0]) 261 | && (NadarayaWatsonEnvelopeWithATRNonRepaint1.Trend[0] == 1)) 262 | //&& (Open[0] > Close[0]) 263 | // && (Open[0] >= amaCamarillaPivotsDaily1.S3[0])) 264 | { 265 | return true; 266 | } 267 | return false; 268 | } 269 | 270 | private bool validateCamarillaPivotsBreakoutLong() { 271 | if ((Open[0] < Close[0]) 272 | && (Open[0] < amaCamarillaPivotsDaily1.R4[0]) 273 | && (Close[0] > amaCamarillaPivotsDaily1.R4[0]) 274 | && (NadarayaWatsonEnvelopeWithATRNonRepaint1.Trend[0] == 1)){ 275 | return true; 276 | } 277 | return false; 278 | } 279 | 280 | private bool validateCamarillaPivotsBreakoutShort() { 281 | if ((Open[0] > Close[0]) 282 | && (Open[0] > amaCamarillaPivotsDaily1.S4[0]) 283 | && (Close[0] < amaCamarillaPivotsDaily1.S4[0]) 284 | && (NadarayaWatsonEnvelopeWithATRNonRepaint1.Trend[0] == -1)){ 285 | return true; 286 | } 287 | return false; 288 | } 289 | 290 | #endregion 291 | 292 | #region Properties 293 | 294 | [NinjaScriptProperty] 295 | [Range(1, double.MaxValue)] 296 | [Display(Name="NW_H", Order=1, GroupName="1.1 Strategy Params - Nadaraya Watson RQK")] 297 | public double NW_H 298 | { get; set; } 299 | 300 | [NinjaScriptProperty] 301 | [Range(1, double.MaxValue)] 302 | [Display(Name="NW_R", Order=2, GroupName="1.1 Strategy Params - Nadaraya Watson RQK")] 303 | public double NW_R 304 | { get; set; } 305 | 306 | [NinjaScriptProperty] 307 | [Range(1, int.MaxValue)] 308 | [Display(Name="NW_X_0", Order=3, GroupName="1.1 Strategy Params - Nadaraya Watson RQK")] 309 | public int NW_X0 310 | { get; set; } 311 | 312 | [NinjaScriptProperty] 313 | [Range(1, int.MaxValue)] 314 | [Display(Name="NW_Lag", Order=4, GroupName="1.1 Strategy Params - Nadaraya Watson RQK")] 315 | public int NW_Lag 316 | { get; set; } 317 | 318 | [NinjaScriptProperty] 319 | [Display(Name = "NW_SmoothColors", Order = 5, GroupName = "1.1 Strategy Params - Nadaraya Watson RQK")] 320 | public bool NW_SmoothColors 321 | { get; set; } 322 | 323 | [NinjaScriptProperty] 324 | [Range(1, int.MaxValue)] 325 | [Display(Name="NW_ATR_Length", Description="ATR Length", Order=6, GroupName="1.1 Strategy Params - Nadaraya Watson RQK")] 326 | public int NW_ATR_Length 327 | { get; set; } 328 | 329 | [NinjaScriptProperty] 330 | [Range(1, double.MaxValue)] 331 | [Display(Name="NW_ATR_Mult", Description="Multiplier", Order=7, GroupName="1.1 Strategy Params - Nadaraya Watson RQK")] 332 | public double NW_ATR_Mult 333 | { get; set; } 334 | 335 | [NinjaScriptProperty] 336 | [Display(Name="NW_ADX_Filter", Description="Enable/Disable Buy Sell Signal Filtering with ADX", Order=8, GroupName="1.1 Strategy Params - Nadaraya Watson RQK")] 337 | public bool NW_ADX_Filter 338 | { get; set; } 339 | 340 | [NinjaScriptProperty] 341 | [Range(1, int.MaxValue)] 342 | [Display(Name="NW_ADX_Period", Description="ADX Period", Order=9, GroupName="1.1 Strategy Params - Nadaraya Watson RQK")] 343 | public int NW_ADX_Period 344 | { get; set; } 345 | 346 | [NinjaScriptProperty] 347 | [Range(1, int.MaxValue)] 348 | [Display(Name="NW_ADX_Min", Description="ADX Minimum value to filter", Order=10, GroupName="1.1 Strategy Params - Nadaraya Watson RQK")] 349 | public int NW_ADX_Min 350 | { get; set; } 351 | 352 | [NinjaScriptProperty] 353 | [Range(1, int.MaxValue)] 354 | [Display(Name="RSI_Period", Order=1, GroupName="1.2 Strategy Params - RSI")] 355 | public int RSI_Period 356 | { get; set; } 357 | 358 | [NinjaScriptProperty] 359 | [Range(1, int.MaxValue)] 360 | [Display(Name="RSI_Smooth", Order=2, GroupName="1.2 Strategy Params - RSI")] 361 | public int RSI_Smooth 362 | { get; set; } 363 | 364 | [NinjaScriptProperty] 365 | [Range(1, int.MaxValue)] 366 | [Display(Name="RSI_High", Order=3, GroupName="1.2 Strategy Params - RSI")] 367 | public int RSI_High 368 | { get; set; } 369 | 370 | [NinjaScriptProperty] 371 | [Range(1, int.MaxValue)] 372 | [Display(Name="RSI_Low", Order=4, GroupName="1.2 Strategy Params - RSI")] 373 | public int RSI_Low 374 | { get; set; } 375 | 376 | [NinjaScriptProperty] 377 | [Display(Name="TradeNadarayaWatsonRSI", Description="Trade NadarayaWatson RSI", Order=1, GroupName="1.3 Strategy Params - Nadaraya Watson RSI")] 378 | public bool TradeNadarayaWatsonRSI 379 | { get; set; } 380 | 381 | [NinjaScriptProperty] 382 | [Display(Name="TradeOnConfirmationCandle", Description="Waits for a confirmation candle to Close to take the trade else takes the trade on Signal Candle Close", Order=2, GroupName="1.3 Strategy Params - Nadaraya Watson RSI")] 383 | public bool TradeOnConfirmationCandle 384 | { get; set; } 385 | 386 | 387 | [NinjaScriptProperty] 388 | [Display(Name="TradeR3S3Reversal", Description="Trade R3 and S3 Reversal", Order=1, GroupName="1.4 Strategy Params - Camarilla Pivots")] 389 | public bool TradeR3S3Reversal 390 | { get; set; } 391 | 392 | [NinjaScriptProperty] 393 | [Display(Name="TradeR4S4Breakout", Description="Trade R3 and S3 Breakout", Order=2, GroupName="1.4 Strategy Params - Camarilla Pivots")] 394 | public bool TradeR4S4Breakout 395 | { get; set; } 396 | 397 | [NinjaScriptProperty] 398 | [Display(Name="TradeTrampolineSignals", Description="Trade on TrampolineSignals", Order=1, GroupName="1.5 Strategy Params - TO Signals")] 399 | public bool TradeTrampolineSignals 400 | { get; set; } 401 | 402 | 403 | [NinjaScriptProperty] 404 | [Display(Name="ConfirmWithSharkSignals", Description="Confirm with shark signals of OB/OS", Order=2, GroupName="1.5 Strategy Params - TO Signals")] 405 | public bool ConfirmWithSharkSignals 406 | { get; set; } 407 | 408 | [NinjaScriptProperty] 409 | [Range(0, double.MaxValue)] 410 | [Display(Name="Tramp_BollingerLowerThreshold", Description="0.003 for daily, 0.0015 for 30 min candles", Order=3, GroupName="1.5 Strategy Params - TO Signals")] 411 | public double Tramp_BollingerLowerThreshold 412 | { get; set; } 413 | 414 | [NinjaScriptProperty] 415 | [Range(1, int.MaxValue)] 416 | [Display(Name="Tramp_RSILowerThreshold", Description="Normally 25", Order=4, GroupName="1.5 Strategy Params - TO Signals")] 417 | public int Tramp_RSILowerThreshold 418 | { get; set; } 419 | 420 | [NinjaScriptProperty] 421 | [Range(1, int.MaxValue)] 422 | [Display(Name="Tramp_RSIUpperThreshold", Description="Normally 75", Order=5, GroupName="1.5 Strategy Params - TO Signals")] 423 | public int Tramp_RSIUpperThreshold 424 | { get; set; } 425 | 426 | [NinjaScriptProperty] 427 | [Range(1, int.MaxValue)] 428 | [Display(Name="Tramp_RSILength", Description="RSI Length", Order=6, GroupName="1.5 Strategy Params - TO Signals")] 429 | public int Tramp_RSILength 430 | { get; set; } 431 | 432 | [NinjaScriptProperty] 433 | [Range(1, int.MaxValue)] 434 | [Display(Name="Tramp_BollingerBandsLength", Order=7, GroupName="1.5 Strategy Params - TO Signals")] 435 | public int Tramp_BollingerBandsLength 436 | { get; set; } 437 | 438 | [NinjaScriptProperty] 439 | [Range(0.001, double.MaxValue)] 440 | [Display(Name="Tramp_BollingerBandMult", Order=8, GroupName="1.5 Strategy Params - TO Signals")] 441 | public double Tramp_BollingerBandMult 442 | { get; set; } 443 | 444 | [NinjaScriptProperty] 445 | [Range(-500, int.MaxValue)] 446 | [Display(Name="Tramp_BollingerBandsOffset", Order=9, GroupName="1.5 Strategy Params - TO Signals")] 447 | public int Tramp_BollingerBandsOffset 448 | { get; set; } 449 | 450 | [NinjaScriptProperty] 451 | [Display(Name="Shark_Apply25_75", Description="Apply the 25/75 Rule - For Shark Signals", Order=10, GroupName="1.5 Strategy Params - TO Signals")] 452 | public bool Shark_Apply25_75 453 | { get; set; } 454 | 455 | #endregion 456 | 457 | 458 | } 459 | } -------------------------------------------------------------------------------- /Strategies/ArchReactor/AR_Swing_Breakout.cs: -------------------------------------------------------------------------------- 1 | #region Using declarations 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.ComponentModel.DataAnnotations; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Xml.Serialization; 13 | using NinjaTrader.Cbi; 14 | using NinjaTrader.Gui; 15 | using NinjaTrader.Gui.Chart; 16 | using NinjaTrader.Gui.SuperDom; 17 | using NinjaTrader.Gui.Tools; 18 | using NinjaTrader.Data; 19 | using NinjaTrader.NinjaScript; 20 | using NinjaTrader.Core.FloatingPoint; 21 | using NinjaTrader.NinjaScript.Indicators; 22 | using NinjaTrader.NinjaScript.DrawingTools; 23 | #endregion 24 | 25 | //This namespace holds Strategies in this folder and is required. Do not change it. 26 | namespace NinjaTrader.NinjaScript.Strategies.ArchReactor 27 | { 28 | public class AR_Swing_Breakout : ArchReactorAlgoBase 29 | { 30 | private Swing Swing1; 31 | private SMA SMA1; 32 | private SMA SMA2; 33 | private NinjaTrader.NinjaScript.Indicators.LizardIndicators.amaADXVMA amaADXVMA1; 34 | private NinjaTrader.NinjaScript.Indicators.LizardIndicators.amaADXVMAPlus amaADXVMAPlus1; 35 | private NinjaTrader.NinjaScript.Indicators.TradeSaber.ReversalTS ReversalTS1; 36 | private bool tradeDone = false; 37 | private double previousSwingHigh; 38 | private double previousSwingLow; 39 | private CommonEnums.OrderState previousOrder = CommonEnums.OrderState.BOTH; 40 | protected override void OnStateChange() 41 | { 42 | base.OnStateChange(); 43 | 44 | if (State == State.SetDefaults) 45 | { 46 | Description = @"Swing Breakout with ADXVMA filter, from Arch Reactor Algo"; 47 | Name = "AR_Swing_Breakout_ADXVMA"; 48 | StrategyName = "AR_Swing_Breakout_ADXVMA"; 49 | StrategyVersion = "2.0"; 50 | Strength = 5; 51 | Period = 8; 52 | ADX_Period = 8; 53 | VMA_Period = 8; 54 | Use_ADXVMAPlus = true; 55 | previousSwingLow = 0; 56 | previousSwingHigh = 0; 57 | EnableDistanceFromADXLine = false; 58 | DistanceFromADXLineInPoints = 50; 59 | } 60 | } 61 | 62 | protected override void OnBarUpdate() 63 | { 64 | base.OnBarUpdate(); 65 | 66 | if (ReversalTS1.CurrentReversalBar[0] == 1 || ReversalTS1.CurrentReversalBar[0] == -1 || IsStratEnabled == false) { 67 | tradeDone = false; 68 | } 69 | 70 | if (Position.MarketPosition == MarketPosition.Long) { 71 | previousSwingHigh = Swing1.SwingHigh[0]; 72 | } 73 | 74 | if (Position.MarketPosition == MarketPosition.Short) { 75 | previousSwingLow = Swing1.SwingLow[0]; 76 | } 77 | 78 | } 79 | 80 | #region Strategy Management 81 | protected override void initializeIndicators() { 82 | Swing1 = Swing(Strength); 83 | amaADXVMA1 = amaADXVMA(Period); 84 | amaADXVMAPlus1 = amaADXVMAPlus(false, Period, ADX_Period, VMA_Period); 85 | ReversalTS1= ReversalTS(0, 0, 0, false, null, null, false, null, false); 86 | AddChartIndicator(Swing1); 87 | if (Use_ADXVMAPlus == true) { 88 | AddChartIndicator(amaADXVMAPlus1); 89 | } else { 90 | AddChartIndicator(amaADXVMA1); 91 | } 92 | } 93 | 94 | protected override bool validateEntryLong() { 95 | if (Use_ADXVMAPlus == true) { 96 | if (tradeDone == false 97 | && Swing1.SwingHigh[0] < Close[1] 98 | && amaADXVMAPlus1.Trend[0] == 1 99 | && previousSwingHigh != Swing1.SwingHigh[0] 100 | && distanceFromADXLineFilter(amaADXVMAPlus1.ADXVMA[0], false)){ 101 | tradeDone = true; 102 | previousSwingHigh = Swing1.SwingHigh[0]; 103 | previousOrder = CommonEnums.OrderState.LONGS; 104 | return true; 105 | } 106 | } else { 107 | if (tradeDone == false 108 | && Swing1.SwingHigh[0] < Close[1] 109 | && amaADXVMA1.Trend[0] == 1 110 | && previousSwingHigh != Swing1.SwingHigh[0] 111 | && distanceFromADXLineFilter(amaADXVMA1.ADXVMA[0], false)){ 112 | tradeDone = true; 113 | previousSwingHigh = Swing1.SwingHigh[0]; 114 | previousOrder = CommonEnums.OrderState.LONGS; 115 | return true; 116 | } 117 | } 118 | return false; 119 | } 120 | 121 | protected override bool validateEntryShort() { 122 | if (Use_ADXVMAPlus == true) { 123 | if (tradeDone == false 124 | && Swing1.SwingLow[0] > Close[1] 125 | && amaADXVMAPlus1.Trend[0] == -1 126 | && previousSwingLow != Swing1.SwingLow[0] 127 | && distanceFromADXLineFilter(amaADXVMAPlus1.ADXVMA[0], true)){ 128 | tradeDone = true; 129 | previousSwingLow = Swing1.SwingLow[0]; 130 | previousOrder = CommonEnums.OrderState.SHORTS; 131 | return true; 132 | } 133 | } else { 134 | if (tradeDone == false 135 | && Swing1.SwingLow[0] > Close[1] 136 | && amaADXVMA1.Trend[0] == -1 137 | && previousSwingLow != Swing1.SwingLow[0] 138 | && distanceFromADXLineFilter(amaADXVMA1.ADXVMA[0], true)){ 139 | tradeDone = true; 140 | previousSwingLow = Swing1.SwingLow[0]; 141 | previousOrder = CommonEnums.OrderState.SHORTS; 142 | return true; 143 | } 144 | } 145 | return false; 146 | } 147 | 148 | private bool distanceFromADXLineFilter(double adxValue, bool isShort) { 149 | double distance = 0; 150 | if (isShort == true) { 151 | distance = adxValue - Close[0]; 152 | } else { 153 | distance = Close[0] - adxValue; 154 | } 155 | if (EnableDistanceFromADXLine == true) { 156 | if (DistanceFromADXLineInPoints <= distance) { 157 | return true; 158 | } else { 159 | return false; 160 | } 161 | } 162 | return true; 163 | } 164 | 165 | 166 | #endregion 167 | 168 | #region Properties 169 | 170 | [NinjaScriptProperty] 171 | [Range(1, int.MaxValue)] 172 | [Display(Name="Strength", Order=1, GroupName="1.1 Strategy Params - Swing")] 173 | public int Strength 174 | { get; set; } 175 | 176 | [NinjaScriptProperty] 177 | [Range(1, int.MaxValue)] 178 | [Display(Name="Period", Order=1, GroupName="1.1 Strategy Params - ADXVMA")] 179 | public int Period 180 | { get; set; } 181 | 182 | [NinjaScriptProperty] 183 | [Display(Name="Use_ADXVMAPlus", Order=2, GroupName="1.1 Strategy Params - ADXVMA")] 184 | public bool Use_ADXVMAPlus 185 | { get; set; } 186 | 187 | [NinjaScriptProperty] 188 | [Range(1, int.MaxValue)] 189 | [Display(Name="ADX_Period", Order=3, GroupName="1.1 Strategy Params - ADXVMA")] 190 | public int ADX_Period 191 | { get; set; } 192 | 193 | [NinjaScriptProperty] 194 | [Range(1, int.MaxValue)] 195 | [Display(Name="VMA_Period", Order=4, GroupName="1.1 Strategy Params - ADXVMA")] 196 | public int VMA_Period 197 | { get; set; } 198 | 199 | [NinjaScriptProperty] 200 | [Display(Name="EnableDistanceFromADXLine", Order=5, GroupName="1.1 Strategy Params - ADXVMA")] 201 | public bool EnableDistanceFromADXLine 202 | { get; set; } 203 | 204 | [NinjaScriptProperty] 205 | [Range(1, int.MaxValue)] 206 | [Display(Name="DistanceFromADXLineInPoints", Order=6, GroupName="1.1 Strategy Params - ADXVMA")] 207 | public int DistanceFromADXLineInPoints 208 | { get; set; } 209 | 210 | #endregion 211 | 212 | } 213 | } -------------------------------------------------------------------------------- /Strategies/ArchReactor/AR_Swing_Breakout_With_RipsterEMA_Filter.cs: -------------------------------------------------------------------------------- 1 | #region Using declarations 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.ComponentModel.DataAnnotations; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Xml.Serialization; 13 | using NinjaTrader.Cbi; 14 | using NinjaTrader.Gui; 15 | using NinjaTrader.Gui.Chart; 16 | using NinjaTrader.Gui.SuperDom; 17 | using NinjaTrader.Gui.Tools; 18 | using NinjaTrader.Data; 19 | using NinjaTrader.NinjaScript; 20 | using NinjaTrader.Core.FloatingPoint; 21 | using NinjaTrader.NinjaScript.Indicators; 22 | using NinjaTrader.NinjaScript.DrawingTools; 23 | #endregion 24 | 25 | //This namespace holds Strategies in this folder and is required. Do not change it. 26 | namespace NinjaTrader.NinjaScript.Strategies.ArchReactor 27 | { 28 | public class AR_Swing_Breakout_With_RipsterEMA_Filter : ArchReactorAlgoBase 29 | { 30 | private Swing Swing1; 31 | private SMA SMA1; 32 | private SMA SMA2; 33 | private NinjaTrader.NinjaScript.Indicators.TradeSaber.ReversalTS ReversalTS1; 34 | private NinjaTrader.NinjaScript.Indicators.RipsterEMAClouds RipsterEMAClouds1; 35 | private bool tradeDone = false; 36 | private double previousSwingHigh; 37 | private double previousSwingLow; 38 | protected override void OnStateChange() 39 | { 40 | base.OnStateChange(); 41 | 42 | if (State == State.SetDefaults) 43 | { 44 | Description = @"Swing Breakout, from Arch Reactor Algo"; 45 | Name = "AR_Swing_Breakout_With_RipsterEMA_Filter"; 46 | StrategyName = "AR_Swing_Breakout_With_RipsterEMA_Filter"; 47 | Strength = 5; 48 | previousSwingLow = 0; 49 | previousSwingHigh = 0; 50 | } 51 | } 52 | 53 | protected override void OnBarUpdate() 54 | { 55 | base.OnBarUpdate(); 56 | 57 | if (ReversalTS1.CurrentReversalBar[0] == 1 || ReversalTS1.CurrentReversalBar[0] == -1 || IsStratEnabled == false) { 58 | tradeDone = false; 59 | } 60 | 61 | } 62 | 63 | #region Strategy Management 64 | protected override void initializeIndicators() { 65 | Swing1 = Swing(Strength); 66 | ReversalTS1= ReversalTS(0, 0, 0, false, null, null, false, null, false); 67 | AddChartIndicator(Swing1); 68 | 69 | RipsterEMAClouds1 = RipsterEMAClouds(8, 9, 5, 12, 34, 50, 72, 89, 180, 200, 0, 3); 70 | AddChartIndicator(RipsterEMAClouds1); 71 | } 72 | 73 | protected override bool validateEntryLong() { 74 | if (tradeDone == false 75 | && Swing1.SwingHigh[0] < Close[0] 76 | && validateRipsterCloud(false) == true 77 | && previousSwingHigh != Swing1.SwingHigh[0]) { 78 | tradeDone = true; 79 | previousSwingHigh = Swing1.SwingHigh[0]; 80 | return true; 81 | } 82 | return false; 83 | } 84 | 85 | protected override bool validateEntryShort() { 86 | if (tradeDone == false 87 | && Swing1.SwingLow[0] > Close[0] 88 | && validateRipsterCloud(true) == true 89 | && previousSwingLow != Swing1.SwingLow[0]) { 90 | tradeDone = true; 91 | previousSwingLow = Swing1.SwingLow[0]; 92 | return true; 93 | } 94 | return false; 95 | } 96 | 97 | private bool validateRipsterCloud(bool isShort) { 98 | /*if (Enable_EMA_Trend_Filter == false) { 99 | return true; 100 | }*/ 101 | 102 | if (isShort == false) { 103 | if (RipsterEMAClouds1.EMA1Trend[0] == 1 && RipsterEMAClouds1.EMA2Trend[0] == 1 && RipsterEMAClouds1.EMA3Trend[0] == 1) { 104 | return true; 105 | } 106 | } else { 107 | if (RipsterEMAClouds1.EMA1Trend[0] == -1 && RipsterEMAClouds1.EMA2Trend[0] == -1 && RipsterEMAClouds1.EMA3Trend[0] == -1) { 108 | return true; 109 | } 110 | } 111 | return false; 112 | } 113 | #endregion 114 | 115 | #region Properties 116 | 117 | [NinjaScriptProperty] 118 | [Range(1, int.MaxValue)] 119 | [Display(Name="Strength", Order=1, GroupName="1.1 Strategy Params - Swing")] 120 | public int Strength 121 | { get; set; } 122 | 123 | #endregion 124 | 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /Strategies/ArchReactor/AR_gbrm_CL_BB_MACD.cs: -------------------------------------------------------------------------------- 1 | #region Using declarations 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.ComponentModel.DataAnnotations; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Xml.Serialization; 13 | using NinjaTrader.Cbi; 14 | using NinjaTrader.Gui; 15 | using NinjaTrader.Gui.Chart; 16 | using NinjaTrader.Gui.SuperDom; 17 | using NinjaTrader.Gui.Tools; 18 | using NinjaTrader.Data; 19 | using NinjaTrader.NinjaScript; 20 | using NinjaTrader.Core.FloatingPoint; 21 | using NinjaTrader.NinjaScript.Indicators; 22 | using NinjaTrader.NinjaScript.DrawingTools; 23 | #endregion 24 | 25 | //This namespace holds Strategies in this folder and is required. Do not change it. 26 | namespace NinjaTrader.NinjaScript.Strategies.ArchReactor 27 | { 28 | public class AR_gbrm_CL_BB_MACD : ArchReactorAlgoBase 29 | { 30 | private Bollinger Bollinger1; 31 | private MACD MACD1; 32 | protected override void OnStateChange() 33 | { 34 | base.OnStateChange(); 35 | 36 | if (State == State.SetDefaults) 37 | { 38 | Description = @"This is a strategy by user gbrm to be used in 5 min CL."; 39 | Name = "AR_gbrm_CL_BB_MACD"; 40 | StrategyName = "AR_gbrm_CL_BB_MACD"; 41 | Credits = "Strategy provided by discord user gbrm"; 42 | } 43 | } 44 | 45 | protected override void OnBarUpdate() 46 | { 47 | base.OnBarUpdate(); 48 | } 49 | 50 | #region Strategy Management 51 | protected override void initializeIndicators() { 52 | Bollinger1 = Bollinger(2, 20); 53 | AddChartIndicator(Bollinger1); 54 | 55 | MACD1 = MACD(12, 26, 9); 56 | AddChartIndicator(MACD1); 57 | 58 | } 59 | 60 | protected override bool validateEntryLong() { 61 | if (Open[0] < Bollinger1.Middle[0] 62 | && Close[0] > Bollinger1.Middle[0] 63 | && MACD1.Diff[0] > 0){ 64 | return true; 65 | } 66 | return false; 67 | } 68 | 69 | protected override bool validateEntryShort() { 70 | if (Open[0] > Bollinger1.Middle[0] 71 | && Close[0] < Bollinger1.Middle[0] 72 | && MACD1.Diff[0] < 0){ 73 | return true; 74 | } 75 | return false; 76 | } 77 | 78 | #endregion 79 | } 80 | } 81 | 82 | -------------------------------------------------------------------------------- /Templates/Strategy/ArchReactor.AR_HMA_B4_Strategy/AR_HMA_B4_Strategy_ES_NinzaRenko_10-2_HMA16_12-15-23_smaller_target.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | NinjaTrader.NinjaScript.Strategies.ArchReactor.AR_HMA_B4_Strategy 4 | NinjaTrader.NinjaScript.Optimizers.DefaultOptimizer 5 | 6 | 7 | 8 | IsStrategyGenerator 9 | IsStrategyGenerator 10 | false 11 | 12 | 13 | Keep best # results 14 | KeepBestResults 15 | 10 16 | 17 | 18 | LogTypeName 19 | LogTypeName 20 | Optimizer 21 | 22 | 23 | Visible 24 | IsVisible 25 | true 26 | 27 | 28 | Name 29 | Name 30 | Default 31 | 32 | 33 | 34 | NinjaTrader.NinjaScript.OptimizationFitnesses.MaxProfitFactor 35 | 36 | 37 | 38 | 39 | 1 40 | 16 41 | 16 42 | HMAWave_Period 43 | System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 44 | 16 45 | 46 | 47 | 48 | 1 49 | 1 50 | 1 51 | HMAWave_HMABack 52 | System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 53 | 1 54 | 55 | 56 | 57 | 1 58 | 1 59 | 1 60 | HMAWave_Smooth 61 | System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 62 | 1 63 | 64 | 65 | 66 | 1 67 | 2 68 | 2 69 | PositionSize 70 | System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 71 | 2 72 | 73 | 74 | 75 | MARKET 76 | 77 | 1 78 | 0 79 | 0 80 | OrderType 81 | CommonEnums.OrderType, 11256276acf64604b05b4e9b130023ed, Version=8.1.3.0, Culture=neutral, PublicKeyToken=null 82 | MARKET 83 | 84 | 85 | 86 | CLOSE 87 | 88 | 1 89 | 0 90 | 0 91 | LimitType 92 | CommonEnums.LimitType, 11256276acf64604b05b4e9b130023ed, Version=8.1.3.0, Culture=neutral, PublicKeyToken=null 93 | CLOSE 94 | 95 | 96 | 97 | 1 98 | 0 99 | 0 100 | LimitOffset 101 | System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 102 | 0 103 | 104 | 105 | 106 | 1 107 | 15 108 | 15 109 | InitialStopLong 110 | System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 111 | 15 112 | 113 | 114 | 115 | 1 116 | 15 117 | 15 118 | InitialStopShort 119 | System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 120 | 15 121 | 122 | 123 | 124 | 1 125 | 40 126 | 40 127 | ProfitTargetLong 128 | System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 129 | 40 130 | 131 | 132 | 133 | 1 134 | 40 135 | 40 136 | ProfitTargetShort 137 | System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 138 | 40 139 | 140 | 141 | 142 | 1 143 | true 144 | true 145 | EnableTrail 146 | System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 147 | True 148 | 149 | 150 | 151 | 1 152 | 20 153 | 20 154 | TrailProfitTrigger 155 | System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 156 | 20 157 | 158 | 159 | 160 | 1 161 | 2 162 | 2 163 | TrailStepTicks 164 | System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 165 | 2 166 | 167 | 168 | 169 | 1 170 | true 171 | true 172 | EnableBreakeven 173 | System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 174 | True 175 | 176 | 177 | 178 | 1 179 | 17 180 | 17 181 | BreakevenTicks 182 | System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 183 | 17 184 | 185 | 186 | 187 | 1 188 | 4 189 | 4 190 | PlusBreakeven 191 | System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 192 | 4 193 | 194 | 195 | 196 | 1 197 | true 198 | true 199 | Time_1 200 | System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 201 | True 202 | 203 | 204 | 205 | 1 206 | false 207 | false 208 | Time_2 209 | System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 210 | False 211 | 212 | 213 | 214 | 1 215 | false 216 | false 217 | Time_3 218 | System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 219 | False 220 | 221 | 222 | 223 | 1 224 | false 225 | false 226 | Time_4 227 | System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 228 | False 229 | 230 | 231 | 232 | 1 233 | 500 234 | 500 235 | MaxTarget 236 | System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 237 | 500 238 | 239 | 240 | 241 | 1 242 | -200 243 | -200 244 | MaxLoss 245 | System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 246 | -200 247 | 248 | 249 | 250 | 1 251 | true 252 | true 253 | ExitOnStrategyPnLReached 254 | System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 255 | True 256 | 257 | 258 | 259 | 1 260 | false 261 | false 262 | DisplayStrategyPnL 263 | System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 264 | False 265 | 266 | 267 | 268 | 1 269 | false 270 | false 271 | DisplayHistoricalTradePerformance 272 | System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 273 | False 274 | 275 | 276 | 277 | 278 | 279 | true 280 | true 281 | true 282 | 283 | 12345 284 | Minute 285 | 1 286 | BidAsk 287 | Last 288 | Close 289 | Tick 290 | 10 291 | 2 292 | 293 | 0 294 | true 295 | 2023-12-10T00:00:00 296 | -1 297 | Right 298 | false 299 | 2023-12-15T00:00:00 300 | OnBarClose 301 | 0 302 | true 303 | true 304 | true 305 | 306 | TwoHundredFiftySix 307 | AR_HMA_B4_Strategy 308 | 309 | 0 310 | 311 | 1 312 | 0 313 | 0 314 | 315 | System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 316 | 0 317 | 318 | 20 319 | NinjaScript 320 | Recalculate 321 | 5 322 | 1 323 | 10 324 | 2 325 | AllEntries 326 | 30 327 | false 328 | 329 | false 330 | true 331 | false 332 | false 333 | true 334 | false 335 | true 336 | false 337 | 4 338 | 10 339 | Standard 340 | Tick 341 | 1 342 | 5 343 | Strategy 344 | 0 345 | WaitUntilFlat 346 | PerEntryExecution 347 | true 348 | 28 349 | 350 | 1800-01-01T00:00:00 351 |