├── Conversions
├── Indicators
│ ├── AdvancedRiskReward
│ │ ├── Indicators
│ │ │ └── AdvancedRiskReward.cs
│ │ └── Info.xml
│ ├── BollingerPair_NT8
│ │ ├── Indicators
│ │ │ ├── @CMO.cs
│ │ │ ├── @DEMA.cs
│ │ │ ├── @EMA.cs
│ │ │ ├── @HMA.cs
│ │ │ ├── @SMA.cs
│ │ │ ├── @SUM.cs
│ │ │ ├── @StdDev.cs
│ │ │ ├── @TMA.cs
│ │ │ ├── @VMA.cs
│ │ │ ├── @WMA.cs
│ │ │ ├── @ZLEMA.cs
│ │ │ ├── BollingerBandsPerCent.cs
│ │ │ └── BollingerModified.cs
│ │ └── Info.xml
│ ├── CCIForecasterV7DE_NT8
│ │ ├── Indicators
│ │ │ ├── @EMA.cs
│ │ │ ├── @LinReg.cs
│ │ │ ├── @MAX.cs
│ │ │ ├── @MIN.cs
│ │ │ ├── @SUM.cs
│ │ │ ├── @ZigZag.cs
│ │ │ ├── CCIForecasterV7DE.cs
│ │ │ └── LinRegPredictor.cs
│ │ └── Info.xml
│ ├── CalculateValueArea_NT7
│ │ ├── Indicator
│ │ │ └── CalculateValueArea.cs
│ │ └── Info.xml
│ ├── CalculateValueArea_NT8
│ │ ├── Indicators
│ │ │ └── CalculateValueArea.cs
│ │ └── Info.xml
│ ├── ColorZone3_NT8
│ │ ├── Indicators
│ │ │ └── ColorZone3.cs
│ │ └── Info.xml
│ ├── CurrentPriceMarker
│ │ ├── Indicators
│ │ │ └── CurrentPriceMarker.cs
│ │ └── Info.xml
│ ├── EdsLevel2
│ │ ├── Indicators
│ │ │ └── EdsLevel2.cs
│ │ └── Info.xml
│ ├── FixedPercentTrailingStop
│ │ ├── Indicators
│ │ │ └── FixedPercentTrailingStop.cs
│ │ └── Info.xml
│ ├── HeikenAshiSmoothed
│ │ ├── Indicators
│ │ │ ├── @HMA.cs
│ │ │ ├── @WMA.cs
│ │ │ └── HeikenAshiSmoothed.cs
│ │ └── Info.xml
│ ├── IGTDSequential2
│ │ ├── Indicators
│ │ │ ├── @MAX.cs
│ │ │ ├── @MIN.cs
│ │ │ ├── @Range.cs
│ │ │ ├── @SMA.cs
│ │ │ └── IGTDSequential2.cs
│ │ └── Info.xml
│ ├── IchimokouCloud
│ │ ├── Indicators
│ │ │ ├── @MAX.cs
│ │ │ ├── @MIN.cs
│ │ │ └── IchimokuCloud.cs
│ │ └── Info.xml
│ ├── MACDZeroLagColors
│ │ ├── Indicators
│ │ │ ├── @EMA.cs
│ │ │ ├── ADXVMA.cs
│ │ │ ├── MACDZeroLagColors.cs
│ │ │ └── ZeroLagEMA.cs
│ │ └── Info.xml
│ ├── SRM
│ │ ├── Indicators
│ │ │ └── SRM.cs
│ │ └── Info.xml
│ ├── SwamiStochastics
│ │ ├── Indicators
│ │ │ ├── @MAX.cs
│ │ │ ├── @MIN.cs
│ │ │ ├── @SMA.cs
│ │ │ ├── @Stochastics.cs
│ │ │ └── SwamiStochastics.cs
│ │ └── Info.xml
│ ├── SwamiWave
│ │ ├── Indicators
│ │ │ ├── @MAX.cs
│ │ │ ├── @MIN.cs
│ │ │ ├── @SMA.cs
│ │ │ ├── BPF.cs
│ │ │ ├── MarketMode.cs
│ │ │ └── SwamiWave.cs
│ │ └── Info.xml
│ ├── VWEMACDHistogram_NT8
│ │ ├── Indicators
│ │ │ ├── @EMA.cs
│ │ │ └── VWEMACDHistogram.cs
│ │ └── Info.xml
│ ├── VolumePriceConfirmationVPCI_NT8
│ │ ├── Indicators
│ │ │ ├── @SMA.cs
│ │ │ ├── @VWMA.cs
│ │ │ └── VolumePriceConfirmation.cs
│ │ └── Info.xml
│ ├── a1ChartNotes_NT8
│ │ ├── Indicators
│ │ │ └── a1ChartNotes.cs
│ │ └── Info.xml
│ ├── dDrawABC_NT8
│ │ ├── Indicators
│ │ │ └── dDrawABC.cs
│ │ └── Info.xml
│ └── jtRangeMarker7_NT8
│ │ ├── Indicators
│ │ └── jtRangeMarker7.cs
│ │ └── Info.xml
└── Strategies
│ ├── SveStochATS_NT8
│ ├── Indicators
│ │ ├── @MAX.cs
│ │ ├── @MIN.cs
│ │ ├── @SMA.cs
│ │ ├── @Stochastics.cs
│ │ ├── @WMA.cs
│ │ └── SveStochIFT.cs
│ ├── Info.xml
│ └── Strategies
│ │ └── SveStochATS.cs
│ ├── TradingTheLoonie
│ ├── Indicators
│ │ ├── @EMA.cs
│ │ ├── @MACD.cs
│ │ ├── @MAX.cs
│ │ ├── @MIN.cs
│ │ ├── @ROC.cs
│ │ ├── @SMA.cs
│ │ ├── @StdDev.cs
│ │ ├── @Stochastics.cs
│ │ ├── BollingerBandDivergence.cs
│ │ └── Correlation.cs
│ ├── Info.xml
│ └── Strategies
│ │ └── TradingtheLoonie.cs
│ └── WoodiesCCIAutoTrader_NT8
│ ├── Indicators
│ ├── @CCI.cs
│ ├── @EMA.cs
│ ├── @LinReg.cs
│ ├── @MAX.cs
│ ├── @MIN.cs
│ ├── @SMA.cs
│ ├── @SUM.cs
│ ├── @ZigZag.cs
│ ├── CCIForecasterV7DE.cs
│ └── LinRegPredictor.cs
│ ├── Info.xml
│ └── Strategies
│ └── WCCI_AT.cs
├── Examples
├── AddOns
│ └── CustomFilerPicker
│ │ ├── AddOns
│ │ └── CustomFilePicker.cs
│ │ ├── AdditionalReferences.txt
│ │ └── Info.xml
├── ChartStyles
│ └── ChartStyleCustomBrushes
│ │ ├── ChartStyles
│ │ └── ChartStyleCustomBrushes.cs
│ │ └── Info.xml
├── Indicators
│ ├── ATMStrategyMonitor
│ │ ├── Indicators
│ │ │ └── ATMStrategyMonitor.cs
│ │ └── Info.xml
│ ├── AccountItemUpdateExample
│ │ ├── Indicators
│ │ │ └── AccountItemUpdateExample.cs
│ │ └── Info.xml
│ ├── AccountOrderExamples
│ │ └── GetAtmStrategyOwnerFromEntryExample.cs
│ ├── AddCustomBarsTypeUniRenko
│ │ ├── BarsTypes
│ │ │ └── UniRenkoBarsType.cs
│ │ ├── Indicators
│ │ │ └── AddCustomBarsTypeExampleUniRenko.cs
│ │ └── Info.xml
│ ├── BuySellPressureOneTick
│ │ ├── Indicators
│ │ │ └── BuySellPressueOneTick.cs
│ │ └── Info.xml
│ ├── ChartCustomToolbarExampleTopBottomLeftRight
│ │ ├── Indicators
│ │ │ └── ChartCustomToolBarExample.cs
│ │ └── Info.xml
│ ├── CustomRenderingExamples
│ │ ├── DrawBitmapDXExample.cs
│ │ ├── MultiPlotsPerBarDynamicExample.cs
│ │ ├── OnRenderDrawObjectsExample.cs
│ │ ├── OnRenderDynamicPlotLinesExample.cs
│ │ ├── TextRotationDXExample.cs
│ │ ├── VolumetricHighLightExample.cs
│ │ └── VolumetricHighLightExample2.cs
│ ├── DataManagementExamples
│ │ ├── BuildMinuteBarsFromTicksExample.cs
│ │ ├── BuySellVolumeOneTickAtPriceDictionaryExample.cs
│ │ ├── BuySellVolumeOneTickExample.cs
│ │ └── ProcessingHistoricalTickDataExample.cs
│ ├── LinearGradientBrushExample
│ │ ├── Indicators
│ │ │ └── LinearGradientBrushExample.cs
│ │ └── Info.xml
│ ├── OMDTest_ConditionalOnMarketDepthOnMarketData
│ │ ├── Indicators
│ │ │ └── OMDTest.cs
│ │ └── Info.xml
│ ├── OnRenderLinesfromSeriesBoolExample
│ │ ├── Indicators
│ │ │ └── OnRenderLines.cs
│ │ └── Info.xml
│ ├── OneTickMultiSeriesTemplate
│ │ ├── Indicators
│ │ │ └── OneTickMultiSeriesTemplate.cs
│ │ └── Info.xml
│ ├── PlotFromSecondaryDataSeriesExample
│ │ ├── Indicators
│ │ │ ├── @SMA.cs
│ │ │ └── PlotFromSecondaryDataSeriesExample.cs
│ │ └── Info.xml
│ ├── PropertyGridControlsExamples
│ │ └── BrushCollectionEditorExample.cs
│ ├── RadialGradientBrushExample
│ │ ├── Indicators
│ │ │ └── RadialGradientBrushExample.cs
│ │ └── Info.xml
│ ├── SampleDrawBitmapFunV3
│ │ ├── Indicators
│ │ │ └── SampleDrawBitmapFun.cs
│ │ ├── Info.xml
│ │ └── templates
│ │ │ ├── SampleDrawBitmap.png
│ │ │ └── SubFolder
│ │ │ └── SampleDrawBitmap.png
│ ├── SampleDrawBitmap_1.24.2018
│ │ ├── Indicators
│ │ │ └── SampleDrawBitmap.cs
│ │ └── Info.xml
│ ├── SampleSharpDXTextRotation
│ │ ├── Indicators
│ │ │ └── SampleSharpDXTextRotation.cs
│ │ └── Info.xml
│ ├── VolumetricTestBuySellPressure
│ │ ├── Indicators
│ │ │ └── VolumetricTest.cs
│ │ └── Info.xml
│ └── WPFManagement
│ │ └── CaptureChartTraderControlsExample.cs
└── Strategies
│ ├── AtmStrategySelectorExample
│ ├── Info.xml
│ └── Strategies
│ │ └── AtmStrategySelectorExample.cs
│ ├── DrawOnIndicatorPanelsFromStrategy
│ ├── Indicators
│ │ └── @MACD.cs
│ ├── Info.xml
│ └── Strategies
│ │ └── DrawOnIndicatorPanels.cs
│ ├── MultiStopTargetTest
│ ├── Info.xml
│ └── Strategies
│ │ └── MultiTargetStopTest.cs
│ ├── PlotHigherTimeFrame
│ ├── Indicators
│ │ ├── @HMA.cs
│ │ └── @WMA.cs
│ ├── Info.xml
│ └── Strategies
│ │ └── PlotHigherTimeFrame.cs
│ ├── PsuedoOnExecutionPartialTest
│ ├── Info.xml
│ └── Strategies
│ │ └── PsuedoOnExecutionPartialTest.cs
│ ├── RithmicIBFriendlyExamples
│ ├── ManagedRithmicIBFriendlyExample.cs
│ ├── ManagedRithmicIBFriendlyMultipleEntriesExample.cs
│ ├── ManagedRithmicIBFriendlySimpleExample.cs
│ ├── UnmanagedRithmicIBFriendlyExample.cs
│ ├── UnmanagedRithmicIBFriendlyMultipleEntriesExample.cs
│ └── UnmanagedRithmicIBSimpleExample.cs
│ ├── SampleAtmStrategyMultipleInstances
│ ├── Info.xml
│ └── Strategies
│ │ └── SampleAtmStrategyMultipleInstances.cs
│ ├── StrategyAddIndicatorsToSamePanel
│ ├── Indicators
│ │ ├── @CCI.cs
│ │ └── @SMA.cs
│ ├── Info.xml
│ └── Strategies
│ │ └── StrategyAddIndicatorsToSamePanel.cs
│ └── TradeOrganizer
│ ├── TradeOrganizerDemoExample.cs
│ └── TradeOrganizerExtention.cs
└── Projects
├── FixHeikenAshi
├── BarsTypes
│ └── HeikenAshiBarsTypeAccurate.cs
└── Indicators
│ ├── HeikenAshi8Rounded.cs
│ └── HeikenAshiChecker.cs
├── LabeledLines
├── DrawingTools
│ └── LabeledLines.cs
└── Info.xml
└── SharpDXHelper
├── AddOns
├── CustomFilePicker.cs
└── SharpDXHelper.cs
├── AdditionalReferences.txt
├── Indicators
└── SharpDXHelperExample.cs
└── Info.xml
/Conversions/Indicators/AdvancedRiskReward/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.9.0
5 |
6 |
--------------------------------------------------------------------------------
/Conversions/Indicators/BollingerPair_NT8/Indicators/@CMO.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2018, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// The CMO differs from other momentum oscillators such as Relative Strength Index (RSI) and Stochastics.
32 | /// It uses both up and down days data in the numerator of the calculation to measure momentum directly.
33 | /// Primarily used to look for extreme overbought and oversold conditions, CMO can also be used to look for trends.
34 | ///
35 | public class CMO : Indicator
36 | {
37 | private Series down;
38 | private Series up;
39 | private SUM sumDown;
40 | private SUM sumUp;
41 |
42 | protected override void OnStateChange()
43 | {
44 | if (State == State.SetDefaults)
45 | {
46 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionCMO;
47 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameCMO;
48 | IsSuspendedWhileInactive = true;
49 | IsOverlay = false;
50 | Period = 14;
51 |
52 | AddPlot(Brushes.DodgerBlue, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameCMO);
53 | }
54 | else if (State == State.DataLoaded)
55 | {
56 | down = new Series(this);
57 | up = new Series(this);
58 | sumDown = SUM(down, Period);
59 | sumUp = SUM(up, Period);
60 | }
61 | }
62 |
63 | protected override void OnBarUpdate()
64 | {
65 | if (CurrentBar == 0)
66 | {
67 | down[0] = 0;
68 | up[0] = 0;
69 | return;
70 | }
71 |
72 | double input0 = Input[0];
73 | double input1 = Input[1];
74 | down[0] = Math.Max(input1 - input0, 0);
75 | up[0] = Math.Max(input0 - input1, 0);
76 |
77 | double sumDown0 = sumDown[0];
78 | double sumUp0 = sumUp[0];
79 |
80 | if (sumUp0.ApproxCompare(sumDown0) == 0)
81 | Value[0] = 0;
82 | else
83 | Value[0] = 100 * ((sumUp0 - sumDown0) / (sumUp0 + sumDown0));
84 | }
85 |
86 | #region Properties
87 | [Range(1, int.MaxValue), NinjaScriptProperty]
88 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
89 | public int Period
90 | { get; set; }
91 | #endregion
92 | }
93 | }
94 |
95 | #region NinjaScript generated code. Neither change nor remove.
96 |
97 | namespace NinjaTrader.NinjaScript.Indicators
98 | {
99 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
100 | {
101 | private CMO[] cacheCMO;
102 | public CMO CMO(int period)
103 | {
104 | return CMO(Input, period);
105 | }
106 |
107 | public CMO CMO(ISeries input, int period)
108 | {
109 | if (cacheCMO != null)
110 | for (int idx = 0; idx < cacheCMO.Length; idx++)
111 | if (cacheCMO[idx] != null && cacheCMO[idx].Period == period && cacheCMO[idx].EqualsInput(input))
112 | return cacheCMO[idx];
113 | return CacheIndicator(new CMO(){ Period = period }, input, ref cacheCMO);
114 | }
115 | }
116 | }
117 |
118 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
119 | {
120 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
121 | {
122 | public Indicators.CMO CMO(int period)
123 | {
124 | return indicator.CMO(Input, period);
125 | }
126 |
127 | public Indicators.CMO CMO(ISeries input , int period)
128 | {
129 | return indicator.CMO(input, period);
130 | }
131 | }
132 | }
133 |
134 | namespace NinjaTrader.NinjaScript.Strategies
135 | {
136 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
137 | {
138 | public Indicators.CMO CMO(int period)
139 | {
140 | return indicator.CMO(Input, period);
141 | }
142 |
143 | public Indicators.CMO CMO(ISeries input , int period)
144 | {
145 | return indicator.CMO(input, period);
146 | }
147 | }
148 | }
149 |
150 | #endregion
151 |
--------------------------------------------------------------------------------
/Conversions/Indicators/BollingerPair_NT8/Indicators/@DEMA.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2018, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// Double Exponential Moving Average
32 | ///
33 | public class DEMA : Indicator
34 | {
35 | private EMA ema;
36 | private EMA emaEma;
37 |
38 | protected override void OnStateChange()
39 | {
40 | if (State == State.SetDefaults)
41 | {
42 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionDEMA;
43 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameDEMA;
44 | IsSuspendedWhileInactive = true;
45 | IsOverlay = true;
46 | Period = 14;
47 |
48 | AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameDEMA);
49 | }
50 | else if (State == State.DataLoaded)
51 | {
52 | ema = EMA(Inputs[0], Period);
53 | emaEma = EMA(ema, Period);
54 | }
55 | }
56 |
57 | protected override void OnBarUpdate()
58 | {
59 | Value[0] = 2 * ema[0] - emaEma[0];
60 | }
61 |
62 | #region Properties
63 | [Range(1, int.MaxValue), NinjaScriptProperty]
64 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
65 | public int Period
66 | { get; set; }
67 | #endregion
68 | }
69 | }
70 |
71 | #region NinjaScript generated code. Neither change nor remove.
72 |
73 | namespace NinjaTrader.NinjaScript.Indicators
74 | {
75 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
76 | {
77 | private DEMA[] cacheDEMA;
78 | public DEMA DEMA(int period)
79 | {
80 | return DEMA(Input, period);
81 | }
82 |
83 | public DEMA DEMA(ISeries input, int period)
84 | {
85 | if (cacheDEMA != null)
86 | for (int idx = 0; idx < cacheDEMA.Length; idx++)
87 | if (cacheDEMA[idx] != null && cacheDEMA[idx].Period == period && cacheDEMA[idx].EqualsInput(input))
88 | return cacheDEMA[idx];
89 | return CacheIndicator(new DEMA(){ Period = period }, input, ref cacheDEMA);
90 | }
91 | }
92 | }
93 |
94 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
95 | {
96 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
97 | {
98 | public Indicators.DEMA DEMA(int period)
99 | {
100 | return indicator.DEMA(Input, period);
101 | }
102 |
103 | public Indicators.DEMA DEMA(ISeries input , int period)
104 | {
105 | return indicator.DEMA(input, period);
106 | }
107 | }
108 | }
109 |
110 | namespace NinjaTrader.NinjaScript.Strategies
111 | {
112 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
113 | {
114 | public Indicators.DEMA DEMA(int period)
115 | {
116 | return indicator.DEMA(Input, period);
117 | }
118 |
119 | public Indicators.DEMA DEMA(ISeries input , int period)
120 | {
121 | return indicator.DEMA(input, period);
122 | }
123 | }
124 | }
125 |
126 | #endregion
127 |
--------------------------------------------------------------------------------
/Conversions/Indicators/BollingerPair_NT8/Indicators/@EMA.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2018, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// Exponential Moving Average. The Exponential Moving Average is an indicator that
32 | /// shows the average value of a security's price over a period of time. When calculating
33 | /// a moving average. The EMA applies more weight to recent prices than the SMA.
34 | ///
35 | public class EMA : Indicator
36 | {
37 | private double constant1;
38 | private double constant2;
39 |
40 | protected override void OnStateChange()
41 | {
42 | if (State == State.SetDefaults)
43 | {
44 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionEMA;
45 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameEMA;
46 | IsOverlay = true;
47 | IsSuspendedWhileInactive = true;
48 | Period = 14;
49 |
50 | AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameEMA);
51 | }
52 | else if (State == State.Configure)
53 | {
54 | constant1 = 2.0 / (1 + Period);
55 | constant2 = 1 - (2.0 / (1 + Period));
56 | }
57 | }
58 |
59 | protected override void OnBarUpdate()
60 | {
61 | Value[0] = (CurrentBar == 0 ? Input[0] : Input[0] * constant1 + constant2 * Value[1]);
62 | }
63 |
64 | #region Properties
65 | [Range(1, int.MaxValue), NinjaScriptProperty]
66 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
67 | public int Period
68 | { get; set; }
69 | #endregion
70 | }
71 | }
72 |
73 | #region NinjaScript generated code. Neither change nor remove.
74 |
75 | namespace NinjaTrader.NinjaScript.Indicators
76 | {
77 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
78 | {
79 | private EMA[] cacheEMA;
80 | public EMA EMA(int period)
81 | {
82 | return EMA(Input, period);
83 | }
84 |
85 | public EMA EMA(ISeries input, int period)
86 | {
87 | if (cacheEMA != null)
88 | for (int idx = 0; idx < cacheEMA.Length; idx++)
89 | if (cacheEMA[idx] != null && cacheEMA[idx].Period == period && cacheEMA[idx].EqualsInput(input))
90 | return cacheEMA[idx];
91 | return CacheIndicator(new EMA(){ Period = period }, input, ref cacheEMA);
92 | }
93 | }
94 | }
95 |
96 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
97 | {
98 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
99 | {
100 | public Indicators.EMA EMA(int period)
101 | {
102 | return indicator.EMA(Input, period);
103 | }
104 |
105 | public Indicators.EMA EMA(ISeries input , int period)
106 | {
107 | return indicator.EMA(input, period);
108 | }
109 | }
110 | }
111 |
112 | namespace NinjaTrader.NinjaScript.Strategies
113 | {
114 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
115 | {
116 | public Indicators.EMA EMA(int period)
117 | {
118 | return indicator.EMA(Input, period);
119 | }
120 |
121 | public Indicators.EMA EMA(ISeries input , int period)
122 | {
123 | return indicator.EMA(input, period);
124 | }
125 | }
126 | }
127 |
128 | #endregion
129 |
--------------------------------------------------------------------------------
/Conversions/Indicators/BollingerPair_NT8/Indicators/@HMA.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2018, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | //This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// The Hull Moving Average (HMA) employs weighted MA calculations to offer superior
32 | /// smoothing, and much less lag, over traditional SMA indicators.
33 | /// This indicator is based on the reference article found here:
34 | /// http://www.justdata.com.au/Journals/AlanHull/hull_ma.htm
35 | ///
36 | public class HMA : Indicator
37 | {
38 | private Series diffSeries;
39 | private WMA wma1;
40 | private WMA wma2;
41 | private WMA wmaDiffSeries;
42 |
43 | protected override void OnStateChange()
44 | {
45 | if (State == State.SetDefaults)
46 | {
47 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionHMA;
48 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameHMA;
49 | IsSuspendedWhileInactive = true;
50 | Period = 14;
51 | IsOverlay = true;
52 |
53 | AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameHMA);
54 | }
55 | else if (State == State.DataLoaded)
56 | {
57 | diffSeries = new Series(this);
58 | wma1 = WMA(Inputs[0], (Period / 2));
59 | wma2 = WMA(Inputs[0], Period);
60 | wmaDiffSeries = WMA(diffSeries, (int) Math.Sqrt(Period));
61 | }
62 | }
63 |
64 | protected override void OnBarUpdate()
65 | {
66 | diffSeries[0] = 2 * wma1[0] - wma2[0];
67 | Value[0] = wmaDiffSeries[0];
68 | }
69 |
70 | #region Properties
71 | [Range(2, int.MaxValue), NinjaScriptProperty]
72 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
73 | public int Period
74 | { get; set; }
75 | #endregion
76 | }
77 | }
78 |
79 | #region NinjaScript generated code. Neither change nor remove.
80 |
81 | namespace NinjaTrader.NinjaScript.Indicators
82 | {
83 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
84 | {
85 | private HMA[] cacheHMA;
86 | public HMA HMA(int period)
87 | {
88 | return HMA(Input, period);
89 | }
90 |
91 | public HMA HMA(ISeries input, int period)
92 | {
93 | if (cacheHMA != null)
94 | for (int idx = 0; idx < cacheHMA.Length; idx++)
95 | if (cacheHMA[idx] != null && cacheHMA[idx].Period == period && cacheHMA[idx].EqualsInput(input))
96 | return cacheHMA[idx];
97 | return CacheIndicator(new HMA(){ Period = period }, input, ref cacheHMA);
98 | }
99 | }
100 | }
101 |
102 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
103 | {
104 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
105 | {
106 | public Indicators.HMA HMA(int period)
107 | {
108 | return indicator.HMA(Input, period);
109 | }
110 |
111 | public Indicators.HMA HMA(ISeries input , int period)
112 | {
113 | return indicator.HMA(input, period);
114 | }
115 | }
116 | }
117 |
118 | namespace NinjaTrader.NinjaScript.Strategies
119 | {
120 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
121 | {
122 | public Indicators.HMA HMA(int period)
123 | {
124 | return indicator.HMA(Input, period);
125 | }
126 |
127 | public Indicators.HMA HMA(ISeries input , int period)
128 | {
129 | return indicator.HMA(input, period);
130 | }
131 | }
132 | }
133 |
134 | #endregion
135 |
--------------------------------------------------------------------------------
/Conversions/Indicators/BollingerPair_NT8/Indicators/@SMA.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2018, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// The SMA (Simple Moving Average) is an indicator that shows the average value of a security's price over a period of time.
32 | ///
33 | public class SMA : Indicator
34 | {
35 | private double priorSum;
36 | private double sum;
37 |
38 | protected override void OnStateChange()
39 | {
40 | if (State == State.SetDefaults)
41 | {
42 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionSMA;
43 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameSMA;
44 | IsOverlay = true;
45 | IsSuspendedWhileInactive = true;
46 | Period = 14;
47 |
48 | AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameSMA);
49 | }
50 | else if (State == State.Configure)
51 | {
52 | priorSum = 0;
53 | sum = 0;
54 | }
55 | }
56 |
57 | protected override void OnBarUpdate()
58 | {
59 | if (BarsArray[0].BarsType.IsRemoveLastBarSupported)
60 | {
61 | if (CurrentBar == 0)
62 | Value[0] = Input[0];
63 | else
64 | {
65 | double last = Value[1] * Math.Min(CurrentBar, Period);
66 |
67 | if (CurrentBar >= Period)
68 | Value[0] = (last + Input[0] - Input[Period]) / Math.Min(CurrentBar, Period);
69 | else
70 | Value[0] = ((last + Input[0]) / (Math.Min(CurrentBar, Period) + 1));
71 | }
72 | }
73 | else
74 | {
75 | if (IsFirstTickOfBar)
76 | priorSum = sum;
77 |
78 | sum = priorSum + Input[0] - (CurrentBar >= Period ? Input[Period] : 0);
79 | Value[0] = sum / (CurrentBar < Period ? CurrentBar + 1 : Period);
80 | }
81 | }
82 |
83 | #region Properties
84 | [Range(1, int.MaxValue), NinjaScriptProperty]
85 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
86 | public int Period
87 | { get; set; }
88 | #endregion
89 | }
90 | }
91 |
92 | #region NinjaScript generated code. Neither change nor remove.
93 |
94 | namespace NinjaTrader.NinjaScript.Indicators
95 | {
96 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
97 | {
98 | private SMA[] cacheSMA;
99 | public SMA SMA(int period)
100 | {
101 | return SMA(Input, period);
102 | }
103 |
104 | public SMA SMA(ISeries input, int period)
105 | {
106 | if (cacheSMA != null)
107 | for (int idx = 0; idx < cacheSMA.Length; idx++)
108 | if (cacheSMA[idx] != null && cacheSMA[idx].Period == period && cacheSMA[idx].EqualsInput(input))
109 | return cacheSMA[idx];
110 | return CacheIndicator(new SMA(){ Period = period }, input, ref cacheSMA);
111 | }
112 | }
113 | }
114 |
115 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
116 | {
117 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
118 | {
119 | public Indicators.SMA SMA(int period)
120 | {
121 | return indicator.SMA(Input, period);
122 | }
123 |
124 | public Indicators.SMA SMA(ISeries input , int period)
125 | {
126 | return indicator.SMA(input, period);
127 | }
128 | }
129 | }
130 |
131 | namespace NinjaTrader.NinjaScript.Strategies
132 | {
133 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
134 | {
135 | public Indicators.SMA SMA(int period)
136 | {
137 | return indicator.SMA(Input, period);
138 | }
139 |
140 | public Indicators.SMA SMA(ISeries input , int period)
141 | {
142 | return indicator.SMA(input, period);
143 | }
144 | }
145 | }
146 |
147 | #endregion
148 |
--------------------------------------------------------------------------------
/Conversions/Indicators/BollingerPair_NT8/Indicators/@SUM.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2018, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// The Sum shows the summation of the last n data points.
32 | ///
33 | public class SUM : Indicator
34 | {
35 | protected override void OnStateChange()
36 | {
37 | if (State == State.SetDefaults)
38 | {
39 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionSUM;
40 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameSUM;
41 | IsSuspendedWhileInactive = true;
42 | Period = 14;
43 |
44 | AddPlot(Brushes.DarkCyan, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameSUM);
45 | }
46 | }
47 |
48 | protected override void OnBarUpdate()
49 | {
50 | Value[0] = Input[0] + (CurrentBar > 0 ? Value[1] : 0) - (CurrentBar >= Period ? Input[Period] : 0);
51 | }
52 |
53 | #region Properties
54 | [Range(1, int.MaxValue), NinjaScriptProperty]
55 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
56 | public int Period
57 | { get; set; }
58 | #endregion
59 | }
60 | }
61 |
62 | #region NinjaScript generated code. Neither change nor remove.
63 |
64 | namespace NinjaTrader.NinjaScript.Indicators
65 | {
66 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
67 | {
68 | private SUM[] cacheSUM;
69 | public SUM SUM(int period)
70 | {
71 | return SUM(Input, period);
72 | }
73 |
74 | public SUM SUM(ISeries input, int period)
75 | {
76 | if (cacheSUM != null)
77 | for (int idx = 0; idx < cacheSUM.Length; idx++)
78 | if (cacheSUM[idx] != null && cacheSUM[idx].Period == period && cacheSUM[idx].EqualsInput(input))
79 | return cacheSUM[idx];
80 | return CacheIndicator(new SUM(){ Period = period }, input, ref cacheSUM);
81 | }
82 | }
83 | }
84 |
85 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
86 | {
87 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
88 | {
89 | public Indicators.SUM SUM(int period)
90 | {
91 | return indicator.SUM(Input, period);
92 | }
93 |
94 | public Indicators.SUM SUM(ISeries input , int period)
95 | {
96 | return indicator.SUM(input, period);
97 | }
98 | }
99 | }
100 |
101 | namespace NinjaTrader.NinjaScript.Strategies
102 | {
103 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
104 | {
105 | public Indicators.SUM SUM(int period)
106 | {
107 | return indicator.SUM(Input, period);
108 | }
109 |
110 | public Indicators.SUM SUM(ISeries input , int period)
111 | {
112 | return indicator.SUM(input, period);
113 | }
114 | }
115 | }
116 |
117 | #endregion
118 |
--------------------------------------------------------------------------------
/Conversions/Indicators/BollingerPair_NT8/Indicators/@StdDev.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2018, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// Standard Deviation is a statistical measure of volatility.
32 | /// Standard Deviation is typically used as a component of other indicators,
33 | /// rather than as a stand-alone indicator. For example, Bollinger Bands are
34 | /// calculated by adding a security's Standard Deviation to a moving average.
35 | ///
36 | public class StdDev : Indicator
37 | {
38 | private Series sumSeries;
39 |
40 | protected override void OnStateChange()
41 | {
42 | if (State == State.SetDefaults)
43 | {
44 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionStdDev;
45 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameStdDev;
46 | IsOverlay = false;
47 | IsSuspendedWhileInactive = true;
48 | Period = 14;
49 |
50 | AddPlot(Brushes.DarkCyan, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameStdDev);
51 | }
52 | else if (State == State.DataLoaded)
53 | {
54 | sumSeries = new Series(this, Period <= 256 ? MaximumBarsLookBack.TwoHundredFiftySix : MaximumBarsLookBack.Infinite);
55 | }
56 | }
57 |
58 | protected override void OnBarUpdate()
59 | {
60 | if (CurrentBar < 1)
61 | {
62 | Value[0] = 0;
63 | sumSeries[0] = Input[0];
64 | }
65 | else
66 | {
67 | sumSeries[0] = Input[0] + sumSeries[1] - (CurrentBar >= Period ? Input[Period] : 0);
68 | double avg = sumSeries[0] / Math.Min(CurrentBar + 1, Period);
69 | double sum = 0;
70 | for (int barsBack = Math.Min(CurrentBar, Period - 1); barsBack >= 0; barsBack--)
71 | sum += (Input[barsBack] - avg) * (Input[barsBack] - avg);
72 |
73 | Value[0] = Math.Sqrt(sum / Math.Min(CurrentBar + 1, Period));
74 | }
75 | }
76 |
77 | #region Properties
78 | [Range(1, int.MaxValue), NinjaScriptProperty]
79 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
80 | public int Period
81 | { get; set; }
82 | #endregion
83 | }
84 | }
85 |
86 | #region NinjaScript generated code. Neither change nor remove.
87 |
88 | namespace NinjaTrader.NinjaScript.Indicators
89 | {
90 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
91 | {
92 | private StdDev[] cacheStdDev;
93 | public StdDev StdDev(int period)
94 | {
95 | return StdDev(Input, period);
96 | }
97 |
98 | public StdDev StdDev(ISeries input, int period)
99 | {
100 | if (cacheStdDev != null)
101 | for (int idx = 0; idx < cacheStdDev.Length; idx++)
102 | if (cacheStdDev[idx] != null && cacheStdDev[idx].Period == period && cacheStdDev[idx].EqualsInput(input))
103 | return cacheStdDev[idx];
104 | return CacheIndicator(new StdDev(){ Period = period }, input, ref cacheStdDev);
105 | }
106 | }
107 | }
108 |
109 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
110 | {
111 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
112 | {
113 | public Indicators.StdDev StdDev(int period)
114 | {
115 | return indicator.StdDev(Input, period);
116 | }
117 |
118 | public Indicators.StdDev StdDev(ISeries input , int period)
119 | {
120 | return indicator.StdDev(input, period);
121 | }
122 | }
123 | }
124 |
125 | namespace NinjaTrader.NinjaScript.Strategies
126 | {
127 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
128 | {
129 | public Indicators.StdDev StdDev(int period)
130 | {
131 | return indicator.StdDev(Input, period);
132 | }
133 |
134 | public Indicators.StdDev StdDev(ISeries input , int period)
135 | {
136 | return indicator.StdDev(input, period);
137 | }
138 | }
139 | }
140 |
141 | #endregion
142 |
--------------------------------------------------------------------------------
/Conversions/Indicators/BollingerPair_NT8/Indicators/@TMA.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2018, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// The TMA (Triangular Moving Average) is a weighted moving average. Compared to the WMA which puts more weight on the latest price bar, the TMA puts more weight on the data in the middle of the specified period.
32 | ///
33 | public class TMA : Indicator
34 | {
35 | private int p1;
36 | private int p2;
37 | private SMA sma;
38 |
39 | protected override void OnStateChange()
40 | {
41 | if (State == State.SetDefaults)
42 | {
43 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionTMA;
44 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameTMA;
45 | IsOverlay = true;
46 | IsSuspendedWhileInactive = true;
47 | Period = 15;
48 |
49 | AddPlot(Brushes.DodgerBlue, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameTMA);
50 | }
51 | else if (State == State.Configure)
52 | {
53 | p1 = 0;
54 | p2 = 0;
55 | if ((Period & 1) == 0)
56 | {
57 | // Even period
58 | p1 = Period / 2;
59 | p2 = p1 + 1;
60 | }
61 | else
62 | {
63 | // Odd period
64 | p1 = (Period + 1) / 2;
65 | p2 = p1;
66 | }
67 | }
68 | else if (State == State.DataLoaded)
69 | {
70 | sma = SMA(SMA(Inputs[0], p1), p2);
71 | }
72 | }
73 |
74 | protected override void OnBarUpdate()
75 | {
76 | Value[0] = sma[0];
77 | }
78 |
79 | #region Properties
80 |
81 | [Range(1, int.MaxValue), NinjaScriptProperty]
82 | [Display(ResourceType = typeof (Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
83 | public int Period
84 | { get; set; }
85 |
86 | #endregion
87 | }
88 | }
89 |
90 | #region NinjaScript generated code. Neither change nor remove.
91 |
92 | namespace NinjaTrader.NinjaScript.Indicators
93 | {
94 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
95 | {
96 | private TMA[] cacheTMA;
97 | public TMA TMA(int period)
98 | {
99 | return TMA(Input, period);
100 | }
101 |
102 | public TMA TMA(ISeries input, int period)
103 | {
104 | if (cacheTMA != null)
105 | for (int idx = 0; idx < cacheTMA.Length; idx++)
106 | if (cacheTMA[idx] != null && cacheTMA[idx].Period == period && cacheTMA[idx].EqualsInput(input))
107 | return cacheTMA[idx];
108 | return CacheIndicator(new TMA(){ Period = period }, input, ref cacheTMA);
109 | }
110 | }
111 | }
112 |
113 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
114 | {
115 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
116 | {
117 | public Indicators.TMA TMA(int period)
118 | {
119 | return indicator.TMA(Input, period);
120 | }
121 |
122 | public Indicators.TMA TMA(ISeries input , int period)
123 | {
124 | return indicator.TMA(input, period);
125 | }
126 | }
127 | }
128 |
129 | namespace NinjaTrader.NinjaScript.Strategies
130 | {
131 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
132 | {
133 | public Indicators.TMA TMA(int period)
134 | {
135 | return indicator.TMA(Input, period);
136 | }
137 |
138 | public Indicators.TMA TMA(ISeries input , int period)
139 | {
140 | return indicator.TMA(input, period);
141 | }
142 | }
143 | }
144 |
145 | #endregion
146 |
--------------------------------------------------------------------------------
/Conversions/Indicators/BollingerPair_NT8/Indicators/@ZLEMA.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2018, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | //This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// The ZLEMA (Zero-Lag Exponential Moving Average) is an EMA variant that attempts to adjust for lag.
32 | ///
33 | public class ZLEMA : Indicator
34 | {
35 | private double k;
36 | private int lag;
37 | private double oneMinusK;
38 |
39 | protected override void OnStateChange()
40 | {
41 | if (State == State.SetDefaults)
42 | {
43 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionZLEMA;
44 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameZLEMA;
45 | IsSuspendedWhileInactive = true;
46 | IsOverlay = true;
47 | Period = 14;
48 |
49 | AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameZLEMA);
50 | }
51 | else if (State == State.Configure)
52 | {
53 | k = 2.0 / (Period + 1);
54 | oneMinusK = 1 - k;
55 | lag = (int) Math.Ceiling((Period - 1) / 2.0);
56 | }
57 | }
58 |
59 | protected override void OnBarUpdate()
60 | {
61 | if (CurrentBar < lag)
62 | Value[0] = Input[0];
63 | else
64 | Value[0] = k * (2 * Input[0] - Input[lag]) + oneMinusK * Value[1];
65 | }
66 |
67 | #region Properties
68 | [Range(1, int.MaxValue), NinjaScriptProperty]
69 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
70 | public int Period
71 | { get; set; }
72 | #endregion
73 | }
74 | }
75 |
76 | #region NinjaScript generated code. Neither change nor remove.
77 |
78 | namespace NinjaTrader.NinjaScript.Indicators
79 | {
80 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
81 | {
82 | private ZLEMA[] cacheZLEMA;
83 | public ZLEMA ZLEMA(int period)
84 | {
85 | return ZLEMA(Input, period);
86 | }
87 |
88 | public ZLEMA ZLEMA(ISeries input, int period)
89 | {
90 | if (cacheZLEMA != null)
91 | for (int idx = 0; idx < cacheZLEMA.Length; idx++)
92 | if (cacheZLEMA[idx] != null && cacheZLEMA[idx].Period == period && cacheZLEMA[idx].EqualsInput(input))
93 | return cacheZLEMA[idx];
94 | return CacheIndicator(new ZLEMA(){ Period = period }, input, ref cacheZLEMA);
95 | }
96 | }
97 | }
98 |
99 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
100 | {
101 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
102 | {
103 | public Indicators.ZLEMA ZLEMA(int period)
104 | {
105 | return indicator.ZLEMA(Input, period);
106 | }
107 |
108 | public Indicators.ZLEMA ZLEMA(ISeries input , int period)
109 | {
110 | return indicator.ZLEMA(input, period);
111 | }
112 | }
113 | }
114 |
115 | namespace NinjaTrader.NinjaScript.Strategies
116 | {
117 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
118 | {
119 | public Indicators.ZLEMA ZLEMA(int period)
120 | {
121 | return indicator.ZLEMA(Input, period);
122 | }
123 |
124 | public Indicators.ZLEMA ZLEMA(ISeries input , int period)
125 | {
126 | return indicator.ZLEMA(input, period);
127 | }
128 | }
129 | }
130 |
131 | #endregion
132 |
--------------------------------------------------------------------------------
/Conversions/Indicators/BollingerPair_NT8/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.12.1
5 |
6 |
--------------------------------------------------------------------------------
/Conversions/Indicators/CCIForecasterV7DE_NT8/Indicators/@EMA.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2018, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// Exponential Moving Average. The Exponential Moving Average is an indicator that
32 | /// shows the average value of a security's price over a period of time. When calculating
33 | /// a moving average. The EMA applies more weight to recent prices than the SMA.
34 | ///
35 | public class EMA : Indicator
36 | {
37 | private double constant1;
38 | private double constant2;
39 |
40 | protected override void OnStateChange()
41 | {
42 | if (State == State.SetDefaults)
43 | {
44 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionEMA;
45 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameEMA;
46 | IsOverlay = true;
47 | IsSuspendedWhileInactive = true;
48 | Period = 14;
49 |
50 | AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameEMA);
51 | }
52 | else if (State == State.Configure)
53 | {
54 | constant1 = 2.0 / (1 + Period);
55 | constant2 = 1 - (2.0 / (1 + Period));
56 | }
57 | }
58 |
59 | protected override void OnBarUpdate()
60 | {
61 | Value[0] = (CurrentBar == 0 ? Input[0] : Input[0] * constant1 + constant2 * Value[1]);
62 | }
63 |
64 | #region Properties
65 | [Range(1, int.MaxValue), NinjaScriptProperty]
66 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
67 | public int Period
68 | { get; set; }
69 | #endregion
70 | }
71 | }
72 |
73 | #region NinjaScript generated code. Neither change nor remove.
74 |
75 | namespace NinjaTrader.NinjaScript.Indicators
76 | {
77 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
78 | {
79 | private EMA[] cacheEMA;
80 | public EMA EMA(int period)
81 | {
82 | return EMA(Input, period);
83 | }
84 |
85 | public EMA EMA(ISeries input, int period)
86 | {
87 | if (cacheEMA != null)
88 | for (int idx = 0; idx < cacheEMA.Length; idx++)
89 | if (cacheEMA[idx] != null && cacheEMA[idx].Period == period && cacheEMA[idx].EqualsInput(input))
90 | return cacheEMA[idx];
91 | return CacheIndicator(new EMA(){ Period = period }, input, ref cacheEMA);
92 | }
93 | }
94 | }
95 |
96 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
97 | {
98 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
99 | {
100 | public Indicators.EMA EMA(int period)
101 | {
102 | return indicator.EMA(Input, period);
103 | }
104 |
105 | public Indicators.EMA EMA(ISeries input , int period)
106 | {
107 | return indicator.EMA(input, period);
108 | }
109 | }
110 | }
111 |
112 | namespace NinjaTrader.NinjaScript.Strategies
113 | {
114 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
115 | {
116 | public Indicators.EMA EMA(int period)
117 | {
118 | return indicator.EMA(Input, period);
119 | }
120 |
121 | public Indicators.EMA EMA(ISeries input , int period)
122 | {
123 | return indicator.EMA(input, period);
124 | }
125 | }
126 | }
127 |
128 | #endregion
129 |
--------------------------------------------------------------------------------
/Conversions/Indicators/CCIForecasterV7DE_NT8/Indicators/@SUM.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2018, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// The Sum shows the summation of the last n data points.
32 | ///
33 | public class SUM : Indicator
34 | {
35 | protected override void OnStateChange()
36 | {
37 | if (State == State.SetDefaults)
38 | {
39 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionSUM;
40 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameSUM;
41 | IsSuspendedWhileInactive = true;
42 | Period = 14;
43 |
44 | AddPlot(Brushes.DarkCyan, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameSUM);
45 | }
46 | }
47 |
48 | protected override void OnBarUpdate()
49 | {
50 | Value[0] = Input[0] + (CurrentBar > 0 ? Value[1] : 0) - (CurrentBar >= Period ? Input[Period] : 0);
51 | }
52 |
53 | #region Properties
54 | [Range(1, int.MaxValue), NinjaScriptProperty]
55 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
56 | public int Period
57 | { get; set; }
58 | #endregion
59 | }
60 | }
61 |
62 | #region NinjaScript generated code. Neither change nor remove.
63 |
64 | namespace NinjaTrader.NinjaScript.Indicators
65 | {
66 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
67 | {
68 | private SUM[] cacheSUM;
69 | public SUM SUM(int period)
70 | {
71 | return SUM(Input, period);
72 | }
73 |
74 | public SUM SUM(ISeries input, int period)
75 | {
76 | if (cacheSUM != null)
77 | for (int idx = 0; idx < cacheSUM.Length; idx++)
78 | if (cacheSUM[idx] != null && cacheSUM[idx].Period == period && cacheSUM[idx].EqualsInput(input))
79 | return cacheSUM[idx];
80 | return CacheIndicator(new SUM(){ Period = period }, input, ref cacheSUM);
81 | }
82 | }
83 | }
84 |
85 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
86 | {
87 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
88 | {
89 | public Indicators.SUM SUM(int period)
90 | {
91 | return indicator.SUM(Input, period);
92 | }
93 |
94 | public Indicators.SUM SUM(ISeries input , int period)
95 | {
96 | return indicator.SUM(input, period);
97 | }
98 | }
99 | }
100 |
101 | namespace NinjaTrader.NinjaScript.Strategies
102 | {
103 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
104 | {
105 | public Indicators.SUM SUM(int period)
106 | {
107 | return indicator.SUM(Input, period);
108 | }
109 |
110 | public Indicators.SUM SUM(ISeries input , int period)
111 | {
112 | return indicator.SUM(input, period);
113 | }
114 | }
115 | }
116 |
117 | #endregion
118 |
--------------------------------------------------------------------------------
/Conversions/Indicators/CCIForecasterV7DE_NT8/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.14.1
5 |
6 |
--------------------------------------------------------------------------------
/Conversions/Indicators/CalculateValueArea_NT7/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 7.0.1000.37
4 |
5 |
--------------------------------------------------------------------------------
/Conversions/Indicators/CalculateValueArea_NT8/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.12.1
5 |
6 |
--------------------------------------------------------------------------------
/Conversions/Indicators/ColorZone3_NT8/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.13.1
5 |
6 |
--------------------------------------------------------------------------------
/Conversions/Indicators/CurrentPriceMarker/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.14.2
5 |
6 |
--------------------------------------------------------------------------------
/Conversions/Indicators/EdsLevel2/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.9.0
5 |
6 |
--------------------------------------------------------------------------------
/Conversions/Indicators/FixedPercentTrailingStop/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.13.1
5 |
6 |
--------------------------------------------------------------------------------
/Conversions/Indicators/HeikenAshiSmoothed/Indicators/@HMA.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2017, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | //This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// The Hull Moving Average (HMA) employs weighted MA calculations to offer superior
32 | /// smoothing, and much less lag, over traditional SMA indicators.
33 | /// This indicator is based on the reference article found here:
34 | /// http://www.justdata.com.au/Journals/AlanHull/hull_ma.htm
35 | ///
36 | public class HMA : Indicator
37 | {
38 | private Series diffSeries;
39 | private WMA wma1;
40 | private WMA wma2;
41 | private WMA wmaDiffSeries;
42 |
43 | protected override void OnStateChange()
44 | {
45 | if (State == State.SetDefaults)
46 | {
47 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionHMA;
48 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameHMA;
49 | IsSuspendedWhileInactive = true;
50 | Period = 14;
51 | IsOverlay = true;
52 |
53 | AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameHMA);
54 | }
55 | else if (State == State.DataLoaded)
56 | {
57 | diffSeries = new Series(this);
58 | wma1 = WMA(Inputs[0], (Period / 2));
59 | wma2 = WMA(Inputs[0], Period);
60 | wmaDiffSeries = WMA(diffSeries, (int) Math.Sqrt(Period));
61 | }
62 | }
63 |
64 | protected override void OnBarUpdate()
65 | {
66 | diffSeries[0] = 2 * wma1[0] - wma2[0];
67 | Value[0] = wmaDiffSeries[0];
68 | }
69 |
70 | #region Properties
71 | [Range(2, int.MaxValue), NinjaScriptProperty]
72 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
73 | public int Period
74 | { get; set; }
75 | #endregion
76 | }
77 | }
78 |
79 | #region NinjaScript generated code. Neither change nor remove.
80 |
81 | namespace NinjaTrader.NinjaScript.Indicators
82 | {
83 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
84 | {
85 | private HMA[] cacheHMA;
86 | public HMA HMA(int period)
87 | {
88 | return HMA(Input, period);
89 | }
90 |
91 | public HMA HMA(ISeries input, int period)
92 | {
93 | if (cacheHMA != null)
94 | for (int idx = 0; idx < cacheHMA.Length; idx++)
95 | if (cacheHMA[idx] != null && cacheHMA[idx].Period == period && cacheHMA[idx].EqualsInput(input))
96 | return cacheHMA[idx];
97 | return CacheIndicator(new HMA(){ Period = period }, input, ref cacheHMA);
98 | }
99 | }
100 | }
101 |
102 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
103 | {
104 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
105 | {
106 | public Indicators.HMA HMA(int period)
107 | {
108 | return indicator.HMA(Input, period);
109 | }
110 |
111 | public Indicators.HMA HMA(ISeries input , int period)
112 | {
113 | return indicator.HMA(input, period);
114 | }
115 | }
116 | }
117 |
118 | namespace NinjaTrader.NinjaScript.Strategies
119 | {
120 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
121 | {
122 | public Indicators.HMA HMA(int period)
123 | {
124 | return indicator.HMA(Input, period);
125 | }
126 |
127 | public Indicators.HMA HMA(ISeries input , int period)
128 | {
129 | return indicator.HMA(input, period);
130 | }
131 | }
132 | }
133 |
134 | #endregion
135 |
--------------------------------------------------------------------------------
/Conversions/Indicators/HeikenAshiSmoothed/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.9.0
5 |
6 |
--------------------------------------------------------------------------------
/Conversions/Indicators/IGTDSequential2/Indicators/@MAX.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2017, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// The Maximum shows the maximum of the last n bars.
32 | ///
33 | public class MAX : Indicator
34 | {
35 | private int lastBar;
36 | private double lastMax;
37 | private double runningMax;
38 | private int runningBar;
39 | private int thisBar;
40 |
41 | protected override void OnStateChange()
42 | {
43 | if (State == State.SetDefaults)
44 | {
45 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionMAX;
46 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameMAX;
47 | IsOverlay = true;
48 | IsSuspendedWhileInactive = true;
49 | Period = 14;
50 |
51 | AddPlot(Brushes.DarkCyan, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameMAX);
52 | }
53 | else if (State == State.Configure)
54 | {
55 | lastBar = 0;
56 | lastMax = 0;
57 | runningMax = 0;
58 | runningBar = 0;
59 | thisBar = 0;
60 | }
61 | }
62 |
63 | protected override void OnBarUpdate()
64 | {
65 | if (CurrentBar == 0)
66 | {
67 | runningMax = Input[0];
68 | lastMax = Input[0];
69 | runningBar = 0;
70 | lastBar = 0;
71 | thisBar = 0;
72 | Value[0] = Input[0];
73 | return;
74 | }
75 |
76 | if (CurrentBar - runningBar >= Period || CurrentBar < thisBar)
77 | {
78 | runningMax = double.MinValue;
79 | for (int barsBack = Math.Min(CurrentBar, Period - 1); barsBack > 0; barsBack--)
80 | if (Input[barsBack] >= runningMax)
81 | {
82 | runningMax = Input[barsBack];
83 | runningBar = CurrentBar - barsBack;
84 | }
85 | }
86 |
87 | if (thisBar != CurrentBar)
88 | {
89 | lastMax = runningMax;
90 | lastBar = runningBar;
91 | thisBar = CurrentBar;
92 | }
93 |
94 | if (Input[0] >= lastMax)
95 | {
96 | runningMax = Input[0];
97 | runningBar = CurrentBar;
98 | }
99 | else
100 | {
101 | runningMax = lastMax;
102 | runningBar = lastBar;
103 | }
104 |
105 | Value[0] = runningMax;
106 | }
107 |
108 | #region Properties
109 | [Range(1, int.MaxValue), NinjaScriptProperty]
110 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
111 | public int Period
112 | { get; set; }
113 | #endregion
114 | }
115 | }
116 |
117 | #region NinjaScript generated code. Neither change nor remove.
118 |
119 | namespace NinjaTrader.NinjaScript.Indicators
120 | {
121 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
122 | {
123 | private MAX[] cacheMAX;
124 | public MAX MAX(int period)
125 | {
126 | return MAX(Input, period);
127 | }
128 |
129 | public MAX MAX(ISeries input, int period)
130 | {
131 | if (cacheMAX != null)
132 | for (int idx = 0; idx < cacheMAX.Length; idx++)
133 | if (cacheMAX[idx] != null && cacheMAX[idx].Period == period && cacheMAX[idx].EqualsInput(input))
134 | return cacheMAX[idx];
135 | return CacheIndicator(new MAX(){ Period = period }, input, ref cacheMAX);
136 | }
137 | }
138 | }
139 |
140 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
141 | {
142 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
143 | {
144 | public Indicators.MAX MAX(int period)
145 | {
146 | return indicator.MAX(Input, period);
147 | }
148 |
149 | public Indicators.MAX MAX(ISeries input , int period)
150 | {
151 | return indicator.MAX(input, period);
152 | }
153 | }
154 | }
155 |
156 | namespace NinjaTrader.NinjaScript.Strategies
157 | {
158 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
159 | {
160 | public Indicators.MAX MAX(int period)
161 | {
162 | return indicator.MAX(Input, period);
163 | }
164 |
165 | public Indicators.MAX MAX(ISeries input , int period)
166 | {
167 | return indicator.MAX(input, period);
168 | }
169 | }
170 | }
171 |
172 | #endregion
173 |
--------------------------------------------------------------------------------
/Conversions/Indicators/IGTDSequential2/Indicators/@Range.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2017, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// Calculates the range of a bar.
32 | ///
33 | public class Range : Indicator
34 | {
35 | protected override void OnStateChange()
36 | {
37 | if (State == State.SetDefaults)
38 | {
39 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionRange;
40 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameRange;
41 | BarsRequiredToPlot = 0;
42 | IsSuspendedWhileInactive = true;
43 |
44 | AddPlot(new Stroke(Brushes.Goldenrod, 2), PlotStyle.Bar, NinjaTrader.Custom.Resource.RangeValue);
45 | }
46 | }
47 |
48 | protected override void OnBarUpdate()
49 | {
50 | Value[0] = High[0] - Low[0];
51 | }
52 | }
53 | }
54 |
55 | #region NinjaScript generated code. Neither change nor remove.
56 |
57 | namespace NinjaTrader.NinjaScript.Indicators
58 | {
59 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
60 | {
61 | private Range[] cacheRange;
62 | public Range Range()
63 | {
64 | return Range(Input);
65 | }
66 |
67 | public Range Range(ISeries input)
68 | {
69 | if (cacheRange != null)
70 | for (int idx = 0; idx < cacheRange.Length; idx++)
71 | if (cacheRange[idx] != null && cacheRange[idx].EqualsInput(input))
72 | return cacheRange[idx];
73 | return CacheIndicator(new Range(), input, ref cacheRange);
74 | }
75 | }
76 | }
77 |
78 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
79 | {
80 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
81 | {
82 | public Indicators.Range Range()
83 | {
84 | return indicator.Range(Input);
85 | }
86 |
87 | public Indicators.Range Range(ISeries input )
88 | {
89 | return indicator.Range(input);
90 | }
91 | }
92 | }
93 |
94 | namespace NinjaTrader.NinjaScript.Strategies
95 | {
96 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
97 | {
98 | public Indicators.Range Range()
99 | {
100 | return indicator.Range(Input);
101 | }
102 |
103 | public Indicators.Range Range(ISeries input )
104 | {
105 | return indicator.Range(input);
106 | }
107 | }
108 | }
109 |
110 | #endregion
111 |
--------------------------------------------------------------------------------
/Conversions/Indicators/IGTDSequential2/Indicators/@SMA.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2017, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// The SMA (Simple Moving Average) is an indicator that shows the average value of a security's price over a period of time.
32 | ///
33 | public class SMA : Indicator
34 | {
35 | private double priorSum;
36 | private double sum;
37 |
38 | protected override void OnStateChange()
39 | {
40 | if (State == State.SetDefaults)
41 | {
42 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionSMA;
43 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameSMA;
44 | IsOverlay = true;
45 | IsSuspendedWhileInactive = true;
46 | Period = 14;
47 |
48 | AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameSMA);
49 | }
50 | else if (State == State.Configure)
51 | {
52 | priorSum = 0;
53 | sum = 0;
54 | }
55 | }
56 |
57 | protected override void OnBarUpdate()
58 | {
59 | if (BarsArray[0].BarsType.IsRemoveLastBarSupported)
60 | {
61 | if (CurrentBar == 0)
62 | Value[0] = Input[0];
63 | else
64 | {
65 | double last = Value[1] * Math.Min(CurrentBar, Period);
66 |
67 | if (CurrentBar >= Period)
68 | Value[0] = (last + Input[0] - Input[Period]) / Math.Min(CurrentBar, Period);
69 | else
70 | Value[0] = ((last + Input[0]) / (Math.Min(CurrentBar, Period) + 1));
71 | }
72 | }
73 | else
74 | {
75 | if (IsFirstTickOfBar)
76 | priorSum = sum;
77 |
78 | sum = priorSum + Input[0] - (CurrentBar >= Period ? Input[Period] : 0);
79 | Value[0] = sum / (CurrentBar < Period ? CurrentBar + 1 : Period);
80 | }
81 | }
82 |
83 | #region Properties
84 | [Range(1, int.MaxValue), NinjaScriptProperty]
85 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
86 | public int Period
87 | { get; set; }
88 | #endregion
89 | }
90 | }
91 |
92 | #region NinjaScript generated code. Neither change nor remove.
93 |
94 | namespace NinjaTrader.NinjaScript.Indicators
95 | {
96 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
97 | {
98 | private SMA[] cacheSMA;
99 | public SMA SMA(int period)
100 | {
101 | return SMA(Input, period);
102 | }
103 |
104 | public SMA SMA(ISeries input, int period)
105 | {
106 | if (cacheSMA != null)
107 | for (int idx = 0; idx < cacheSMA.Length; idx++)
108 | if (cacheSMA[idx] != null && cacheSMA[idx].Period == period && cacheSMA[idx].EqualsInput(input))
109 | return cacheSMA[idx];
110 | return CacheIndicator(new SMA(){ Period = period }, input, ref cacheSMA);
111 | }
112 | }
113 | }
114 |
115 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
116 | {
117 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
118 | {
119 | public Indicators.SMA SMA(int period)
120 | {
121 | return indicator.SMA(Input, period);
122 | }
123 |
124 | public Indicators.SMA SMA(ISeries input , int period)
125 | {
126 | return indicator.SMA(input, period);
127 | }
128 | }
129 | }
130 |
131 | namespace NinjaTrader.NinjaScript.Strategies
132 | {
133 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
134 | {
135 | public Indicators.SMA SMA(int period)
136 | {
137 | return indicator.SMA(Input, period);
138 | }
139 |
140 | public Indicators.SMA SMA(ISeries input , int period)
141 | {
142 | return indicator.SMA(input, period);
143 | }
144 | }
145 | }
146 |
147 | #endregion
148 |
--------------------------------------------------------------------------------
/Conversions/Indicators/IGTDSequential2/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.9.0
5 |
6 |
--------------------------------------------------------------------------------
/Conversions/Indicators/IchimokouCloud/Indicators/@MAX.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2018, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// The Maximum shows the maximum of the last n bars.
32 | ///
33 | public class MAX : Indicator
34 | {
35 | private int lastBar;
36 | private double lastMax;
37 | private double runningMax;
38 | private int runningBar;
39 | private int thisBar;
40 |
41 | protected override void OnStateChange()
42 | {
43 | if (State == State.SetDefaults)
44 | {
45 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionMAX;
46 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameMAX;
47 | IsOverlay = true;
48 | IsSuspendedWhileInactive = true;
49 | Period = 14;
50 |
51 | AddPlot(Brushes.DarkCyan, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameMAX);
52 | }
53 | else if (State == State.Configure)
54 | {
55 | lastBar = 0;
56 | lastMax = 0;
57 | runningMax = 0;
58 | runningBar = 0;
59 | thisBar = 0;
60 | }
61 | }
62 |
63 | protected override void OnBarUpdate()
64 | {
65 | if (CurrentBar == 0)
66 | {
67 | runningMax = Input[0];
68 | lastMax = Input[0];
69 | runningBar = 0;
70 | lastBar = 0;
71 | thisBar = 0;
72 | Value[0] = Input[0];
73 | return;
74 | }
75 |
76 | if (CurrentBar - runningBar >= Period || CurrentBar < thisBar)
77 | {
78 | runningMax = double.MinValue;
79 | for (int barsBack = Math.Min(CurrentBar, Period - 1); barsBack > 0; barsBack--)
80 | if (Input[barsBack] >= runningMax)
81 | {
82 | runningMax = Input[barsBack];
83 | runningBar = CurrentBar - barsBack;
84 | }
85 | }
86 |
87 | if (thisBar != CurrentBar)
88 | {
89 | lastMax = runningMax;
90 | lastBar = runningBar;
91 | thisBar = CurrentBar;
92 | }
93 |
94 | if (Input[0] >= lastMax)
95 | {
96 | runningMax = Input[0];
97 | runningBar = CurrentBar;
98 | }
99 | else
100 | {
101 | runningMax = lastMax;
102 | runningBar = lastBar;
103 | }
104 |
105 | Value[0] = runningMax;
106 | }
107 |
108 | #region Properties
109 | [Range(1, int.MaxValue), NinjaScriptProperty]
110 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
111 | public int Period
112 | { get; set; }
113 | #endregion
114 | }
115 | }
116 |
117 | #region NinjaScript generated code. Neither change nor remove.
118 |
119 | namespace NinjaTrader.NinjaScript.Indicators
120 | {
121 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
122 | {
123 | private MAX[] cacheMAX;
124 | public MAX MAX(int period)
125 | {
126 | return MAX(Input, period);
127 | }
128 |
129 | public MAX MAX(ISeries input, int period)
130 | {
131 | if (cacheMAX != null)
132 | for (int idx = 0; idx < cacheMAX.Length; idx++)
133 | if (cacheMAX[idx] != null && cacheMAX[idx].Period == period && cacheMAX[idx].EqualsInput(input))
134 | return cacheMAX[idx];
135 | return CacheIndicator(new MAX(){ Period = period }, input, ref cacheMAX);
136 | }
137 | }
138 | }
139 |
140 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
141 | {
142 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
143 | {
144 | public Indicators.MAX MAX(int period)
145 | {
146 | return indicator.MAX(Input, period);
147 | }
148 |
149 | public Indicators.MAX MAX(ISeries input , int period)
150 | {
151 | return indicator.MAX(input, period);
152 | }
153 | }
154 | }
155 |
156 | namespace NinjaTrader.NinjaScript.Strategies
157 | {
158 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
159 | {
160 | public Indicators.MAX MAX(int period)
161 | {
162 | return indicator.MAX(Input, period);
163 | }
164 |
165 | public Indicators.MAX MAX(ISeries input , int period)
166 | {
167 | return indicator.MAX(input, period);
168 | }
169 | }
170 | }
171 |
172 | #endregion
173 |
--------------------------------------------------------------------------------
/Conversions/Indicators/IchimokouCloud/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.15.1
5 |
6 |
--------------------------------------------------------------------------------
/Conversions/Indicators/MACDZeroLagColors/Indicators/@EMA.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2018, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// Exponential Moving Average. The Exponential Moving Average is an indicator that
32 | /// shows the average value of a security's price over a period of time. When calculating
33 | /// a moving average. The EMA applies more weight to recent prices than the SMA.
34 | ///
35 | public class EMA : Indicator
36 | {
37 | private double constant1;
38 | private double constant2;
39 |
40 | protected override void OnStateChange()
41 | {
42 | if (State == State.SetDefaults)
43 | {
44 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionEMA;
45 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameEMA;
46 | IsOverlay = true;
47 | IsSuspendedWhileInactive = true;
48 | Period = 14;
49 |
50 | AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameEMA);
51 | }
52 | else if (State == State.Configure)
53 | {
54 | constant1 = 2.0 / (1 + Period);
55 | constant2 = 1 - (2.0 / (1 + Period));
56 | }
57 | }
58 |
59 | protected override void OnBarUpdate()
60 | {
61 | Value[0] = (CurrentBar == 0 ? Input[0] : Input[0] * constant1 + constant2 * Value[1]);
62 | }
63 |
64 | #region Properties
65 | [Range(1, int.MaxValue), NinjaScriptProperty]
66 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
67 | public int Period
68 | { get; set; }
69 | #endregion
70 | }
71 | }
72 |
73 | #region NinjaScript generated code. Neither change nor remove.
74 |
75 | namespace NinjaTrader.NinjaScript.Indicators
76 | {
77 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
78 | {
79 | private EMA[] cacheEMA;
80 | public EMA EMA(int period)
81 | {
82 | return EMA(Input, period);
83 | }
84 |
85 | public EMA EMA(ISeries input, int period)
86 | {
87 | if (cacheEMA != null)
88 | for (int idx = 0; idx < cacheEMA.Length; idx++)
89 | if (cacheEMA[idx] != null && cacheEMA[idx].Period == period && cacheEMA[idx].EqualsInput(input))
90 | return cacheEMA[idx];
91 | return CacheIndicator(new EMA(){ Period = period }, input, ref cacheEMA);
92 | }
93 | }
94 | }
95 |
96 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
97 | {
98 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
99 | {
100 | public Indicators.EMA EMA(int period)
101 | {
102 | return indicator.EMA(Input, period);
103 | }
104 |
105 | public Indicators.EMA EMA(ISeries input , int period)
106 | {
107 | return indicator.EMA(input, period);
108 | }
109 | }
110 | }
111 |
112 | namespace NinjaTrader.NinjaScript.Strategies
113 | {
114 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
115 | {
116 | public Indicators.EMA EMA(int period)
117 | {
118 | return indicator.EMA(Input, period);
119 | }
120 |
121 | public Indicators.EMA EMA(ISeries input , int period)
122 | {
123 | return indicator.EMA(input, period);
124 | }
125 | }
126 | }
127 |
128 | #endregion
129 |
--------------------------------------------------------------------------------
/Conversions/Indicators/MACDZeroLagColors/Indicators/ZeroLagEMA.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 ZeroLagEMA : Indicator
28 | {
29 | private EMA ema1, ema2;
30 | protected override void OnStateChange()
31 | {
32 | if (State == State.SetDefaults)
33 | {
34 | Description = @"Zero-Lagging Exponential Moving Average";
35 | Name = "ZeroLagEMA";
36 | Calculate = Calculate.OnBarClose;
37 | IsOverlay = true;
38 | DisplayInDataBox = true;
39 | DrawOnPricePanel = true;
40 | DrawHorizontalGridLines = true;
41 | DrawVerticalGridLines = true;
42 | PaintPriceMarkers = true;
43 | ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
44 | //Disable this property if your indicator requires custom values that cumulate with each new market data event.
45 | //See Help Guide for additional information.
46 | IsSuspendedWhileInactive = true;
47 | Period = 20;
48 | AddPlot(Brushes.OrangeRed, "ZLEMA");
49 | }
50 | else if (State == State.DataLoaded)
51 | {
52 | ema1 = EMA(Input, Period);
53 | ema2 = EMA(ema1, Period);
54 | }
55 | }
56 |
57 | protected override void OnBarUpdate()
58 | {
59 | ZLEMA[0] = 2 * ema1[0] - ema2[0];
60 | }
61 |
62 | #region Properties
63 | [NinjaScriptProperty]
64 | [Range(1, int.MaxValue)]
65 | [Display(Name="Period", Order=1, GroupName="Parameters")]
66 | public int Period
67 | { get; set; }
68 |
69 | [Browsable(false)]
70 | [XmlIgnore]
71 | public Series ZLEMA
72 | {
73 | get { return Values[0]; }
74 | }
75 | #endregion
76 |
77 | }
78 | }
79 |
80 | #region NinjaScript generated code. Neither change nor remove.
81 |
82 | namespace NinjaTrader.NinjaScript.Indicators
83 | {
84 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
85 | {
86 | private ZeroLagEMA[] cacheZeroLagEMA;
87 | public ZeroLagEMA ZeroLagEMA(int period)
88 | {
89 | return ZeroLagEMA(Input, period);
90 | }
91 |
92 | public ZeroLagEMA ZeroLagEMA(ISeries input, int period)
93 | {
94 | if (cacheZeroLagEMA != null)
95 | for (int idx = 0; idx < cacheZeroLagEMA.Length; idx++)
96 | if (cacheZeroLagEMA[idx] != null && cacheZeroLagEMA[idx].Period == period && cacheZeroLagEMA[idx].EqualsInput(input))
97 | return cacheZeroLagEMA[idx];
98 | return CacheIndicator(new ZeroLagEMA(){ Period = period }, input, ref cacheZeroLagEMA);
99 | }
100 | }
101 | }
102 |
103 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
104 | {
105 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
106 | {
107 | public Indicators.ZeroLagEMA ZeroLagEMA(int period)
108 | {
109 | return indicator.ZeroLagEMA(Input, period);
110 | }
111 |
112 | public Indicators.ZeroLagEMA ZeroLagEMA(ISeries input , int period)
113 | {
114 | return indicator.ZeroLagEMA(input, period);
115 | }
116 | }
117 | }
118 |
119 | namespace NinjaTrader.NinjaScript.Strategies
120 | {
121 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
122 | {
123 | public Indicators.ZeroLagEMA ZeroLagEMA(int period)
124 | {
125 | return indicator.ZeroLagEMA(Input, period);
126 | }
127 |
128 | public Indicators.ZeroLagEMA ZeroLagEMA(ISeries input , int period)
129 | {
130 | return indicator.ZeroLagEMA(input, period);
131 | }
132 | }
133 | }
134 |
135 | #endregion
136 |
--------------------------------------------------------------------------------
/Conversions/Indicators/MACDZeroLagColors/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.16.3
5 |
6 |
--------------------------------------------------------------------------------
/Conversions/Indicators/SRM/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.9.0
5 |
6 |
--------------------------------------------------------------------------------
/Conversions/Indicators/SwamiStochastics/Indicators/@MAX.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2017, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// The Maximum shows the maximum of the last n bars.
32 | ///
33 | public class MAX : Indicator
34 | {
35 | private int lastBar;
36 | private double lastMax;
37 | private double runningMax;
38 | private int runningBar;
39 | private int thisBar;
40 |
41 | protected override void OnStateChange()
42 | {
43 | if (State == State.SetDefaults)
44 | {
45 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionMAX;
46 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameMAX;
47 | IsOverlay = true;
48 | IsSuspendedWhileInactive = true;
49 | Period = 14;
50 |
51 | AddPlot(Brushes.DarkCyan, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameMAX);
52 | }
53 | else if (State == State.Configure)
54 | {
55 | lastBar = 0;
56 | lastMax = 0;
57 | runningMax = 0;
58 | runningBar = 0;
59 | thisBar = 0;
60 | }
61 | }
62 |
63 | protected override void OnBarUpdate()
64 | {
65 | if (CurrentBar == 0)
66 | {
67 | runningMax = Input[0];
68 | lastMax = Input[0];
69 | runningBar = 0;
70 | lastBar = 0;
71 | thisBar = 0;
72 | Value[0] = Input[0];
73 | return;
74 | }
75 |
76 | if (CurrentBar - runningBar >= Period || CurrentBar < thisBar)
77 | {
78 | runningMax = double.MinValue;
79 | for (int barsBack = Math.Min(CurrentBar, Period - 1); barsBack > 0; barsBack--)
80 | if (Input[barsBack] >= runningMax)
81 | {
82 | runningMax = Input[barsBack];
83 | runningBar = CurrentBar - barsBack;
84 | }
85 | }
86 |
87 | if (thisBar != CurrentBar)
88 | {
89 | lastMax = runningMax;
90 | lastBar = runningBar;
91 | thisBar = CurrentBar;
92 | }
93 |
94 | if (Input[0] >= lastMax)
95 | {
96 | runningMax = Input[0];
97 | runningBar = CurrentBar;
98 | }
99 | else
100 | {
101 | runningMax = lastMax;
102 | runningBar = lastBar;
103 | }
104 |
105 | Value[0] = runningMax;
106 | }
107 |
108 | #region Properties
109 | [Range(1, int.MaxValue), NinjaScriptProperty]
110 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
111 | public int Period
112 | { get; set; }
113 | #endregion
114 | }
115 | }
116 |
117 | #region NinjaScript generated code. Neither change nor remove.
118 |
119 | namespace NinjaTrader.NinjaScript.Indicators
120 | {
121 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
122 | {
123 | private MAX[] cacheMAX;
124 | public MAX MAX(int period)
125 | {
126 | return MAX(Input, period);
127 | }
128 |
129 | public MAX MAX(ISeries input, int period)
130 | {
131 | if (cacheMAX != null)
132 | for (int idx = 0; idx < cacheMAX.Length; idx++)
133 | if (cacheMAX[idx] != null && cacheMAX[idx].Period == period && cacheMAX[idx].EqualsInput(input))
134 | return cacheMAX[idx];
135 | return CacheIndicator(new MAX(){ Period = period }, input, ref cacheMAX);
136 | }
137 | }
138 | }
139 |
140 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
141 | {
142 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
143 | {
144 | public Indicators.MAX MAX(int period)
145 | {
146 | return indicator.MAX(Input, period);
147 | }
148 |
149 | public Indicators.MAX MAX(ISeries input , int period)
150 | {
151 | return indicator.MAX(input, period);
152 | }
153 | }
154 | }
155 |
156 | namespace NinjaTrader.NinjaScript.Strategies
157 | {
158 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
159 | {
160 | public Indicators.MAX MAX(int period)
161 | {
162 | return indicator.MAX(Input, period);
163 | }
164 |
165 | public Indicators.MAX MAX(ISeries input , int period)
166 | {
167 | return indicator.MAX(input, period);
168 | }
169 | }
170 | }
171 |
172 | #endregion
173 |
--------------------------------------------------------------------------------
/Conversions/Indicators/SwamiStochastics/Indicators/@SMA.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2017, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// The SMA (Simple Moving Average) is an indicator that shows the average value of a security's price over a period of time.
32 | ///
33 | public class SMA : Indicator
34 | {
35 | private double priorSum;
36 | private double sum;
37 |
38 | protected override void OnStateChange()
39 | {
40 | if (State == State.SetDefaults)
41 | {
42 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionSMA;
43 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameSMA;
44 | IsOverlay = true;
45 | IsSuspendedWhileInactive = true;
46 | Period = 14;
47 |
48 | AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameSMA);
49 | }
50 | else if (State == State.Configure)
51 | {
52 | priorSum = 0;
53 | sum = 0;
54 | }
55 | }
56 |
57 | protected override void OnBarUpdate()
58 | {
59 | if (BarsArray[0].BarsType.IsRemoveLastBarSupported)
60 | {
61 | if (CurrentBar == 0)
62 | Value[0] = Input[0];
63 | else
64 | {
65 | double last = Value[1] * Math.Min(CurrentBar, Period);
66 |
67 | if (CurrentBar >= Period)
68 | Value[0] = (last + Input[0] - Input[Period]) / Math.Min(CurrentBar, Period);
69 | else
70 | Value[0] = ((last + Input[0]) / (Math.Min(CurrentBar, Period) + 1));
71 | }
72 | }
73 | else
74 | {
75 | if (IsFirstTickOfBar)
76 | priorSum = sum;
77 |
78 | sum = priorSum + Input[0] - (CurrentBar >= Period ? Input[Period] : 0);
79 | Value[0] = sum / (CurrentBar < Period ? CurrentBar + 1 : Period);
80 | }
81 | }
82 |
83 | #region Properties
84 | [Range(1, int.MaxValue), NinjaScriptProperty]
85 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
86 | public int Period
87 | { get; set; }
88 | #endregion
89 | }
90 | }
91 |
92 | #region NinjaScript generated code. Neither change nor remove.
93 |
94 | namespace NinjaTrader.NinjaScript.Indicators
95 | {
96 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
97 | {
98 | private SMA[] cacheSMA;
99 | public SMA SMA(int period)
100 | {
101 | return SMA(Input, period);
102 | }
103 |
104 | public SMA SMA(ISeries input, int period)
105 | {
106 | if (cacheSMA != null)
107 | for (int idx = 0; idx < cacheSMA.Length; idx++)
108 | if (cacheSMA[idx] != null && cacheSMA[idx].Period == period && cacheSMA[idx].EqualsInput(input))
109 | return cacheSMA[idx];
110 | return CacheIndicator(new SMA(){ Period = period }, input, ref cacheSMA);
111 | }
112 | }
113 | }
114 |
115 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
116 | {
117 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
118 | {
119 | public Indicators.SMA SMA(int period)
120 | {
121 | return indicator.SMA(Input, period);
122 | }
123 |
124 | public Indicators.SMA SMA(ISeries input , int period)
125 | {
126 | return indicator.SMA(input, period);
127 | }
128 | }
129 | }
130 |
131 | namespace NinjaTrader.NinjaScript.Strategies
132 | {
133 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
134 | {
135 | public Indicators.SMA SMA(int period)
136 | {
137 | return indicator.SMA(Input, period);
138 | }
139 |
140 | public Indicators.SMA SMA(ISeries input , int period)
141 | {
142 | return indicator.SMA(input, period);
143 | }
144 | }
145 | }
146 |
147 | #endregion
148 |
--------------------------------------------------------------------------------
/Conversions/Indicators/SwamiStochastics/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.9.0
5 |
6 |
--------------------------------------------------------------------------------
/Conversions/Indicators/SwamiWave/Indicators/@MAX.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2017, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// The Maximum shows the maximum of the last n bars.
32 | ///
33 | public class MAX : Indicator
34 | {
35 | private int lastBar;
36 | private double lastMax;
37 | private double runningMax;
38 | private int runningBar;
39 | private int thisBar;
40 |
41 | protected override void OnStateChange()
42 | {
43 | if (State == State.SetDefaults)
44 | {
45 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionMAX;
46 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameMAX;
47 | IsOverlay = true;
48 | IsSuspendedWhileInactive = true;
49 | Period = 14;
50 |
51 | AddPlot(Brushes.DarkCyan, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameMAX);
52 | }
53 | else if (State == State.Configure)
54 | {
55 | lastBar = 0;
56 | lastMax = 0;
57 | runningMax = 0;
58 | runningBar = 0;
59 | thisBar = 0;
60 | }
61 | }
62 |
63 | protected override void OnBarUpdate()
64 | {
65 | if (CurrentBar == 0)
66 | {
67 | runningMax = Input[0];
68 | lastMax = Input[0];
69 | runningBar = 0;
70 | lastBar = 0;
71 | thisBar = 0;
72 | Value[0] = Input[0];
73 | return;
74 | }
75 |
76 | if (CurrentBar - runningBar >= Period || CurrentBar < thisBar)
77 | {
78 | runningMax = double.MinValue;
79 | for (int barsBack = Math.Min(CurrentBar, Period - 1); barsBack > 0; barsBack--)
80 | if (Input[barsBack] >= runningMax)
81 | {
82 | runningMax = Input[barsBack];
83 | runningBar = CurrentBar - barsBack;
84 | }
85 | }
86 |
87 | if (thisBar != CurrentBar)
88 | {
89 | lastMax = runningMax;
90 | lastBar = runningBar;
91 | thisBar = CurrentBar;
92 | }
93 |
94 | if (Input[0] >= lastMax)
95 | {
96 | runningMax = Input[0];
97 | runningBar = CurrentBar;
98 | }
99 | else
100 | {
101 | runningMax = lastMax;
102 | runningBar = lastBar;
103 | }
104 |
105 | Value[0] = runningMax;
106 | }
107 |
108 | #region Properties
109 | [Range(1, int.MaxValue), NinjaScriptProperty]
110 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
111 | public int Period
112 | { get; set; }
113 | #endregion
114 | }
115 | }
116 |
117 | #region NinjaScript generated code. Neither change nor remove.
118 |
119 | namespace NinjaTrader.NinjaScript.Indicators
120 | {
121 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
122 | {
123 | private MAX[] cacheMAX;
124 | public MAX MAX(int period)
125 | {
126 | return MAX(Input, period);
127 | }
128 |
129 | public MAX MAX(ISeries input, int period)
130 | {
131 | if (cacheMAX != null)
132 | for (int idx = 0; idx < cacheMAX.Length; idx++)
133 | if (cacheMAX[idx] != null && cacheMAX[idx].Period == period && cacheMAX[idx].EqualsInput(input))
134 | return cacheMAX[idx];
135 | return CacheIndicator(new MAX(){ Period = period }, input, ref cacheMAX);
136 | }
137 | }
138 | }
139 |
140 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
141 | {
142 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
143 | {
144 | public Indicators.MAX MAX(int period)
145 | {
146 | return indicator.MAX(Input, period);
147 | }
148 |
149 | public Indicators.MAX MAX(ISeries input , int period)
150 | {
151 | return indicator.MAX(input, period);
152 | }
153 | }
154 | }
155 |
156 | namespace NinjaTrader.NinjaScript.Strategies
157 | {
158 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
159 | {
160 | public Indicators.MAX MAX(int period)
161 | {
162 | return indicator.MAX(Input, period);
163 | }
164 |
165 | public Indicators.MAX MAX(ISeries input , int period)
166 | {
167 | return indicator.MAX(input, period);
168 | }
169 | }
170 | }
171 |
172 | #endregion
173 |
--------------------------------------------------------------------------------
/Conversions/Indicators/SwamiWave/Indicators/@MIN.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2017, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// The Minimum shows the minimum of the last n bars.
32 | ///
33 | public class MIN : Indicator
34 | {
35 | private int lastBar;
36 | private double lastMin;
37 | private double runningMin;
38 | private int runningBar;
39 | private int thisBar;
40 |
41 | protected override void OnStateChange()
42 | {
43 | if (State == State.SetDefaults)
44 | {
45 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionMIN;
46 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameMIN;
47 | IsOverlay = true;
48 | IsSuspendedWhileInactive = true;
49 | Period = 14;
50 |
51 | AddPlot(Brushes.DarkCyan, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameMIN);
52 | }
53 | else if (State == State.Configure)
54 | {
55 | lastBar = 0;
56 | lastMin = 0;
57 | runningMin = 0;
58 | runningBar = 0;
59 | thisBar = 0;
60 | }
61 | }
62 |
63 | protected override void OnBarUpdate()
64 | {
65 | if (CurrentBar == 0)
66 | {
67 | runningMin = Input[0];
68 | lastMin = Input[0];
69 | runningBar = 0;
70 | lastBar = 0;
71 | thisBar = 0;
72 | Value[0] = Input[0];
73 | return;
74 | }
75 |
76 | if (CurrentBar - runningBar >= Period || CurrentBar < thisBar)
77 | {
78 | runningMin = double.MaxValue;
79 | for (int barsBack = Math.Min(CurrentBar, Period - 1); barsBack > 0; barsBack--)
80 | if (Input[barsBack] <= runningMin)
81 | {
82 | runningMin = Input[barsBack];
83 | runningBar = CurrentBar - barsBack;
84 | }
85 | }
86 |
87 | if (thisBar != CurrentBar)
88 | {
89 | lastMin = runningMin;
90 | lastBar = runningBar;
91 | thisBar = CurrentBar;
92 | }
93 |
94 | if (Input[0] <= lastMin)
95 | {
96 | runningMin = Input[0];
97 | runningBar = CurrentBar;
98 | }
99 | else
100 | {
101 | runningMin = lastMin;
102 | runningBar = lastBar;
103 | }
104 |
105 | Value[0] = runningMin;
106 | }
107 |
108 | #region Properties
109 | [Range(1, int.MaxValue), NinjaScriptProperty]
110 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
111 | public int Period
112 | { get; set; }
113 | #endregion
114 | }
115 | }
116 |
117 | #region NinjaScript generated code. Neither change nor remove.
118 |
119 | namespace NinjaTrader.NinjaScript.Indicators
120 | {
121 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
122 | {
123 | private MIN[] cacheMIN;
124 | public MIN MIN(int period)
125 | {
126 | return MIN(Input, period);
127 | }
128 |
129 | public MIN MIN(ISeries input, int period)
130 | {
131 | if (cacheMIN != null)
132 | for (int idx = 0; idx < cacheMIN.Length; idx++)
133 | if (cacheMIN[idx] != null && cacheMIN[idx].Period == period && cacheMIN[idx].EqualsInput(input))
134 | return cacheMIN[idx];
135 | return CacheIndicator(new MIN(){ Period = period }, input, ref cacheMIN);
136 | }
137 | }
138 | }
139 |
140 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
141 | {
142 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
143 | {
144 | public Indicators.MIN MIN(int period)
145 | {
146 | return indicator.MIN(Input, period);
147 | }
148 |
149 | public Indicators.MIN MIN(ISeries input , int period)
150 | {
151 | return indicator.MIN(input, period);
152 | }
153 | }
154 | }
155 |
156 | namespace NinjaTrader.NinjaScript.Strategies
157 | {
158 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
159 | {
160 | public Indicators.MIN MIN(int period)
161 | {
162 | return indicator.MIN(Input, period);
163 | }
164 |
165 | public Indicators.MIN MIN(ISeries input , int period)
166 | {
167 | return indicator.MIN(input, period);
168 | }
169 | }
170 | }
171 |
172 | #endregion
173 |
--------------------------------------------------------------------------------
/Conversions/Indicators/SwamiWave/Indicators/@SMA.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2017, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// The SMA (Simple Moving Average) is an indicator that shows the average value of a security's price over a period of time.
32 | ///
33 | public class SMA : Indicator
34 | {
35 | private double priorSum;
36 | private double sum;
37 |
38 | protected override void OnStateChange()
39 | {
40 | if (State == State.SetDefaults)
41 | {
42 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionSMA;
43 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameSMA;
44 | IsOverlay = true;
45 | IsSuspendedWhileInactive = true;
46 | Period = 14;
47 |
48 | AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameSMA);
49 | }
50 | else if (State == State.Configure)
51 | {
52 | priorSum = 0;
53 | sum = 0;
54 | }
55 | }
56 |
57 | protected override void OnBarUpdate()
58 | {
59 | if (BarsArray[0].BarsType.IsRemoveLastBarSupported)
60 | {
61 | if (CurrentBar == 0)
62 | Value[0] = Input[0];
63 | else
64 | {
65 | double last = Value[1] * Math.Min(CurrentBar, Period);
66 |
67 | if (CurrentBar >= Period)
68 | Value[0] = (last + Input[0] - Input[Period]) / Math.Min(CurrentBar, Period);
69 | else
70 | Value[0] = ((last + Input[0]) / (Math.Min(CurrentBar, Period) + 1));
71 | }
72 | }
73 | else
74 | {
75 | if (IsFirstTickOfBar)
76 | priorSum = sum;
77 |
78 | sum = priorSum + Input[0] - (CurrentBar >= Period ? Input[Period] : 0);
79 | Value[0] = sum / (CurrentBar < Period ? CurrentBar + 1 : Period);
80 | }
81 | }
82 |
83 | #region Properties
84 | [Range(1, int.MaxValue), NinjaScriptProperty]
85 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
86 | public int Period
87 | { get; set; }
88 | #endregion
89 | }
90 | }
91 |
92 | #region NinjaScript generated code. Neither change nor remove.
93 |
94 | namespace NinjaTrader.NinjaScript.Indicators
95 | {
96 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
97 | {
98 | private SMA[] cacheSMA;
99 | public SMA SMA(int period)
100 | {
101 | return SMA(Input, period);
102 | }
103 |
104 | public SMA SMA(ISeries input, int period)
105 | {
106 | if (cacheSMA != null)
107 | for (int idx = 0; idx < cacheSMA.Length; idx++)
108 | if (cacheSMA[idx] != null && cacheSMA[idx].Period == period && cacheSMA[idx].EqualsInput(input))
109 | return cacheSMA[idx];
110 | return CacheIndicator(new SMA(){ Period = period }, input, ref cacheSMA);
111 | }
112 | }
113 | }
114 |
115 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
116 | {
117 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
118 | {
119 | public Indicators.SMA SMA(int period)
120 | {
121 | return indicator.SMA(Input, period);
122 | }
123 |
124 | public Indicators.SMA SMA(ISeries input , int period)
125 | {
126 | return indicator.SMA(input, period);
127 | }
128 | }
129 | }
130 |
131 | namespace NinjaTrader.NinjaScript.Strategies
132 | {
133 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
134 | {
135 | public Indicators.SMA SMA(int period)
136 | {
137 | return indicator.SMA(Input, period);
138 | }
139 |
140 | public Indicators.SMA SMA(ISeries input , int period)
141 | {
142 | return indicator.SMA(input, period);
143 | }
144 | }
145 | }
146 |
147 | #endregion
148 |
--------------------------------------------------------------------------------
/Conversions/Indicators/SwamiWave/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.9.0
5 |
6 |
--------------------------------------------------------------------------------
/Conversions/Indicators/VWEMACDHistogram_NT8/Indicators/@EMA.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2018, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// Exponential Moving Average. The Exponential Moving Average is an indicator that
32 | /// shows the average value of a security's price over a period of time. When calculating
33 | /// a moving average. The EMA applies more weight to recent prices than the SMA.
34 | ///
35 | public class EMA : Indicator
36 | {
37 | private double constant1;
38 | private double constant2;
39 |
40 | protected override void OnStateChange()
41 | {
42 | if (State == State.SetDefaults)
43 | {
44 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionEMA;
45 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameEMA;
46 | IsOverlay = true;
47 | IsSuspendedWhileInactive = true;
48 | Period = 14;
49 |
50 | AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameEMA);
51 | }
52 | else if (State == State.Configure)
53 | {
54 | constant1 = 2.0 / (1 + Period);
55 | constant2 = 1 - (2.0 / (1 + Period));
56 | }
57 | }
58 |
59 | protected override void OnBarUpdate()
60 | {
61 | Value[0] = (CurrentBar == 0 ? Input[0] : Input[0] * constant1 + constant2 * Value[1]);
62 | }
63 |
64 | #region Properties
65 | [Range(1, int.MaxValue), NinjaScriptProperty]
66 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
67 | public int Period
68 | { get; set; }
69 | #endregion
70 | }
71 | }
72 |
73 | #region NinjaScript generated code. Neither change nor remove.
74 |
75 | namespace NinjaTrader.NinjaScript.Indicators
76 | {
77 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
78 | {
79 | private EMA[] cacheEMA;
80 | public EMA EMA(int period)
81 | {
82 | return EMA(Input, period);
83 | }
84 |
85 | public EMA EMA(ISeries input, int period)
86 | {
87 | if (cacheEMA != null)
88 | for (int idx = 0; idx < cacheEMA.Length; idx++)
89 | if (cacheEMA[idx] != null && cacheEMA[idx].Period == period && cacheEMA[idx].EqualsInput(input))
90 | return cacheEMA[idx];
91 | return CacheIndicator(new EMA(){ Period = period }, input, ref cacheEMA);
92 | }
93 | }
94 | }
95 |
96 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
97 | {
98 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
99 | {
100 | public Indicators.EMA EMA(int period)
101 | {
102 | return indicator.EMA(Input, period);
103 | }
104 |
105 | public Indicators.EMA EMA(ISeries input , int period)
106 | {
107 | return indicator.EMA(input, period);
108 | }
109 | }
110 | }
111 |
112 | namespace NinjaTrader.NinjaScript.Strategies
113 | {
114 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
115 | {
116 | public Indicators.EMA EMA(int period)
117 | {
118 | return indicator.EMA(Input, period);
119 | }
120 |
121 | public Indicators.EMA EMA(ISeries input , int period)
122 | {
123 | return indicator.EMA(input, period);
124 | }
125 | }
126 | }
127 |
128 | #endregion
129 |
--------------------------------------------------------------------------------
/Conversions/Indicators/VWEMACDHistogram_NT8/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.13.1
5 |
6 |
--------------------------------------------------------------------------------
/Conversions/Indicators/VolumePriceConfirmationVPCI_NT8/Indicators/@SMA.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2018, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// The SMA (Simple Moving Average) is an indicator that shows the average value of a security's price over a period of time.
32 | ///
33 | public class SMA : Indicator
34 | {
35 | private double priorSum;
36 | private double sum;
37 |
38 | protected override void OnStateChange()
39 | {
40 | if (State == State.SetDefaults)
41 | {
42 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionSMA;
43 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameSMA;
44 | IsOverlay = true;
45 | IsSuspendedWhileInactive = true;
46 | Period = 14;
47 |
48 | AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameSMA);
49 | }
50 | else if (State == State.Configure)
51 | {
52 | priorSum = 0;
53 | sum = 0;
54 | }
55 | }
56 |
57 | protected override void OnBarUpdate()
58 | {
59 | if (BarsArray[0].BarsType.IsRemoveLastBarSupported)
60 | {
61 | if (CurrentBar == 0)
62 | Value[0] = Input[0];
63 | else
64 | {
65 | double last = Value[1] * Math.Min(CurrentBar, Period);
66 |
67 | if (CurrentBar >= Period)
68 | Value[0] = (last + Input[0] - Input[Period]) / Math.Min(CurrentBar, Period);
69 | else
70 | Value[0] = ((last + Input[0]) / (Math.Min(CurrentBar, Period) + 1));
71 | }
72 | }
73 | else
74 | {
75 | if (IsFirstTickOfBar)
76 | priorSum = sum;
77 |
78 | sum = priorSum + Input[0] - (CurrentBar >= Period ? Input[Period] : 0);
79 | Value[0] = sum / (CurrentBar < Period ? CurrentBar + 1 : Period);
80 | }
81 | }
82 |
83 | #region Properties
84 | [Range(1, int.MaxValue), NinjaScriptProperty]
85 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
86 | public int Period
87 | { get; set; }
88 | #endregion
89 | }
90 | }
91 |
92 | #region NinjaScript generated code. Neither change nor remove.
93 |
94 | namespace NinjaTrader.NinjaScript.Indicators
95 | {
96 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
97 | {
98 | private SMA[] cacheSMA;
99 | public SMA SMA(int period)
100 | {
101 | return SMA(Input, period);
102 | }
103 |
104 | public SMA SMA(ISeries input, int period)
105 | {
106 | if (cacheSMA != null)
107 | for (int idx = 0; idx < cacheSMA.Length; idx++)
108 | if (cacheSMA[idx] != null && cacheSMA[idx].Period == period && cacheSMA[idx].EqualsInput(input))
109 | return cacheSMA[idx];
110 | return CacheIndicator(new SMA(){ Period = period }, input, ref cacheSMA);
111 | }
112 | }
113 | }
114 |
115 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
116 | {
117 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
118 | {
119 | public Indicators.SMA SMA(int period)
120 | {
121 | return indicator.SMA(Input, period);
122 | }
123 |
124 | public Indicators.SMA SMA(ISeries input , int period)
125 | {
126 | return indicator.SMA(input, period);
127 | }
128 | }
129 | }
130 |
131 | namespace NinjaTrader.NinjaScript.Strategies
132 | {
133 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
134 | {
135 | public Indicators.SMA SMA(int period)
136 | {
137 | return indicator.SMA(Input, period);
138 | }
139 |
140 | public Indicators.SMA SMA(ISeries input , int period)
141 | {
142 | return indicator.SMA(input, period);
143 | }
144 | }
145 | }
146 |
147 | #endregion
148 |
--------------------------------------------------------------------------------
/Conversions/Indicators/VolumePriceConfirmationVPCI_NT8/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.14.1
5 |
6 |
--------------------------------------------------------------------------------
/Conversions/Indicators/a1ChartNotes_NT8/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.13.1
5 |
6 |
--------------------------------------------------------------------------------
/Conversions/Indicators/dDrawABC_NT8/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.11.0
5 |
6 |
--------------------------------------------------------------------------------
/Conversions/Indicators/jtRangeMarker7_NT8/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.9.0
5 |
6 |
--------------------------------------------------------------------------------
/Conversions/Strategies/SveStochATS_NT8/Indicators/@SMA.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2017, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// The SMA (Simple Moving Average) is an indicator that shows the average value of a security's price over a period of time.
32 | ///
33 | public class SMA : Indicator
34 | {
35 | private double priorSum;
36 | private double sum;
37 |
38 | protected override void OnStateChange()
39 | {
40 | if (State == State.SetDefaults)
41 | {
42 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionSMA;
43 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameSMA;
44 | IsOverlay = true;
45 | IsSuspendedWhileInactive = true;
46 | Period = 14;
47 |
48 | AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameSMA);
49 | }
50 | else if (State == State.Configure)
51 | {
52 | priorSum = 0;
53 | sum = 0;
54 | }
55 | }
56 |
57 | protected override void OnBarUpdate()
58 | {
59 | if (BarsArray[0].BarsType.IsRemoveLastBarSupported)
60 | {
61 | if (CurrentBar == 0)
62 | Value[0] = Input[0];
63 | else
64 | {
65 | double last = Value[1] * Math.Min(CurrentBar, Period);
66 |
67 | if (CurrentBar >= Period)
68 | Value[0] = (last + Input[0] - Input[Period]) / Math.Min(CurrentBar, Period);
69 | else
70 | Value[0] = ((last + Input[0]) / (Math.Min(CurrentBar, Period) + 1));
71 | }
72 | }
73 | else
74 | {
75 | if (IsFirstTickOfBar)
76 | priorSum = sum;
77 |
78 | sum = priorSum + Input[0] - (CurrentBar >= Period ? Input[Period] : 0);
79 | Value[0] = sum / (CurrentBar < Period ? CurrentBar + 1 : Period);
80 | }
81 | }
82 |
83 | #region Properties
84 | [Range(1, int.MaxValue), NinjaScriptProperty]
85 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
86 | public int Period
87 | { get; set; }
88 | #endregion
89 | }
90 | }
91 |
92 | #region NinjaScript generated code. Neither change nor remove.
93 |
94 | namespace NinjaTrader.NinjaScript.Indicators
95 | {
96 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
97 | {
98 | private SMA[] cacheSMA;
99 | public SMA SMA(int period)
100 | {
101 | return SMA(Input, period);
102 | }
103 |
104 | public SMA SMA(ISeries input, int period)
105 | {
106 | if (cacheSMA != null)
107 | for (int idx = 0; idx < cacheSMA.Length; idx++)
108 | if (cacheSMA[idx] != null && cacheSMA[idx].Period == period && cacheSMA[idx].EqualsInput(input))
109 | return cacheSMA[idx];
110 | return CacheIndicator(new SMA(){ Period = period }, input, ref cacheSMA);
111 | }
112 | }
113 | }
114 |
115 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
116 | {
117 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
118 | {
119 | public Indicators.SMA SMA(int period)
120 | {
121 | return indicator.SMA(Input, period);
122 | }
123 |
124 | public Indicators.SMA SMA(ISeries input , int period)
125 | {
126 | return indicator.SMA(input, period);
127 | }
128 | }
129 | }
130 |
131 | namespace NinjaTrader.NinjaScript.Strategies
132 | {
133 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
134 | {
135 | public Indicators.SMA SMA(int period)
136 | {
137 | return indicator.SMA(Input, period);
138 | }
139 |
140 | public Indicators.SMA SMA(ISeries input , int period)
141 | {
142 | return indicator.SMA(input, period);
143 | }
144 | }
145 | }
146 |
147 | #endregion
148 |
--------------------------------------------------------------------------------
/Conversions/Strategies/SveStochATS_NT8/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.11.1
5 |
6 |
--------------------------------------------------------------------------------
/Conversions/Strategies/SveStochATS_NT8/Strategies/SveStochATS.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
27 | {
28 | public class SveStochATS : Strategy
29 | {
30 | protected override void OnStateChange()
31 | {
32 | if (State == State.SetDefaults)
33 | {
34 | Description = @"Stocks and Commodities - December 2011 - Applying The Put/Call Ratio Indicator";
35 | Name = "SveStochATS";
36 | Calculate = Calculate.OnBarClose;
37 | EntriesPerDirection = 1;
38 | EntryHandling = EntryHandling.AllEntries;
39 | IsExitOnSessionCloseStrategy = true;
40 | ExitOnSessionCloseSeconds = 30;
41 | IsFillLimitOnTouch = false;
42 | MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
43 | OrderFillResolution = OrderFillResolution.Standard;
44 | Slippage = 0;
45 | StartBehavior = StartBehavior.WaitUntilFlat;
46 | TimeInForce = TimeInForce.Gtc;
47 | TraceOrders = false;
48 | RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
49 | StopTargetHandling = StopTargetHandling.PerEntryExecution;
50 | BarsRequiredToTrade = 20;
51 | // Disable this property for performance gains in Strategy Analyzer optimizations
52 | // See the Help Guide for additional information
53 | IsInstantiatedOnEachOptimizationIteration = true;
54 | StochPeriod = 30;
55 | StochSlow = 5;
56 | }
57 | else if (State == State.Configure)
58 | {
59 | AddChartIndicator(SveStochIFT(StochPeriod, StochSlow));
60 | }
61 | }
62 |
63 | protected override void OnBarUpdate()
64 | {
65 | if (SveStochIFT(StochPeriod, StochSlow).IFTStoch[0] > 30)
66 | EnterLong();
67 |
68 | if (SveStochIFT(StochPeriod, StochSlow).IFTStoch[0] < 60 && Close[0] < SMA(165)[0])
69 | EnterShort();
70 |
71 | if (SveStochIFT(StochPeriod, StochSlow).IFTStoch[0] < 60)
72 | ExitLong();
73 | }
74 |
75 | #region Properties
76 | [NinjaScriptProperty]
77 | [Range(1, int.MaxValue)]
78 | [Display(Name="StochPeriod", Description="Number of bars used in the Stochastics calculation", Order=1, GroupName="Parameters")]
79 | public int StochPeriod
80 | { get; set; }
81 |
82 | [NinjaScriptProperty]
83 | [Range(1, int.MaxValue)]
84 | [Display(Name="StochSlow", Description="Number of bars used in stochastic smoothing", Order=2, GroupName="Parameters")]
85 | public int StochSlow
86 | { get; set; }
87 | #endregion
88 |
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/Conversions/Strategies/TradingTheLoonie/Indicators/@EMA.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2017, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// Exponential Moving Average. The Exponential Moving Average is an indicator that
32 | /// shows the average value of a security's price over a period of time. When calculating
33 | /// a moving average. The EMA applies more weight to recent prices than the SMA.
34 | ///
35 | public class EMA : Indicator
36 | {
37 | private double constant1;
38 | private double constant2;
39 |
40 | protected override void OnStateChange()
41 | {
42 | if (State == State.SetDefaults)
43 | {
44 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionEMA;
45 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameEMA;
46 | IsOverlay = true;
47 | IsSuspendedWhileInactive = true;
48 | Period = 14;
49 |
50 | AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameEMA);
51 | }
52 | else if (State == State.Configure)
53 | {
54 | constant1 = 2.0 / (1 + Period);
55 | constant2 = 1 - (2.0 / (1 + Period));
56 | }
57 | }
58 |
59 | protected override void OnBarUpdate()
60 | {
61 | Value[0] = (CurrentBar == 0 ? Input[0] : Input[0] * constant1 + constant2 * Value[1]);
62 | }
63 |
64 | #region Properties
65 | [Range(1, int.MaxValue), NinjaScriptProperty]
66 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
67 | public int Period
68 | { get; set; }
69 | #endregion
70 | }
71 | }
72 |
73 | #region NinjaScript generated code. Neither change nor remove.
74 |
75 | namespace NinjaTrader.NinjaScript.Indicators
76 | {
77 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
78 | {
79 | private EMA[] cacheEMA;
80 | public EMA EMA(int period)
81 | {
82 | return EMA(Input, period);
83 | }
84 |
85 | public EMA EMA(ISeries input, int period)
86 | {
87 | if (cacheEMA != null)
88 | for (int idx = 0; idx < cacheEMA.Length; idx++)
89 | if (cacheEMA[idx] != null && cacheEMA[idx].Period == period && cacheEMA[idx].EqualsInput(input))
90 | return cacheEMA[idx];
91 | return CacheIndicator(new EMA(){ Period = period }, input, ref cacheEMA);
92 | }
93 | }
94 | }
95 |
96 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
97 | {
98 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
99 | {
100 | public Indicators.EMA EMA(int period)
101 | {
102 | return indicator.EMA(Input, period);
103 | }
104 |
105 | public Indicators.EMA EMA(ISeries input , int period)
106 | {
107 | return indicator.EMA(input, period);
108 | }
109 | }
110 | }
111 |
112 | namespace NinjaTrader.NinjaScript.Strategies
113 | {
114 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
115 | {
116 | public Indicators.EMA EMA(int period)
117 | {
118 | return indicator.EMA(Input, period);
119 | }
120 |
121 | public Indicators.EMA EMA(ISeries input , int period)
122 | {
123 | return indicator.EMA(input, period);
124 | }
125 | }
126 | }
127 |
128 | #endregion
129 |
--------------------------------------------------------------------------------
/Conversions/Strategies/TradingTheLoonie/Indicators/@ROC.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2017, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// The ROC (Rate-of-Change) indicator displays the percent change between the current price and the price x-time periods ago.
32 | ///
33 | public class ROC : Indicator
34 | {
35 | protected override void OnStateChange()
36 | {
37 | if (State == State.SetDefaults)
38 | {
39 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionROC;
40 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameROC;
41 | IsSuspendedWhileInactive = true;
42 | Period = 14;
43 |
44 | AddLine(Brushes.DarkGray, 0, NinjaTrader.Custom.Resource.NinjaScriptIndicatorZeroLine);
45 | AddPlot(Brushes.DodgerBlue, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameROC);
46 | }
47 | }
48 |
49 | protected override void OnBarUpdate()
50 | {
51 | double inputPeriod = Input[Math.Min(CurrentBar, Period)];
52 | Value[0] = ((Input[0] - inputPeriod) / inputPeriod) * 100;
53 | }
54 |
55 | #region Properties
56 | [Range(1, int.MaxValue), NinjaScriptProperty]
57 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
58 | public int Period
59 | { get; set; }
60 | #endregion
61 | }
62 | }
63 |
64 | #region NinjaScript generated code. Neither change nor remove.
65 |
66 | namespace NinjaTrader.NinjaScript.Indicators
67 | {
68 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
69 | {
70 | private ROC[] cacheROC;
71 | public ROC ROC(int period)
72 | {
73 | return ROC(Input, period);
74 | }
75 |
76 | public ROC ROC(ISeries input, int period)
77 | {
78 | if (cacheROC != null)
79 | for (int idx = 0; idx < cacheROC.Length; idx++)
80 | if (cacheROC[idx] != null && cacheROC[idx].Period == period && cacheROC[idx].EqualsInput(input))
81 | return cacheROC[idx];
82 | return CacheIndicator(new ROC(){ Period = period }, input, ref cacheROC);
83 | }
84 | }
85 | }
86 |
87 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
88 | {
89 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
90 | {
91 | public Indicators.ROC ROC(int period)
92 | {
93 | return indicator.ROC(Input, period);
94 | }
95 |
96 | public Indicators.ROC ROC(ISeries input , int period)
97 | {
98 | return indicator.ROC(input, period);
99 | }
100 | }
101 | }
102 |
103 | namespace NinjaTrader.NinjaScript.Strategies
104 | {
105 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
106 | {
107 | public Indicators.ROC ROC(int period)
108 | {
109 | return indicator.ROC(Input, period);
110 | }
111 |
112 | public Indicators.ROC ROC(ISeries input , int period)
113 | {
114 | return indicator.ROC(input, period);
115 | }
116 | }
117 | }
118 |
119 | #endregion
120 |
--------------------------------------------------------------------------------
/Conversions/Strategies/TradingTheLoonie/Indicators/@SMA.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2017, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// The SMA (Simple Moving Average) is an indicator that shows the average value of a security's price over a period of time.
32 | ///
33 | public class SMA : Indicator
34 | {
35 | private double priorSum;
36 | private double sum;
37 |
38 | protected override void OnStateChange()
39 | {
40 | if (State == State.SetDefaults)
41 | {
42 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionSMA;
43 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameSMA;
44 | IsOverlay = true;
45 | IsSuspendedWhileInactive = true;
46 | Period = 14;
47 |
48 | AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameSMA);
49 | }
50 | else if (State == State.Configure)
51 | {
52 | priorSum = 0;
53 | sum = 0;
54 | }
55 | }
56 |
57 | protected override void OnBarUpdate()
58 | {
59 | if (BarsArray[0].BarsType.IsRemoveLastBarSupported)
60 | {
61 | if (CurrentBar == 0)
62 | Value[0] = Input[0];
63 | else
64 | {
65 | double last = Value[1] * Math.Min(CurrentBar, Period);
66 |
67 | if (CurrentBar >= Period)
68 | Value[0] = (last + Input[0] - Input[Period]) / Math.Min(CurrentBar, Period);
69 | else
70 | Value[0] = ((last + Input[0]) / (Math.Min(CurrentBar, Period) + 1));
71 | }
72 | }
73 | else
74 | {
75 | if (IsFirstTickOfBar)
76 | priorSum = sum;
77 |
78 | sum = priorSum + Input[0] - (CurrentBar >= Period ? Input[Period] : 0);
79 | Value[0] = sum / (CurrentBar < Period ? CurrentBar + 1 : Period);
80 | }
81 | }
82 |
83 | #region Properties
84 | [Range(1, int.MaxValue), NinjaScriptProperty]
85 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
86 | public int Period
87 | { get; set; }
88 | #endregion
89 | }
90 | }
91 |
92 | #region NinjaScript generated code. Neither change nor remove.
93 |
94 | namespace NinjaTrader.NinjaScript.Indicators
95 | {
96 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
97 | {
98 | private SMA[] cacheSMA;
99 | public SMA SMA(int period)
100 | {
101 | return SMA(Input, period);
102 | }
103 |
104 | public SMA SMA(ISeries input, int period)
105 | {
106 | if (cacheSMA != null)
107 | for (int idx = 0; idx < cacheSMA.Length; idx++)
108 | if (cacheSMA[idx] != null && cacheSMA[idx].Period == period && cacheSMA[idx].EqualsInput(input))
109 | return cacheSMA[idx];
110 | return CacheIndicator(new SMA(){ Period = period }, input, ref cacheSMA);
111 | }
112 | }
113 | }
114 |
115 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
116 | {
117 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
118 | {
119 | public Indicators.SMA SMA(int period)
120 | {
121 | return indicator.SMA(Input, period);
122 | }
123 |
124 | public Indicators.SMA SMA(ISeries input , int period)
125 | {
126 | return indicator.SMA(input, period);
127 | }
128 | }
129 | }
130 |
131 | namespace NinjaTrader.NinjaScript.Strategies
132 | {
133 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
134 | {
135 | public Indicators.SMA SMA(int period)
136 | {
137 | return indicator.SMA(Input, period);
138 | }
139 |
140 | public Indicators.SMA SMA(ISeries input , int period)
141 | {
142 | return indicator.SMA(input, period);
143 | }
144 | }
145 | }
146 |
147 | #endregion
148 |
--------------------------------------------------------------------------------
/Conversions/Strategies/TradingTheLoonie/Indicators/@StdDev.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2017, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// Standard Deviation is a statistical measure of volatility.
32 | /// Standard Deviation is typically used as a component of other indicators,
33 | /// rather than as a stand-alone indicator. For example, Bollinger Bands are
34 | /// calculated by adding a security's Standard Deviation to a moving average.
35 | ///
36 | public class StdDev : Indicator
37 | {
38 | private Series sumSeries;
39 |
40 | protected override void OnStateChange()
41 | {
42 | if (State == State.SetDefaults)
43 | {
44 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionStdDev;
45 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameStdDev;
46 | IsOverlay = false;
47 | IsSuspendedWhileInactive = true;
48 | Period = 14;
49 |
50 | AddPlot(Brushes.DarkCyan, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameStdDev);
51 | }
52 | else if (State == State.DataLoaded)
53 | {
54 | sumSeries = new Series(this, Period <= 256 ? MaximumBarsLookBack.TwoHundredFiftySix : MaximumBarsLookBack.Infinite);
55 | }
56 | }
57 |
58 | protected override void OnBarUpdate()
59 | {
60 | if (CurrentBar < 1)
61 | {
62 | Value[0] = 0;
63 | sumSeries[0] = Input[0];
64 | }
65 | else
66 | {
67 | sumSeries[0] = Input[0] + sumSeries[1] - (CurrentBar >= Period ? Input[Period] : 0);
68 | double avg = sumSeries[0] / Math.Min(CurrentBar + 1, Period);
69 | double sum = 0;
70 | for (int barsBack = Math.Min(CurrentBar, Period - 1); barsBack >= 0; barsBack--)
71 | sum += (Input[barsBack] - avg) * (Input[barsBack] - avg);
72 |
73 | Value[0] = Math.Sqrt(sum / Math.Min(CurrentBar + 1, Period));
74 | }
75 | }
76 |
77 | #region Properties
78 | [Range(1, int.MaxValue), NinjaScriptProperty]
79 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
80 | public int Period
81 | { get; set; }
82 | #endregion
83 | }
84 | }
85 |
86 | #region NinjaScript generated code. Neither change nor remove.
87 |
88 | namespace NinjaTrader.NinjaScript.Indicators
89 | {
90 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
91 | {
92 | private StdDev[] cacheStdDev;
93 | public StdDev StdDev(int period)
94 | {
95 | return StdDev(Input, period);
96 | }
97 |
98 | public StdDev StdDev(ISeries input, int period)
99 | {
100 | if (cacheStdDev != null)
101 | for (int idx = 0; idx < cacheStdDev.Length; idx++)
102 | if (cacheStdDev[idx] != null && cacheStdDev[idx].Period == period && cacheStdDev[idx].EqualsInput(input))
103 | return cacheStdDev[idx];
104 | return CacheIndicator(new StdDev(){ Period = period }, input, ref cacheStdDev);
105 | }
106 | }
107 | }
108 |
109 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
110 | {
111 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
112 | {
113 | public Indicators.StdDev StdDev(int period)
114 | {
115 | return indicator.StdDev(Input, period);
116 | }
117 |
118 | public Indicators.StdDev StdDev(ISeries input , int period)
119 | {
120 | return indicator.StdDev(input, period);
121 | }
122 | }
123 | }
124 |
125 | namespace NinjaTrader.NinjaScript.Strategies
126 | {
127 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
128 | {
129 | public Indicators.StdDev StdDev(int period)
130 | {
131 | return indicator.StdDev(Input, period);
132 | }
133 |
134 | public Indicators.StdDev StdDev(ISeries input , int period)
135 | {
136 | return indicator.StdDev(input, period);
137 | }
138 | }
139 | }
140 |
141 | #endregion
142 |
--------------------------------------------------------------------------------
/Conversions/Strategies/TradingTheLoonie/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.11.0
5 |
6 |
--------------------------------------------------------------------------------
/Conversions/Strategies/TradingTheLoonie/Strategies/TradingtheLoonie.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 |
24 | using Correlation;
25 | #endregion
26 |
27 | //This namespace holds Strategies in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Strategies
29 | {
30 | public class TradingtheLoonie : Strategy
31 | {
32 | private BollingerBandDivergence bbd;
33 |
34 | protected override void OnStateChange()
35 | {
36 | if (State == State.SetDefaults)
37 | {
38 | Description = @"Enter the description for your new custom Strategy here.";
39 | Name = "TradingtheLoonie";
40 | Calculate = Calculate.OnBarClose;
41 | EntriesPerDirection = 1;
42 | EntryHandling = EntryHandling.AllEntries;
43 | IsExitOnSessionCloseStrategy = true;
44 | ExitOnSessionCloseSeconds = 30;
45 | IsFillLimitOnTouch = false;
46 | MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
47 | OrderFillResolution = OrderFillResolution.Standard;
48 | Slippage = 0;
49 | StartBehavior = StartBehavior.WaitUntilFlat;
50 | TimeInForce = TimeInForce.Gtc;
51 | TraceOrders = false;
52 | RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
53 | StopTargetHandling = StopTargetHandling.PerEntryExecution;
54 | BarsRequiredToTrade = 20;
55 | // Disable this property for performance gains in Strategy Analyzer optimizations
56 | // See the Help Guide for additional information
57 | IsInstantiatedOnEachOptimizationIteration = true;
58 | }
59 | else if (State == State.Configure)
60 | {
61 | AddDataSeries("CL 01-18", BarsPeriodType.Day, 1);
62 | //AddDataSeries("CL 01-18", new BarsPeriod { BarsPeriodType = BarsPeriodType.Minute, Value = 1440 }, "Default 24 x 7");
63 | }
64 | else if (State == State.DataLoaded)
65 | {
66 | bbd = BollingerBandDivergence(20);
67 | AddChartIndicator(bbd);
68 | }
69 | }
70 |
71 | protected override void OnBarUpdate()
72 | {
73 | if (BarsPeriod.BarsPeriodType != BarsPeriodType.Day && !(BarsPeriod.BarsPeriodType == BarsPeriodType.Minute && BarsPeriod.Value == 1440))
74 | {
75 | Draw.TextFixed(this, "NinjaScriptInfo", "This strategy must be applied to a daily series", TextPosition.BottomRight);
76 | return;
77 | }
78 |
79 | if(CurrentBars[0] < 1 || CurrentBars[1] < 1)
80 | return;
81 |
82 | // BUY
83 | if (MAX(bbd, 3)[0] > 20
84 | && bbd[0] < bbd[1]
85 | && ROC(Closes[0], 2)[0] > 0
86 | && SMA(Closes[1], 40)[0] > SMA(Closes[1], 40)[2]
87 | && Correlation(Closes[0], 20, CorrelationType.Pearson, 0)[0] > -.4)
88 | {
89 | EnterLong();
90 | }
91 |
92 | // SELL
93 | if ((CrossAbove(EMA(MACD(12, 26, 9), 9), MACD(12, 26, 9), 1) && Stochastics(1, 30, 3).K[0] > 85)
94 | || (MIN(bbd, 3)[0] < -20 && ROC(Closes[1], 3)[0] < -3)
95 | || (Closes[0][0] < MIN(Low, 15)[1] && Correlation(Closes[0], 60, CorrelationType.Pearson, 0)[0] < -.4))
96 | {
97 | ExitLong();
98 | }
99 |
100 |
101 | // SELL SHORT
102 | if (MIN(bbd, 3)[0] < -20
103 | && bbd[0] > bbd[1]
104 | && ROC(Closes[0], 2)[0] < 0
105 | && SMA(Closes[1], 40)[0] < SMA(Closes[1], 40)[2]
106 | && Correlation(Closes[0], 20, CorrelationType.Pearson, 0)[0] > -.4)
107 | {
108 | EnterShort();
109 | }
110 |
111 | // COVER
112 | if ((CrossAbove(MACD(12, 26, 9), EMA(MACD(12, 26, 9), 9), 1) && Stochastics(1, 30, 3).K[0] < 25 && Closes[1][0] >= (1 + 4 / 100) * MIN(Closes[1], 4)[0])
113 | || (MAX(bbd, 3)[0] > 20 && ROC(Closes[1], 3)[0] > 4.5)
114 | || (Closes[0][0] > MAX(High, 15)[1] && Correlation(Closes[0], 60, CorrelationType.Pearson, 0)[0] < -.4))
115 | {
116 | ExitShort();
117 | }
118 | }
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/Conversions/Strategies/WoodiesCCIAutoTrader_NT8/Indicators/@CCI.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2018, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// The Commodity Channel Index (CCI) measures the variation of a security's price
32 | /// from its statistical mean. High values show that prices are unusually high
33 | /// compared to average prices whereas low values indicate that prices are unusually low.
34 | ///
35 | public class CCI : Indicator
36 | {
37 | private SMA sma;
38 |
39 | protected override void OnStateChange()
40 | {
41 | if (State == State.SetDefaults)
42 | {
43 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionCCI;
44 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameCCI;
45 | IsSuspendedWhileInactive = true;
46 | Period = 14;
47 |
48 | AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameCCI);
49 | AddLine(Brushes.DarkGray, 200, NinjaTrader.Custom.Resource.CCILevel2);
50 | AddLine(Brushes.DarkGray, 100, NinjaTrader.Custom.Resource.CCILevel1);
51 | AddLine(Brushes.DarkGray, 0, NinjaTrader.Custom.Resource.NinjaScriptIndicatorZeroLine);
52 | AddLine(Brushes.DarkGray, -100, NinjaTrader.Custom.Resource.CCILevelMinus1);
53 | AddLine(Brushes.DarkGray, -200, NinjaTrader.Custom.Resource.CCILevelMinus2);
54 | }
55 | else if (State == State.DataLoaded)
56 | sma = SMA(Typical, Period);
57 | }
58 |
59 | protected override void OnBarUpdate()
60 | {
61 | if (CurrentBar == 0)
62 | Value[0] = 0;
63 | else
64 | {
65 | double mean = 0;
66 | double sma0 = sma[0];
67 |
68 | for (int idx = Math.Min(CurrentBar, Period - 1); idx >= 0; idx--)
69 | mean += Math.Abs(Typical[idx] - sma0);
70 |
71 | Value[0] = (Typical[0] - sma0) / (mean.ApproxCompare(0) == 0 ? 1 : (0.015 * (mean / Math.Min(Period, CurrentBar + 1))));
72 | }
73 | }
74 |
75 | #region Properties
76 | [Range(1, int.MaxValue), NinjaScriptProperty]
77 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
78 | public int Period
79 | { get; set; }
80 | #endregion
81 | }
82 | }
83 |
84 | #region NinjaScript generated code. Neither change nor remove.
85 |
86 | namespace NinjaTrader.NinjaScript.Indicators
87 | {
88 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
89 | {
90 | private CCI[] cacheCCI;
91 | public CCI CCI(int period)
92 | {
93 | return CCI(Input, period);
94 | }
95 |
96 | public CCI CCI(ISeries input, int period)
97 | {
98 | if (cacheCCI != null)
99 | for (int idx = 0; idx < cacheCCI.Length; idx++)
100 | if (cacheCCI[idx] != null && cacheCCI[idx].Period == period && cacheCCI[idx].EqualsInput(input))
101 | return cacheCCI[idx];
102 | return CacheIndicator(new CCI(){ Period = period }, input, ref cacheCCI);
103 | }
104 | }
105 | }
106 |
107 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
108 | {
109 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
110 | {
111 | public Indicators.CCI CCI(int period)
112 | {
113 | return indicator.CCI(Input, period);
114 | }
115 |
116 | public Indicators.CCI CCI(ISeries input , int period)
117 | {
118 | return indicator.CCI(input, period);
119 | }
120 | }
121 | }
122 |
123 | namespace NinjaTrader.NinjaScript.Strategies
124 | {
125 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
126 | {
127 | public Indicators.CCI CCI(int period)
128 | {
129 | return indicator.CCI(Input, period);
130 | }
131 |
132 | public Indicators.CCI CCI(ISeries input , int period)
133 | {
134 | return indicator.CCI(input, period);
135 | }
136 | }
137 | }
138 |
139 | #endregion
140 |
--------------------------------------------------------------------------------
/Conversions/Strategies/WoodiesCCIAutoTrader_NT8/Indicators/@EMA.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2018, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// Exponential Moving Average. The Exponential Moving Average is an indicator that
32 | /// shows the average value of a security's price over a period of time. When calculating
33 | /// a moving average. The EMA applies more weight to recent prices than the SMA.
34 | ///
35 | public class EMA : Indicator
36 | {
37 | private double constant1;
38 | private double constant2;
39 |
40 | protected override void OnStateChange()
41 | {
42 | if (State == State.SetDefaults)
43 | {
44 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionEMA;
45 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameEMA;
46 | IsOverlay = true;
47 | IsSuspendedWhileInactive = true;
48 | Period = 14;
49 |
50 | AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameEMA);
51 | }
52 | else if (State == State.Configure)
53 | {
54 | constant1 = 2.0 / (1 + Period);
55 | constant2 = 1 - (2.0 / (1 + Period));
56 | }
57 | }
58 |
59 | protected override void OnBarUpdate()
60 | {
61 | Value[0] = (CurrentBar == 0 ? Input[0] : Input[0] * constant1 + constant2 * Value[1]);
62 | }
63 |
64 | #region Properties
65 | [Range(1, int.MaxValue), NinjaScriptProperty]
66 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
67 | public int Period
68 | { get; set; }
69 | #endregion
70 | }
71 | }
72 |
73 | #region NinjaScript generated code. Neither change nor remove.
74 |
75 | namespace NinjaTrader.NinjaScript.Indicators
76 | {
77 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
78 | {
79 | private EMA[] cacheEMA;
80 | public EMA EMA(int period)
81 | {
82 | return EMA(Input, period);
83 | }
84 |
85 | public EMA EMA(ISeries input, int period)
86 | {
87 | if (cacheEMA != null)
88 | for (int idx = 0; idx < cacheEMA.Length; idx++)
89 | if (cacheEMA[idx] != null && cacheEMA[idx].Period == period && cacheEMA[idx].EqualsInput(input))
90 | return cacheEMA[idx];
91 | return CacheIndicator(new EMA(){ Period = period }, input, ref cacheEMA);
92 | }
93 | }
94 | }
95 |
96 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
97 | {
98 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
99 | {
100 | public Indicators.EMA EMA(int period)
101 | {
102 | return indicator.EMA(Input, period);
103 | }
104 |
105 | public Indicators.EMA EMA(ISeries input , int period)
106 | {
107 | return indicator.EMA(input, period);
108 | }
109 | }
110 | }
111 |
112 | namespace NinjaTrader.NinjaScript.Strategies
113 | {
114 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
115 | {
116 | public Indicators.EMA EMA(int period)
117 | {
118 | return indicator.EMA(Input, period);
119 | }
120 |
121 | public Indicators.EMA EMA(ISeries input , int period)
122 | {
123 | return indicator.EMA(input, period);
124 | }
125 | }
126 | }
127 |
128 | #endregion
129 |
--------------------------------------------------------------------------------
/Conversions/Strategies/WoodiesCCIAutoTrader_NT8/Indicators/@SMA.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2018, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// The SMA (Simple Moving Average) is an indicator that shows the average value of a security's price over a period of time.
32 | ///
33 | public class SMA : Indicator
34 | {
35 | private double priorSum;
36 | private double sum;
37 |
38 | protected override void OnStateChange()
39 | {
40 | if (State == State.SetDefaults)
41 | {
42 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionSMA;
43 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameSMA;
44 | IsOverlay = true;
45 | IsSuspendedWhileInactive = true;
46 | Period = 14;
47 |
48 | AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameSMA);
49 | }
50 | else if (State == State.Configure)
51 | {
52 | priorSum = 0;
53 | sum = 0;
54 | }
55 | }
56 |
57 | protected override void OnBarUpdate()
58 | {
59 | if (BarsArray[0].BarsType.IsRemoveLastBarSupported)
60 | {
61 | if (CurrentBar == 0)
62 | Value[0] = Input[0];
63 | else
64 | {
65 | double last = Value[1] * Math.Min(CurrentBar, Period);
66 |
67 | if (CurrentBar >= Period)
68 | Value[0] = (last + Input[0] - Input[Period]) / Math.Min(CurrentBar, Period);
69 | else
70 | Value[0] = ((last + Input[0]) / (Math.Min(CurrentBar, Period) + 1));
71 | }
72 | }
73 | else
74 | {
75 | if (IsFirstTickOfBar)
76 | priorSum = sum;
77 |
78 | sum = priorSum + Input[0] - (CurrentBar >= Period ? Input[Period] : 0);
79 | Value[0] = sum / (CurrentBar < Period ? CurrentBar + 1 : Period);
80 | }
81 | }
82 |
83 | #region Properties
84 | [Range(1, int.MaxValue), NinjaScriptProperty]
85 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
86 | public int Period
87 | { get; set; }
88 | #endregion
89 | }
90 | }
91 |
92 | #region NinjaScript generated code. Neither change nor remove.
93 |
94 | namespace NinjaTrader.NinjaScript.Indicators
95 | {
96 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
97 | {
98 | private SMA[] cacheSMA;
99 | public SMA SMA(int period)
100 | {
101 | return SMA(Input, period);
102 | }
103 |
104 | public SMA SMA(ISeries input, int period)
105 | {
106 | if (cacheSMA != null)
107 | for (int idx = 0; idx < cacheSMA.Length; idx++)
108 | if (cacheSMA[idx] != null && cacheSMA[idx].Period == period && cacheSMA[idx].EqualsInput(input))
109 | return cacheSMA[idx];
110 | return CacheIndicator(new SMA(){ Period = period }, input, ref cacheSMA);
111 | }
112 | }
113 | }
114 |
115 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
116 | {
117 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
118 | {
119 | public Indicators.SMA SMA(int period)
120 | {
121 | return indicator.SMA(Input, period);
122 | }
123 |
124 | public Indicators.SMA SMA(ISeries input , int period)
125 | {
126 | return indicator.SMA(input, period);
127 | }
128 | }
129 | }
130 |
131 | namespace NinjaTrader.NinjaScript.Strategies
132 | {
133 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
134 | {
135 | public Indicators.SMA SMA(int period)
136 | {
137 | return indicator.SMA(Input, period);
138 | }
139 |
140 | public Indicators.SMA SMA(ISeries input , int period)
141 | {
142 | return indicator.SMA(input, period);
143 | }
144 | }
145 | }
146 |
147 | #endregion
148 |
--------------------------------------------------------------------------------
/Conversions/Strategies/WoodiesCCIAutoTrader_NT8/Indicators/@SUM.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2018, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// The Sum shows the summation of the last n data points.
32 | ///
33 | public class SUM : Indicator
34 | {
35 | protected override void OnStateChange()
36 | {
37 | if (State == State.SetDefaults)
38 | {
39 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionSUM;
40 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameSUM;
41 | IsSuspendedWhileInactive = true;
42 | Period = 14;
43 |
44 | AddPlot(Brushes.DarkCyan, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameSUM);
45 | }
46 | }
47 |
48 | protected override void OnBarUpdate()
49 | {
50 | Value[0] = Input[0] + (CurrentBar > 0 ? Value[1] : 0) - (CurrentBar >= Period ? Input[Period] : 0);
51 | }
52 |
53 | #region Properties
54 | [Range(1, int.MaxValue), NinjaScriptProperty]
55 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
56 | public int Period
57 | { get; set; }
58 | #endregion
59 | }
60 | }
61 |
62 | #region NinjaScript generated code. Neither change nor remove.
63 |
64 | namespace NinjaTrader.NinjaScript.Indicators
65 | {
66 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
67 | {
68 | private SUM[] cacheSUM;
69 | public SUM SUM(int period)
70 | {
71 | return SUM(Input, period);
72 | }
73 |
74 | public SUM SUM(ISeries input, int period)
75 | {
76 | if (cacheSUM != null)
77 | for (int idx = 0; idx < cacheSUM.Length; idx++)
78 | if (cacheSUM[idx] != null && cacheSUM[idx].Period == period && cacheSUM[idx].EqualsInput(input))
79 | return cacheSUM[idx];
80 | return CacheIndicator(new SUM(){ Period = period }, input, ref cacheSUM);
81 | }
82 | }
83 | }
84 |
85 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
86 | {
87 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
88 | {
89 | public Indicators.SUM SUM(int period)
90 | {
91 | return indicator.SUM(Input, period);
92 | }
93 |
94 | public Indicators.SUM SUM(ISeries input , int period)
95 | {
96 | return indicator.SUM(input, period);
97 | }
98 | }
99 | }
100 |
101 | namespace NinjaTrader.NinjaScript.Strategies
102 | {
103 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
104 | {
105 | public Indicators.SUM SUM(int period)
106 | {
107 | return indicator.SUM(Input, period);
108 | }
109 |
110 | public Indicators.SUM SUM(ISeries input , int period)
111 | {
112 | return indicator.SUM(input, period);
113 | }
114 | }
115 | }
116 |
117 | #endregion
118 |
--------------------------------------------------------------------------------
/Conversions/Strategies/WoodiesCCIAutoTrader_NT8/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.14.1
5 |
6 |
--------------------------------------------------------------------------------
/Examples/AddOns/CustomFilerPicker/AddOns/CustomFilePicker.cs:
--------------------------------------------------------------------------------
1 | #region Using declarations
2 | using System;
3 | using System.Windows;
4 | using System.Windows.Controls.WpfPropertyGrid;
5 | using System.Windows.Markup;
6 | using Microsoft.Win32;
7 | #endregion
8 |
9 | namespace NinjaTrader.NinjaScript.AddOns
10 | {
11 | public class CustomFilePicker : PropertyEditor
12 | {
13 | public CustomFilePicker()
14 | {
15 | InlineTemplate = CreateTemplate();
16 | }
17 |
18 | DataTemplate CreateTemplate()
19 | {
20 | const string xamlTemplate =
21 | @"
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
37 |
38 |
41 |
42 |
43 |
44 |
45 | ";
46 |
47 |
48 | ParserContext context = new ParserContext();
49 | context.XmlnsDictionary.Add("", "http://schemas.microsoft.com/winfx/2006/xaml/presentation");
50 | context.XmlnsDictionary.Add("x", "http://schemas.microsoft.com/winfx/2006/xaml");
51 | context.XmlnsDictionary.Add("pg", "http://schemas.denisvuyka.wordpress.com/wpfpropertygrid");
52 | DataTemplate template = (DataTemplate)XamlReader.Parse(xamlTemplate, context);
53 | return template;
54 | }
55 |
56 | public override void ClearValue(PropertyItemValue propertyValue, IInputElement commandSource)
57 | {
58 | if (propertyValue == null || propertyValue.IsReadOnly)
59 | {
60 | return;
61 | }
62 | propertyValue.StringValue = string.Empty;
63 | }
64 |
65 | public override void ShowDialog(PropertyItemValue propertyValue, IInputElement commandSource)
66 | {
67 | PropertyGrid propGrid = commandSource as PropertyGrid;
68 | string lastPath = propertyValue.StringValue;
69 | if (propGrid == null) return;
70 |
71 | OpenFileDialog openFileDialog = new OpenFileDialog();
72 | openFileDialog.Filter = "All files (*.*)|*.*";
73 | openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
74 | openFileDialog.ShowDialog();
75 |
76 | propertyValue.StringValue = openFileDialog.FileName != String.Empty ? openFileDialog.FileName : lastPath; // change this string and compile, the ui does not see this change
77 | propGrid.DoReload();
78 | propGrid.RaiseEvent(new PropertyValueChangedEventArgs(PropertyGrid.PropertyValueChangedEvent, propertyValue.ParentProperty, ""));
79 | }
80 | }
81 | }
--------------------------------------------------------------------------------
/Examples/AddOns/CustomFilerPicker/AdditionalReferences.txt:
--------------------------------------------------------------------------------
1 | *MyDocuments*\NinjaTrader 8\bin\Custom\System.Windows.Controls.WpfPropertyGrid.dll
2 |
--------------------------------------------------------------------------------
/Examples/AddOns/CustomFilerPicker/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.16.3
5 |
6 |
--------------------------------------------------------------------------------
/Examples/ChartStyles/ChartStyleCustomBrushes/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.13.1
5 |
6 |
--------------------------------------------------------------------------------
/Examples/Indicators/ATMStrategyMonitor/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.16.3
5 |
6 |
--------------------------------------------------------------------------------
/Examples/Indicators/AccountItemUpdateExample/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.12.0
5 |
6 |
--------------------------------------------------------------------------------
/Examples/Indicators/AccountOrderExamples/GetAtmStrategyOwnerFromEntryExample.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2021, NinjaTrader LLC
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component
4 | // Coded by NinjaTrader_Jim
5 | //
6 | #region Using declarations
7 | using System;
8 | using System.Collections.Generic;
9 | using System.ComponentModel;
10 | using System.ComponentModel.DataAnnotations;
11 | using System.Linq;
12 | using System.Text;
13 | using System.Threading.Tasks;
14 | using System.Windows;
15 | using System.Windows.Input;
16 | using System.Windows.Media;
17 | using System.Xml.Serialization;
18 | using NinjaTrader.Cbi;
19 | using NinjaTrader.Gui;
20 | using NinjaTrader.Gui.Chart;
21 | using NinjaTrader.Gui.SuperDom;
22 | using NinjaTrader.Gui.Tools;
23 | using NinjaTrader.Data;
24 | using NinjaTrader.NinjaScript;
25 | using NinjaTrader.Core.FloatingPoint;
26 | using NinjaTrader.NinjaScript.DrawingTools;
27 | #endregion
28 |
29 | // The NinjaTrader.NinjaScript.Indicators namespace holds all indicators and is required. Do not change it.
30 | namespace NinjaTrader.NinjaScript.Indicators.AccountOrderExamples
31 | {
32 | public class GetAtmStrategyOwnerFromEntryExample : Indicator
33 | {
34 | private Account myAcct;
35 |
36 | protected override void OnStateChange()
37 | {
38 | if (State == State.SetDefaults)
39 | {
40 | Description = @"";
41 | Name = "DetectAtmEntry";
42 | Calculate = Calculate.OnBarClose;
43 | IsOverlay = false;
44 | }
45 | else if (State == State.DataLoaded)
46 | {
47 | lock (Account.All)
48 |
49 | myAcct = Account.All.FirstOrDefault(a => a.Name == "Sim101");
50 | myAcct.OrderUpdate += OnOrderUpdate;
51 | }
52 | else if (State == State.Terminated)
53 | {
54 | if(myAcct != null)
55 | myAcct.OrderUpdate -= OnOrderUpdate;
56 | }
57 | }
58 |
59 | protected override void OnBarUpdate() { }
60 |
61 | private void OnOrderUpdate(object sender, OrderEventArgs e)
62 | {
63 | if (e.Order.Name == "Entry" && e.OrderState == OrderState.Filled)
64 | {
65 | AtmStrategy atmStrategy;
66 | StrategyBase stratbase;
67 |
68 | stratbase = e.Order.GetOwnerStrategy() ?? null;
69 |
70 | atmStrategy = stratbase as AtmStrategy;
71 | if (atmStrategy != null)
72 | Print("Entry order submitted for: " + atmStrategy.Template);
73 | }
74 | }
75 | }
76 | }
77 |
78 | #region NinjaScript generated code. Neither change nor remove.
79 |
80 | namespace NinjaTrader.NinjaScript.Indicators
81 | {
82 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
83 | {
84 | private AccountOrderExamples.GetAtmStrategyOwnerFromEntryExample[] cacheGetAtmStrategyOwnerFromEntryExample;
85 | public AccountOrderExamples.GetAtmStrategyOwnerFromEntryExample GetAtmStrategyOwnerFromEntryExample()
86 | {
87 | return GetAtmStrategyOwnerFromEntryExample(Input);
88 | }
89 |
90 | public AccountOrderExamples.GetAtmStrategyOwnerFromEntryExample GetAtmStrategyOwnerFromEntryExample(ISeries input)
91 | {
92 | if (cacheGetAtmStrategyOwnerFromEntryExample != null)
93 | for (int idx = 0; idx < cacheGetAtmStrategyOwnerFromEntryExample.Length; idx++)
94 | if (cacheGetAtmStrategyOwnerFromEntryExample[idx] != null && cacheGetAtmStrategyOwnerFromEntryExample[idx].EqualsInput(input))
95 | return cacheGetAtmStrategyOwnerFromEntryExample[idx];
96 | return CacheIndicator(new AccountOrderExamples.GetAtmStrategyOwnerFromEntryExample(), input, ref cacheGetAtmStrategyOwnerFromEntryExample);
97 | }
98 | }
99 | }
100 |
101 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
102 | {
103 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
104 | {
105 | public Indicators.AccountOrderExamples.GetAtmStrategyOwnerFromEntryExample GetAtmStrategyOwnerFromEntryExample()
106 | {
107 | return indicator.GetAtmStrategyOwnerFromEntryExample(Input);
108 | }
109 |
110 | public Indicators.AccountOrderExamples.GetAtmStrategyOwnerFromEntryExample GetAtmStrategyOwnerFromEntryExample(ISeries input )
111 | {
112 | return indicator.GetAtmStrategyOwnerFromEntryExample(input);
113 | }
114 | }
115 | }
116 |
117 | namespace NinjaTrader.NinjaScript.Strategies
118 | {
119 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
120 | {
121 | public Indicators.AccountOrderExamples.GetAtmStrategyOwnerFromEntryExample GetAtmStrategyOwnerFromEntryExample()
122 | {
123 | return indicator.GetAtmStrategyOwnerFromEntryExample(Input);
124 | }
125 |
126 | public Indicators.AccountOrderExamples.GetAtmStrategyOwnerFromEntryExample GetAtmStrategyOwnerFromEntryExample(ISeries input )
127 | {
128 | return indicator.GetAtmStrategyOwnerFromEntryExample(input);
129 | }
130 | }
131 | }
132 |
133 | #endregion
134 |
--------------------------------------------------------------------------------
/Examples/Indicators/AddCustomBarsTypeUniRenko/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.13.1
5 |
6 |
--------------------------------------------------------------------------------
/Examples/Indicators/BuySellPressureOneTick/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.13.1
5 |
6 |
--------------------------------------------------------------------------------
/Examples/Indicators/ChartCustomToolbarExampleTopBottomLeftRight/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.16.3
5 |
6 |
--------------------------------------------------------------------------------
/Examples/Indicators/LinearGradientBrushExample/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.15.1
5 |
6 |
--------------------------------------------------------------------------------
/Examples/Indicators/OMDTest_ConditionalOnMarketDepthOnMarketData/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.17.2
5 |
6 |
--------------------------------------------------------------------------------
/Examples/Indicators/OnRenderLinesfromSeriesBoolExample/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.15.1
5 |
6 |
--------------------------------------------------------------------------------
/Examples/Indicators/OneTickMultiSeriesTemplate/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.13.1
5 |
6 |
--------------------------------------------------------------------------------
/Examples/Indicators/PlotFromSecondaryDataSeriesExample/Indicators/@SMA.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2018, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// The SMA (Simple Moving Average) is an indicator that shows the average value of a security's price over a period of time.
32 | ///
33 | public class SMA : Indicator
34 | {
35 | private double priorSum;
36 | private double sum;
37 |
38 | protected override void OnStateChange()
39 | {
40 | if (State == State.SetDefaults)
41 | {
42 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionSMA;
43 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameSMA;
44 | IsOverlay = true;
45 | IsSuspendedWhileInactive = true;
46 | Period = 14;
47 |
48 | AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameSMA);
49 | }
50 | else if (State == State.Configure)
51 | {
52 | priorSum = 0;
53 | sum = 0;
54 | }
55 | }
56 |
57 | protected override void OnBarUpdate()
58 | {
59 | if (BarsArray[0].BarsType.IsRemoveLastBarSupported)
60 | {
61 | if (CurrentBar == 0)
62 | Value[0] = Input[0];
63 | else
64 | {
65 | double last = Value[1] * Math.Min(CurrentBar, Period);
66 |
67 | if (CurrentBar >= Period)
68 | Value[0] = (last + Input[0] - Input[Period]) / Math.Min(CurrentBar, Period);
69 | else
70 | Value[0] = ((last + Input[0]) / (Math.Min(CurrentBar, Period) + 1));
71 | }
72 | }
73 | else
74 | {
75 | if (IsFirstTickOfBar)
76 | priorSum = sum;
77 |
78 | sum = priorSum + Input[0] - (CurrentBar >= Period ? Input[Period] : 0);
79 | Value[0] = sum / (CurrentBar < Period ? CurrentBar + 1 : Period);
80 | }
81 | }
82 |
83 | #region Properties
84 | [Range(1, int.MaxValue), NinjaScriptProperty]
85 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
86 | public int Period
87 | { get; set; }
88 | #endregion
89 | }
90 | }
91 |
92 | #region NinjaScript generated code. Neither change nor remove.
93 |
94 | namespace NinjaTrader.NinjaScript.Indicators
95 | {
96 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
97 | {
98 | private SMA[] cacheSMA;
99 | public SMA SMA(int period)
100 | {
101 | return SMA(Input, period);
102 | }
103 |
104 | public SMA SMA(ISeries input, int period)
105 | {
106 | if (cacheSMA != null)
107 | for (int idx = 0; idx < cacheSMA.Length; idx++)
108 | if (cacheSMA[idx] != null && cacheSMA[idx].Period == period && cacheSMA[idx].EqualsInput(input))
109 | return cacheSMA[idx];
110 | return CacheIndicator(new SMA(){ Period = period }, input, ref cacheSMA);
111 | }
112 | }
113 | }
114 |
115 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
116 | {
117 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
118 | {
119 | public Indicators.SMA SMA(int period)
120 | {
121 | return indicator.SMA(Input, period);
122 | }
123 |
124 | public Indicators.SMA SMA(ISeries input , int period)
125 | {
126 | return indicator.SMA(input, period);
127 | }
128 | }
129 | }
130 |
131 | namespace NinjaTrader.NinjaScript.Strategies
132 | {
133 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
134 | {
135 | public Indicators.SMA SMA(int period)
136 | {
137 | return indicator.SMA(Input, period);
138 | }
139 |
140 | public Indicators.SMA SMA(ISeries input , int period)
141 | {
142 | return indicator.SMA(input, period);
143 | }
144 | }
145 | }
146 |
147 | #endregion
148 |
--------------------------------------------------------------------------------
/Examples/Indicators/PlotFromSecondaryDataSeriesExample/Indicators/PlotFromSecondaryDataSeriesExample.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 PlotFromSecondaryDataSeriesExample : Indicator
28 | {
29 | private SMA SMA1;
30 | protected override void OnStateChange()
31 | {
32 | if (State == State.SetDefaults)
33 | {
34 | Description = @"Enter the description for your new custom Indicator here.";
35 | Name = "PlotFromSecondaryDataSeriesExample";
36 | Calculate = Calculate.OnBarClose;
37 | IsOverlay = false;
38 | DisplayInDataBox = true;
39 | DrawOnPricePanel = true;
40 | DrawHorizontalGridLines = true;
41 | DrawVerticalGridLines = true;
42 | PaintPriceMarkers = true;
43 | ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
44 | //Disable this property if your indicator requires custom values that cumulate with each new market data event.
45 | //See Help Guide for additional information.
46 | IsSuspendedWhileInactive = true;
47 | AddPlot(Brushes.RoyalBlue, "MyPlot");
48 | }
49 | else if (State == State.Configure)
50 | {
51 | AddDataSeries(null, Data.BarsPeriodType.Minute, 5, Data.MarketDataType.Last);
52 | }
53 | else if (State == State.DataLoaded)
54 | {
55 | SMA1 = SMA(Closes[1], 14);
56 | }
57 | }
58 |
59 | protected override void OnBarUpdate()
60 | {
61 | if (CurrentBars[0] < 1 || CurrentBars[1] < 1)
62 | return;
63 |
64 | if(BarsInProgress == 0)
65 | Value[0] = SMA1[0];
66 | }
67 | }
68 | }
69 |
70 | #region NinjaScript generated code. Neither change nor remove.
71 |
72 | namespace NinjaTrader.NinjaScript.Indicators
73 | {
74 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
75 | {
76 | private PlotFromSecondaryDataSeriesExample[] cachePlotFromSecondaryDataSeriesExample;
77 | public PlotFromSecondaryDataSeriesExample PlotFromSecondaryDataSeriesExample()
78 | {
79 | return PlotFromSecondaryDataSeriesExample(Input);
80 | }
81 |
82 | public PlotFromSecondaryDataSeriesExample PlotFromSecondaryDataSeriesExample(ISeries input)
83 | {
84 | if (cachePlotFromSecondaryDataSeriesExample != null)
85 | for (int idx = 0; idx < cachePlotFromSecondaryDataSeriesExample.Length; idx++)
86 | if (cachePlotFromSecondaryDataSeriesExample[idx] != null && cachePlotFromSecondaryDataSeriesExample[idx].EqualsInput(input))
87 | return cachePlotFromSecondaryDataSeriesExample[idx];
88 | return CacheIndicator(new PlotFromSecondaryDataSeriesExample(), input, ref cachePlotFromSecondaryDataSeriesExample);
89 | }
90 | }
91 | }
92 |
93 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
94 | {
95 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
96 | {
97 | public Indicators.PlotFromSecondaryDataSeriesExample PlotFromSecondaryDataSeriesExample()
98 | {
99 | return indicator.PlotFromSecondaryDataSeriesExample(Input);
100 | }
101 |
102 | public Indicators.PlotFromSecondaryDataSeriesExample PlotFromSecondaryDataSeriesExample(ISeries input )
103 | {
104 | return indicator.PlotFromSecondaryDataSeriesExample(input);
105 | }
106 | }
107 | }
108 |
109 | namespace NinjaTrader.NinjaScript.Strategies
110 | {
111 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
112 | {
113 | public Indicators.PlotFromSecondaryDataSeriesExample PlotFromSecondaryDataSeriesExample()
114 | {
115 | return indicator.PlotFromSecondaryDataSeriesExample(Input);
116 | }
117 |
118 | public Indicators.PlotFromSecondaryDataSeriesExample PlotFromSecondaryDataSeriesExample(ISeries input )
119 | {
120 | return indicator.PlotFromSecondaryDataSeriesExample(input);
121 | }
122 | }
123 | }
124 |
125 | #endregion
126 |
--------------------------------------------------------------------------------
/Examples/Indicators/PlotFromSecondaryDataSeriesExample/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.16.3
5 |
6 |
--------------------------------------------------------------------------------
/Examples/Indicators/RadialGradientBrushExample/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.15.1
5 |
6 |
--------------------------------------------------------------------------------
/Examples/Indicators/SampleDrawBitmapFunV3/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.13.1
5 |
6 |
--------------------------------------------------------------------------------
/Examples/Indicators/SampleDrawBitmapFunV3/templates/SampleDrawBitmap.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jDoom/NinjaScripts/ff93a5b84781c2848833563ad27a2a59442af4f4/Examples/Indicators/SampleDrawBitmapFunV3/templates/SampleDrawBitmap.png
--------------------------------------------------------------------------------
/Examples/Indicators/SampleDrawBitmapFunV3/templates/SubFolder/SampleDrawBitmap.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jDoom/NinjaScripts/ff93a5b84781c2848833563ad27a2a59442af4f4/Examples/Indicators/SampleDrawBitmapFunV3/templates/SubFolder/SampleDrawBitmap.png
--------------------------------------------------------------------------------
/Examples/Indicators/SampleDrawBitmap_1.24.2018/Indicators/SampleDrawBitmap.cs:
--------------------------------------------------------------------------------
1 | namespace NinjaTrader.NinjaScript.Indicators
2 | {
3 | public class SampleDrawBitmap : Indicator
4 | {
5 | private SharpDX.Direct2D1.Bitmap myBitmap;
6 | private SharpDX.IO.NativeFileStream fileStream;
7 | private SharpDX.WIC.BitmapDecoder bitmapDecoder;
8 | private SharpDX.WIC.FormatConverter converter;
9 | private SharpDX.WIC.BitmapFrameDecode frame;
10 |
11 | protected override void OnStateChange()
12 | {
13 | if (State == State.SetDefaults)
14 | {
15 | Name = "SampleDrawBitmap";
16 | Calculate = Calculate.OnBarClose;
17 | IsOverlay = true;
18 | ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
19 | IsSuspendedWhileInactive = true;
20 |
21 | }
22 | else if (State == State.Terminated)
23 | {
24 | if (myBitmap != null) myBitmap.Dispose();
25 | if (fileStream != null) fileStream.Dispose();
26 | if (bitmapDecoder != null) bitmapDecoder.Dispose();
27 | if (converter != null) converter.Dispose();
28 | if (frame != null) frame.Dispose();
29 | }
30 | }
31 |
32 | protected override void OnBarUpdate() { }
33 |
34 |
35 | public override void OnRenderTargetChanged()
36 | {
37 | base.OnRenderTargetChanged();
38 | if (RenderTarget == null || RenderTarget.IsDisposed) return;
39 |
40 | // Dispose all Render dependant resources on RenderTarget change.
41 | if (myBitmap != null) myBitmap.Dispose();
42 | if (fileStream != null) fileStream.Dispose();
43 | if (bitmapDecoder != null) bitmapDecoder.Dispose();
44 | if (converter != null) converter.Dispose();
45 | if (frame != null) frame.Dispose();
46 |
47 | // Neccessary for creating WIC objects.
48 | fileStream = new SharpDX.IO.NativeFileStream(System.IO.Path.Combine(NinjaTrader.Core.Globals.UserDataDir, "woodenBox.png"), SharpDX.IO.NativeFileMode.Open, SharpDX.IO.NativeFileAccess.Read);
49 | // Used to read the image source file.
50 | bitmapDecoder = new SharpDX.WIC.BitmapDecoder(Core.Globals.WicImagingFactory, fileStream, SharpDX.WIC.DecodeOptions.CacheOnDemand);
51 | // Get the first frame of the image.
52 | frame = bitmapDecoder.GetFrame(0);
53 | // Convert it to a compatible pixel format.
54 | converter = new SharpDX.WIC.FormatConverter(Core.Globals.WicImagingFactory);
55 | converter.Initialize(frame, SharpDX.WIC.PixelFormat.Format32bppPRGBA);
56 | // Create the new Bitmap1 directly from the FormatConverter.
57 | myBitmap = SharpDX.Direct2D1.Bitmap.FromWicBitmap(RenderTarget, converter);
58 |
59 | }
60 |
61 | protected override void OnRender(NinjaTrader.Gui.Chart.ChartControl chartControl, NinjaTrader.Gui.Chart.ChartScale chartScale)
62 | {
63 | base.OnRender(chartControl, chartScale);
64 | if (RenderTarget == null || Bars == null || Bars.Instrument == null || myBitmap == null)
65 | return;
66 | RenderTarget.DrawBitmap(myBitmap, new SharpDX.RectangleF((float)ChartPanel.W / 2, (float)ChartPanel.H / 2, 150, 150), 1.0f, SharpDX.Direct2D1.BitmapInterpolationMode.Linear);
67 | }
68 |
69 | }
70 | }
71 |
72 | #region NinjaScript generated code. Neither change nor remove.
73 |
74 | namespace NinjaTrader.NinjaScript.Indicators
75 | {
76 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
77 | {
78 | private SampleDrawBitmap[] cacheSampleDrawBitmap;
79 | public SampleDrawBitmap SampleDrawBitmap()
80 | {
81 | return SampleDrawBitmap(Input);
82 | }
83 |
84 | public SampleDrawBitmap SampleDrawBitmap(ISeries input)
85 | {
86 | if (cacheSampleDrawBitmap != null)
87 | for (int idx = 0; idx < cacheSampleDrawBitmap.Length; idx++)
88 | if (cacheSampleDrawBitmap[idx] != null && cacheSampleDrawBitmap[idx].EqualsInput(input))
89 | return cacheSampleDrawBitmap[idx];
90 | return CacheIndicator(new SampleDrawBitmap(), input, ref cacheSampleDrawBitmap);
91 | }
92 | }
93 | }
94 |
95 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
96 | {
97 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
98 | {
99 | public Indicators.SampleDrawBitmap SampleDrawBitmap()
100 | {
101 | return indicator.SampleDrawBitmap(Input);
102 | }
103 |
104 | public Indicators.SampleDrawBitmap SampleDrawBitmap(ISeries input )
105 | {
106 | return indicator.SampleDrawBitmap(input);
107 | }
108 | }
109 | }
110 |
111 | namespace NinjaTrader.NinjaScript.Strategies
112 | {
113 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
114 | {
115 | public Indicators.SampleDrawBitmap SampleDrawBitmap()
116 | {
117 | return indicator.SampleDrawBitmap(Input);
118 | }
119 |
120 | public Indicators.SampleDrawBitmap SampleDrawBitmap(ISeries input )
121 | {
122 | return indicator.SampleDrawBitmap(input);
123 | }
124 | }
125 | }
126 |
127 | #endregion
128 |
--------------------------------------------------------------------------------
/Examples/Indicators/SampleDrawBitmap_1.24.2018/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.11.1
5 |
6 |
--------------------------------------------------------------------------------
/Examples/Indicators/SampleSharpDXTextRotation/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.7.2
5 |
6 |
--------------------------------------------------------------------------------
/Examples/Indicators/VolumetricTestBuySellPressure/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.14.0
5 |
6 |
--------------------------------------------------------------------------------
/Examples/Strategies/AtmStrategySelectorExample/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.14.2
5 |
6 |
--------------------------------------------------------------------------------
/Examples/Strategies/AtmStrategySelectorExample/Strategies/AtmStrategySelectorExample.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
27 | {
28 | public class AtmStrategySelectorExample : Strategy
29 | {
30 | protected override void OnStateChange()
31 | {
32 | if (State == State.SetDefaults)
33 | {
34 | Description = @"Enter the description for your new custom Strategy here.";
35 | Name = "AtmStrategySelectorExample";
36 | Calculate = Calculate.OnBarClose;
37 | EntriesPerDirection = 1;
38 | EntryHandling = EntryHandling.AllEntries;
39 | IsExitOnSessionCloseStrategy = true;
40 | ExitOnSessionCloseSeconds = 30;
41 | IsFillLimitOnTouch = false;
42 | MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
43 | OrderFillResolution = OrderFillResolution.Standard;
44 | Slippage = 0;
45 | StartBehavior = StartBehavior.WaitUntilFlat;
46 | TimeInForce = TimeInForce.Gtc;
47 | TraceOrders = false;
48 | RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
49 | StopTargetHandling = StopTargetHandling.PerEntryExecution;
50 | BarsRequiredToTrade = 20;
51 | // Disable this property for performance gains in Strategy Analyzer optimizations
52 | // See the Help Guide for additional information
53 | IsInstantiatedOnEachOptimizationIteration = true;
54 |
55 | AtmStrategy = String.Empty;
56 | }
57 | else if (State == State.Configure)
58 | {
59 | }
60 | }
61 |
62 | protected override void OnBarUpdate()
63 | {
64 | //Add your custom strategy logic here.
65 | }
66 |
67 | [TypeConverter(typeof(FriendlyAtmConverter))] // Converts the bool to string values
68 | [PropertyEditor("NinjaTrader.Gui.Tools.StringStandardValuesEditorKey")] // Create the combo box on the property grid
69 | [Display(Name = "Atm Strategy", Order = 1, GroupName = "AtmStrategy")]
70 | public string AtmStrategy
71 | { get; set; }
72 |
73 | #region AtmStrategySelector converter
74 | // Since this is only being applied to a specific property rather than the whole class,
75 | // we don't need to inherit from IndicatorBaseConverter and can just use a generic TypeConverter
76 | public class FriendlyAtmConverter : TypeConverter
77 | {
78 | // Set the values to appear in the combo box
79 | public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
80 | {
81 | List values = new List();
82 | string[] files = System.IO.Directory.GetFiles(System.IO.Path.Combine(NinjaTrader.Core.Globals.UserDataDir, "templates", "AtmStrategy"), "*.xml");
83 |
84 | foreach(string atm in files)
85 | {
86 | values.Add(System.IO.Path.GetFileNameWithoutExtension(atm));
87 | NinjaTrader.Code.Output.Process(System.IO.Path.GetFileNameWithoutExtension(atm), PrintTo.OutputTab1);
88 | }
89 |
90 | return new StandardValuesCollection(values);
91 | }
92 |
93 | public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
94 | {
95 | return value.ToString();
96 | }
97 |
98 | public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
99 | {
100 | return value;
101 | }
102 |
103 | // required interface members needed to compile
104 | public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
105 | { return true; }
106 |
107 | public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
108 | { return true; }
109 |
110 | public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
111 | { return true; }
112 |
113 | public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
114 | { return true; }
115 | }
116 | #endregion
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/Examples/Strategies/DrawOnIndicatorPanelsFromStrategy/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.15.1
5 |
6 |
--------------------------------------------------------------------------------
/Examples/Strategies/DrawOnIndicatorPanelsFromStrategy/Strategies/DrawOnIndicatorPanels.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
27 | {
28 | public class DrawOnIndicatorPanels : Strategy
29 | {
30 | private MACD MACD1;
31 | private MACD MACD2;
32 | protected override void OnStateChange()
33 | {
34 | if (State == State.SetDefaults)
35 | {
36 | Description = @"Enter the description for your new custom Strategy here.";
37 | Name = "DrawOnIndicatorPanels";
38 | Calculate = Calculate.OnBarClose;
39 | EntriesPerDirection = 1;
40 | EntryHandling = EntryHandling.AllEntries;
41 | IsExitOnSessionCloseStrategy = true;
42 | ExitOnSessionCloseSeconds = 30;
43 | IsFillLimitOnTouch = false;
44 | MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
45 | OrderFillResolution = OrderFillResolution.Standard;
46 | Slippage = 0;
47 | StartBehavior = StartBehavior.WaitUntilFlat;
48 | TimeInForce = TimeInForce.Gtc;
49 | TraceOrders = false;
50 | RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
51 | StopTargetHandling = StopTargetHandling.PerEntryExecution;
52 | BarsRequiredToTrade = 20;
53 | DrawOnPricePanel = false;
54 | // Disable this property for performance gains in Strategy Analyzer optimizations
55 | // See the Help Guide for additional information
56 | IsInstantiatedOnEachOptimizationIteration = true;
57 | }
58 | else if (State == State.DataLoaded)
59 | {
60 | MACD1 = MACD(12, 26, 9);
61 | AddChartIndicator(MACD1);
62 | MACD1.DrawOnPricePanel = false;
63 | MACD1.IsOverlay = false;
64 |
65 | MACD2 = MACD(13, 26, 9);
66 | AddChartIndicator(MACD2);
67 | MACD2.DrawOnPricePanel = false;
68 | MACD2.IsOverlay = false;
69 | }
70 | }
71 |
72 | protected override void OnBarUpdate()
73 | {
74 | Draw.Dot(this, "Strategy"+CurrentBar, true, 0, High[0] + 10 * TickSize, Brushes.RoyalBlue, false);
75 | Draw.Dot(MACD1, "MACD1"+CurrentBar, true, 0, MACD1.Default[0] + 1, Brushes.RoyalBlue, false);
76 | Draw.Dot(MACD2, "MACD2"+CurrentBar, true, 0, MACD2.Diff[0] + 1, Brushes.RoyalBlue, false);
77 | }
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/Examples/Strategies/MultiStopTargetTest/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.14.2
5 |
6 |
--------------------------------------------------------------------------------
/Examples/Strategies/PlotHigherTimeFrame/Indicators/@HMA.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2018, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | //This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// The Hull Moving Average (HMA) employs weighted MA calculations to offer superior
32 | /// smoothing, and much less lag, over traditional SMA indicators.
33 | /// This indicator is based on the reference article found here:
34 | /// http://www.justdata.com.au/Journals/AlanHull/hull_ma.htm
35 | ///
36 | public class HMA : Indicator
37 | {
38 | private Series diffSeries;
39 | private WMA wma1;
40 | private WMA wma2;
41 | private WMA wmaDiffSeries;
42 |
43 | protected override void OnStateChange()
44 | {
45 | if (State == State.SetDefaults)
46 | {
47 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionHMA;
48 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameHMA;
49 | IsSuspendedWhileInactive = true;
50 | Period = 14;
51 | IsOverlay = true;
52 |
53 | AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameHMA);
54 | }
55 | else if (State == State.DataLoaded)
56 | {
57 | diffSeries = new Series(this);
58 | wma1 = WMA(Inputs[0], (Period / 2));
59 | wma2 = WMA(Inputs[0], Period);
60 | wmaDiffSeries = WMA(diffSeries, (int) Math.Sqrt(Period));
61 | }
62 | }
63 |
64 | protected override void OnBarUpdate()
65 | {
66 | diffSeries[0] = 2 * wma1[0] - wma2[0];
67 | Value[0] = wmaDiffSeries[0];
68 | }
69 |
70 | #region Properties
71 | [Range(2, int.MaxValue), NinjaScriptProperty]
72 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
73 | public int Period
74 | { get; set; }
75 | #endregion
76 | }
77 | }
78 |
79 | #region NinjaScript generated code. Neither change nor remove.
80 |
81 | namespace NinjaTrader.NinjaScript.Indicators
82 | {
83 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
84 | {
85 | private HMA[] cacheHMA;
86 | public HMA HMA(int period)
87 | {
88 | return HMA(Input, period);
89 | }
90 |
91 | public HMA HMA(ISeries input, int period)
92 | {
93 | if (cacheHMA != null)
94 | for (int idx = 0; idx < cacheHMA.Length; idx++)
95 | if (cacheHMA[idx] != null && cacheHMA[idx].Period == period && cacheHMA[idx].EqualsInput(input))
96 | return cacheHMA[idx];
97 | return CacheIndicator(new HMA(){ Period = period }, input, ref cacheHMA);
98 | }
99 | }
100 | }
101 |
102 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
103 | {
104 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
105 | {
106 | public Indicators.HMA HMA(int period)
107 | {
108 | return indicator.HMA(Input, period);
109 | }
110 |
111 | public Indicators.HMA HMA(ISeries input , int period)
112 | {
113 | return indicator.HMA(input, period);
114 | }
115 | }
116 | }
117 |
118 | namespace NinjaTrader.NinjaScript.Strategies
119 | {
120 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
121 | {
122 | public Indicators.HMA HMA(int period)
123 | {
124 | return indicator.HMA(Input, period);
125 | }
126 |
127 | public Indicators.HMA HMA(ISeries input , int period)
128 | {
129 | return indicator.HMA(input, period);
130 | }
131 | }
132 | }
133 |
134 | #endregion
135 |
--------------------------------------------------------------------------------
/Examples/Strategies/PlotHigherTimeFrame/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.16.3
5 |
6 |
--------------------------------------------------------------------------------
/Examples/Strategies/PlotHigherTimeFrame/Strategies/PlotHigherTimeFrame.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
27 | {
28 | public class PlotHigherTimeFrame : Strategy
29 | {
30 | private HMA myHMA;
31 | private HMA myHMA2;
32 | protected override void OnStateChange()
33 | {
34 | if (State == State.SetDefaults)
35 | {
36 | Description = @"Enter the description for your new custom Strategy here.";
37 | Name = "Plot Higher Time Frame indicator";
38 | }
39 | else if (State == State.Configure)
40 | {
41 | AddDataSeries(BarsPeriodType.Minute, 60);
42 | AddPlot(Brushes.Green, "HMA1");
43 | AddPlot(Brushes.Red, "HMA2");
44 | }
45 | else if (State == State.DataLoaded)
46 | {
47 | myHMA = HMA(Closes[1], 14);
48 | myHMA2 = HMA(Closes[1], 30);
49 | }
50 | }
51 |
52 | protected override void OnBarUpdate()
53 | {
54 | if(CurrentBars[1] < 30 || BarsInProgress != 0)
55 | return;
56 |
57 | if(CrossAbove(myHMA, myHMA2, 1))
58 | EnterLong();
59 | if(CrossBelow(myHMA, myHMA2, 1))
60 | EnterShort();
61 |
62 | // Use strategy plots to display higher time frame indicators
63 | Values[0][0] = myHMA[0];
64 | Values[1][0] = myHMA2[0];
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/Examples/Strategies/PsuedoOnExecutionPartialTest/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.17.1
5 |
6 |
--------------------------------------------------------------------------------
/Examples/Strategies/SampleAtmStrategyMultipleInstances/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.16.3
5 |
6 |
--------------------------------------------------------------------------------
/Examples/Strategies/StrategyAddIndicatorsToSamePanel/Indicators/@CCI.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2018, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// The Commodity Channel Index (CCI) measures the variation of a security's price
32 | /// from its statistical mean. High values show that prices are unusually high
33 | /// compared to average prices whereas low values indicate that prices are unusually low.
34 | ///
35 | public class CCI : Indicator
36 | {
37 | private SMA sma;
38 |
39 | protected override void OnStateChange()
40 | {
41 | if (State == State.SetDefaults)
42 | {
43 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionCCI;
44 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameCCI;
45 | IsSuspendedWhileInactive = true;
46 | Period = 14;
47 |
48 | AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameCCI);
49 | AddLine(Brushes.DarkGray, 200, NinjaTrader.Custom.Resource.CCILevel2);
50 | AddLine(Brushes.DarkGray, 100, NinjaTrader.Custom.Resource.CCILevel1);
51 | AddLine(Brushes.DarkGray, 0, NinjaTrader.Custom.Resource.NinjaScriptIndicatorZeroLine);
52 | AddLine(Brushes.DarkGray, -100, NinjaTrader.Custom.Resource.CCILevelMinus1);
53 | AddLine(Brushes.DarkGray, -200, NinjaTrader.Custom.Resource.CCILevelMinus2);
54 | }
55 | else if (State == State.DataLoaded)
56 | sma = SMA(Typical, Period);
57 | }
58 |
59 | protected override void OnBarUpdate()
60 | {
61 | if (CurrentBar == 0)
62 | Value[0] = 0;
63 | else
64 | {
65 | double mean = 0;
66 | double sma0 = sma[0];
67 |
68 | for (int idx = Math.Min(CurrentBar, Period - 1); idx >= 0; idx--)
69 | mean += Math.Abs(Typical[idx] - sma0);
70 |
71 | Value[0] = (Typical[0] - sma0) / (mean.ApproxCompare(0) == 0 ? 1 : (0.015 * (mean / Math.Min(Period, CurrentBar + 1))));
72 | }
73 | }
74 |
75 | #region Properties
76 | [Range(1, int.MaxValue), NinjaScriptProperty]
77 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
78 | public int Period
79 | { get; set; }
80 | #endregion
81 | }
82 | }
83 |
84 | #region NinjaScript generated code. Neither change nor remove.
85 |
86 | namespace NinjaTrader.NinjaScript.Indicators
87 | {
88 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
89 | {
90 | private CCI[] cacheCCI;
91 | public CCI CCI(int period)
92 | {
93 | return CCI(Input, period);
94 | }
95 |
96 | public CCI CCI(ISeries input, int period)
97 | {
98 | if (cacheCCI != null)
99 | for (int idx = 0; idx < cacheCCI.Length; idx++)
100 | if (cacheCCI[idx] != null && cacheCCI[idx].Period == period && cacheCCI[idx].EqualsInput(input))
101 | return cacheCCI[idx];
102 | return CacheIndicator(new CCI(){ Period = period }, input, ref cacheCCI);
103 | }
104 | }
105 | }
106 |
107 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
108 | {
109 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
110 | {
111 | public Indicators.CCI CCI(int period)
112 | {
113 | return indicator.CCI(Input, period);
114 | }
115 |
116 | public Indicators.CCI CCI(ISeries input , int period)
117 | {
118 | return indicator.CCI(input, period);
119 | }
120 | }
121 | }
122 |
123 | namespace NinjaTrader.NinjaScript.Strategies
124 | {
125 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
126 | {
127 | public Indicators.CCI CCI(int period)
128 | {
129 | return indicator.CCI(Input, period);
130 | }
131 |
132 | public Indicators.CCI CCI(ISeries input , int period)
133 | {
134 | return indicator.CCI(input, period);
135 | }
136 | }
137 | }
138 |
139 | #endregion
140 |
--------------------------------------------------------------------------------
/Examples/Strategies/StrategyAddIndicatorsToSamePanel/Indicators/@SMA.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2018, NinjaTrader LLC .
3 | // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
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.Data;
22 | using NinjaTrader.NinjaScript;
23 | using NinjaTrader.Core.FloatingPoint;
24 | using NinjaTrader.NinjaScript.DrawingTools;
25 | #endregion
26 |
27 | // This namespace holds indicators in this folder and is required. Do not change it.
28 | namespace NinjaTrader.NinjaScript.Indicators
29 | {
30 | ///
31 | /// The SMA (Simple Moving Average) is an indicator that shows the average value of a security's price over a period of time.
32 | ///
33 | public class SMA : Indicator
34 | {
35 | private double priorSum;
36 | private double sum;
37 |
38 | protected override void OnStateChange()
39 | {
40 | if (State == State.SetDefaults)
41 | {
42 | Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionSMA;
43 | Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameSMA;
44 | IsOverlay = true;
45 | IsSuspendedWhileInactive = true;
46 | Period = 14;
47 |
48 | AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNameSMA);
49 | }
50 | else if (State == State.Configure)
51 | {
52 | priorSum = 0;
53 | sum = 0;
54 | }
55 | }
56 |
57 | protected override void OnBarUpdate()
58 | {
59 | if (BarsArray[0].BarsType.IsRemoveLastBarSupported)
60 | {
61 | if (CurrentBar == 0)
62 | Value[0] = Input[0];
63 | else
64 | {
65 | double last = Value[1] * Math.Min(CurrentBar, Period);
66 |
67 | if (CurrentBar >= Period)
68 | Value[0] = (last + Input[0] - Input[Period]) / Math.Min(CurrentBar, Period);
69 | else
70 | Value[0] = ((last + Input[0]) / (Math.Min(CurrentBar, Period) + 1));
71 | }
72 | }
73 | else
74 | {
75 | if (IsFirstTickOfBar)
76 | priorSum = sum;
77 |
78 | sum = priorSum + Input[0] - (CurrentBar >= Period ? Input[Period] : 0);
79 | Value[0] = sum / (CurrentBar < Period ? CurrentBar + 1 : Period);
80 | }
81 | }
82 |
83 | #region Properties
84 | [Range(1, int.MaxValue), NinjaScriptProperty]
85 | [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
86 | public int Period
87 | { get; set; }
88 | #endregion
89 | }
90 | }
91 |
92 | #region NinjaScript generated code. Neither change nor remove.
93 |
94 | namespace NinjaTrader.NinjaScript.Indicators
95 | {
96 | public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
97 | {
98 | private SMA[] cacheSMA;
99 | public SMA SMA(int period)
100 | {
101 | return SMA(Input, period);
102 | }
103 |
104 | public SMA SMA(ISeries input, int period)
105 | {
106 | if (cacheSMA != null)
107 | for (int idx = 0; idx < cacheSMA.Length; idx++)
108 | if (cacheSMA[idx] != null && cacheSMA[idx].Period == period && cacheSMA[idx].EqualsInput(input))
109 | return cacheSMA[idx];
110 | return CacheIndicator(new SMA(){ Period = period }, input, ref cacheSMA);
111 | }
112 | }
113 | }
114 |
115 | namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
116 | {
117 | public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
118 | {
119 | public Indicators.SMA SMA(int period)
120 | {
121 | return indicator.SMA(Input, period);
122 | }
123 |
124 | public Indicators.SMA SMA(ISeries input , int period)
125 | {
126 | return indicator.SMA(input, period);
127 | }
128 | }
129 | }
130 |
131 | namespace NinjaTrader.NinjaScript.Strategies
132 | {
133 | public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
134 | {
135 | public Indicators.SMA SMA(int period)
136 | {
137 | return indicator.SMA(Input, period);
138 | }
139 |
140 | public Indicators.SMA SMA(ISeries input , int period)
141 | {
142 | return indicator.SMA(input, period);
143 | }
144 | }
145 | }
146 |
147 | #endregion
148 |
--------------------------------------------------------------------------------
/Examples/Strategies/StrategyAddIndicatorsToSamePanel/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.16.3
5 |
6 |
--------------------------------------------------------------------------------
/Examples/Strategies/StrategyAddIndicatorsToSamePanel/Strategies/StrategyAddIndicatorsToSamePanel.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
27 | {
28 | public class StrategyAddIndicatorsToSamePanel : Strategy
29 | {
30 | private CCI CCI1, CCI2;
31 | protected override void OnStateChange()
32 | {
33 | if (State == State.SetDefaults)
34 | {
35 | Description = @"Enter the description for your new custom Strategy here.";
36 | Name = "StrategyAddIndicatorsToSamePanel";
37 | Calculate = Calculate.OnBarClose;
38 | }
39 | else if (State == State.DataLoaded)
40 | {
41 | CCI1 = CCI(14);
42 | CCI2 = CCI(30);
43 |
44 | AddChartIndicator(CCI1);
45 | AddChartIndicator(CCI2);
46 |
47 | CCI1.Panel = 1;
48 | CCI2.Panel = 1;
49 | }
50 | }
51 |
52 | protected override void OnBarUpdate()
53 | {
54 | //Add your custom strategy logic here.
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/Projects/LabeledLines/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.16.3
5 |
6 |
--------------------------------------------------------------------------------
/Projects/SharpDXHelper/AddOns/CustomFilePicker.cs:
--------------------------------------------------------------------------------
1 | #region Using declarations
2 | using System;
3 | using System.Windows;
4 | using System.Windows.Controls.WpfPropertyGrid;
5 | using System.Windows.Markup;
6 | using Microsoft.Win32;
7 | #endregion
8 |
9 | namespace NinjaTrader.NinjaScript.AddOns
10 | {
11 | public class CustomFilePicker : PropertyEditor
12 | {
13 | public CustomFilePicker()
14 | {
15 | InlineTemplate = CreateTemplate();
16 | }
17 |
18 | DataTemplate CreateTemplate()
19 | {
20 | const string xamlTemplate =
21 | @"
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
37 |
38 |
41 |
42 |
43 |
44 |
45 | ";
46 |
47 |
48 | ParserContext context = new ParserContext();
49 | context.XmlnsDictionary.Add("", "http://schemas.microsoft.com/winfx/2006/xaml/presentation");
50 | context.XmlnsDictionary.Add("x", "http://schemas.microsoft.com/winfx/2006/xaml");
51 | context.XmlnsDictionary.Add("pg", "http://schemas.denisvuyka.wordpress.com/wpfpropertygrid");
52 | DataTemplate template = (DataTemplate)XamlReader.Parse(xamlTemplate, context);
53 | return template;
54 | }
55 |
56 | public override void ClearValue(PropertyItemValue propertyValue, IInputElement commandSource)
57 | {
58 | if (propertyValue == null || propertyValue.IsReadOnly)
59 | {
60 | return;
61 | }
62 | propertyValue.StringValue = string.Empty;
63 | }
64 |
65 | public override void ShowDialog(PropertyItemValue propertyValue, IInputElement commandSource)
66 | {
67 | PropertyGrid propGrid = commandSource as PropertyGrid;
68 | string lastPath = propertyValue.StringValue;
69 | if (propGrid == null) return;
70 |
71 | OpenFileDialog openFileDialog = new OpenFileDialog();
72 | openFileDialog.Filter = "All files (*.*)|*.*";
73 | openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
74 | openFileDialog.ShowDialog();
75 |
76 | propertyValue.StringValue = openFileDialog.FileName != String.Empty ? openFileDialog.FileName : lastPath; // change this string and compile, the ui does not see this change
77 | propGrid.DoReload();
78 | propGrid.RaiseEvent(new PropertyValueChangedEventArgs(PropertyGrid.PropertyValueChangedEvent, propertyValue.ParentProperty, ""));
79 | }
80 | }
81 | }
--------------------------------------------------------------------------------
/Projects/SharpDXHelper/AdditionalReferences.txt:
--------------------------------------------------------------------------------
1 | *ProgramFiles*\NinjaTrader 8\bin64\System.Windows.Controls.WpfPropertyGrid.dll
2 |
--------------------------------------------------------------------------------
/Projects/SharpDXHelper/Info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 8.0.14.2
5 |
6 |
--------------------------------------------------------------------------------