From 9135112ebc542c9fa1b9e0f1164b2dc717255549 Mon Sep 17 00:00:00 2001 From: moshferatu Date: Thu, 11 Jul 2024 12:06:42 -0700 Subject: [PATCH] Removing all properties besides the opening range period and type from the indicator constructor --- indicators/OpeningRange.cs | 83 ++++++-------------------------------- 1 file changed, 13 insertions(+), 70 deletions(-) diff --git a/indicators/OpeningRange.cs b/indicators/OpeningRange.cs index 2ffe71d..7fa2d6a 100644 --- a/indicators/OpeningRange.cs +++ b/indicators/OpeningRange.cs @@ -14,7 +14,6 @@ using System.Windows.Media; using System.Xml.Serialization; #endregion -//This namespace holds Indicators in this folder and is required. Do not change it. namespace NinjaTrader.NinjaScript.Indicators { public class OR @@ -474,20 +473,16 @@ namespace NinjaTrader.NinjaScript.Indicators public OpeningRangeBarType OpeningRangeType { get; set; } - [NinjaScriptProperty] [RefreshProperties(RefreshProperties.All)] [Display(Name = "Enable Extensions", Description = "Whether to enable opening range extensions", Order = 3, GroupName = "Opening Range")] public bool EnableExtensions { get; set; } - [NinjaScriptProperty] [Display(Name = "Number of Extensions", Description = "Number of extensions above and below the opening range", Order = 4, GroupName = "Opening Range")] public int NumberOfExtensions { get; set; } - [NinjaScriptProperty] [Display(Name = "Extension Multiplier", Description = "Multiplier used for calculating extension levels", Order = 5, GroupName = "Opening Range")] public double ExtensionMultiplier { get; set; } - [NinjaScriptProperty] [PropertyEditor("NinjaTrader.Gui.Tools.StringStandardValuesEditorKey")] [TypeConverter(typeof(OpeningRangeColorSchemeConverter))] [RefreshProperties(RefreshProperties.All)] @@ -495,53 +490,43 @@ namespace NinjaTrader.NinjaScript.Indicators public OpeningRangeColorScheme ColorScheme { get; set; } - [NinjaScriptProperty] [Display(Name = "Price Above", Description = "Opening range lines drawn on chart when price is > ORH", Order = 2, GroupName = "Appearance")] public Stroke PriceAboveStroke { get; set; } - [NinjaScriptProperty] [Display(Name = "Price Below", Description = "Opening range lines drawn on chart when price is < ORL", Order = 3, GroupName = "Appearance")] public Stroke PriceBelowStroke { get; set; } - [NinjaScriptProperty] [Display(Name = "Price Inside", Description = "Opening range lines drawn on chart when price is inside OR", Order = 4, GroupName = "Appearance")] public Stroke PriceInsideStroke { get; set; } - [NinjaScriptProperty] [Display(Name = "Opening Range High", Description = "Opening range high line drawn on chart", Order = 5, GroupName = "Appearance")] public Stroke OpeningRangeHighStroke { get; set; } - [NinjaScriptProperty] [Display(Name = "Opening Range Mid", Description = "Opening range mid line drawn on chart", Order = 6, GroupName = "Appearance")] public Stroke OpeningRangeMidStroke { get; set; } - [NinjaScriptProperty] [Display(Name = "Opening Range Low", Description = "Opening range low line drawn on chart", Order = 7, GroupName = "Appearance")] public Stroke OpeningRangeLowStroke { get; set; } - [NinjaScriptProperty] [Display(Name = "Extension", Description = "Opening range extensions lines drawn on chart", Order = 8, GroupName = "Appearance")] public Stroke ExtensionStroke { get; set; } - [NinjaScriptProperty] [Display(Name = "Show Labels", Order = 1, GroupName = "Labels")] public bool ShowLabels { get; set; } - [NinjaScriptProperty] [Display(Name = "Font", Description = "Font used to display the opening range labels", Order = 2, GroupName = "Labels")] public SimpleFont OpeningRangeFont { get; set; } [XmlIgnore] - [NinjaScriptProperty] [Display(Name = "Font Color", Description = "Color of the text used to label the opening range levels", Order = 3, GroupName = "Labels")] public Brush OpeningRangeFontColor { get; set; } @@ -553,32 +538,26 @@ namespace NinjaTrader.NinjaScript.Indicators set { OpeningRangeFontColor = Serialize.StringToBrush(value); } } - [NinjaScriptProperty] [Display(Name = "Opening Range High", Order = 4, GroupName = "Labels")] public string OpeningRangeHighLabel { get; set; } - [NinjaScriptProperty] [Display(Name = " Label Position", Order = 5, GroupName = "Labels")] public OpeningRangeLabelPosition OpeningRangeHighLabelPosition { get; set; } - [NinjaScriptProperty] [Display(Name = "Opening Range Mid", Order = 6, GroupName = "Labels")] public string OpeningRangeMidLabel { get; set; } - [NinjaScriptProperty] [Display(Name = " Label Position", Order = 7, GroupName = "Labels")] public OpeningRangeLabelPosition OpeningRangeMidLabelPosition { get; set; } - [NinjaScriptProperty] [Display(Name = "Opening Range Low", Order = 8, GroupName = "Labels")] public string OpeningRangeLowLabel { get; set; } - [NinjaScriptProperty] [Display(Name = " Label Position", Order = 9, GroupName = "Labels")] public OpeningRangeLabelPosition OpeningRangeLowLabelPosition { get; set; } @@ -730,42 +709,6 @@ public enum OpeningRangeLabelPosition Center } -// Creates an easy to use constructor for use in strategies. -namespace NinjaTrader.NinjaScript.Strategies -{ - public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase - { - public Indicators.OpeningRange OpeningRange(int openingRangePeriod, OpeningRangeBarType openingRangeType) - { - return indicator.OpeningRange( - Input, - openingRangePeriod, - openingRangeType, - Indicators.OpeningRange.DefaultEnableExtensions, - Indicators.OpeningRange.DefaultNumberOfExtensions, - Indicators.OpeningRange.DefaultExtensionMultiplier, - Indicators.OpeningRange.DefaultOpeningRangeColorScheme, - Indicators.OpeningRange.DefaultPriceAboveStroke, - Indicators.OpeningRange.DefaultPriceBelowStroke, - Indicators.OpeningRange.DefaultPriceInsideStroke, - Indicators.OpeningRange.DefaultOpeningRangeStroke, - Indicators.OpeningRange.DefaultOpeningRangeMidStroke, - Indicators.OpeningRange.DefaultOpeningRangeStroke, - Indicators.OpeningRange.DefaultExtensionStroke, - Indicators.OpeningRange.DefaultShowLabels, - Indicators.OpeningRange.DefaultOpeningRangeFont, - Indicators.OpeningRange.DefaultOpeningRangeFontColor, - Indicators.OpeningRange.DefaultOpeningRangeHighLabel, - Indicators.OpeningRange.DefaultOpeningRangeLabelPosition, - Indicators.OpeningRange.DefaultOpeningRangeMidLabel, - Indicators.OpeningRange.DefaultOpeningRangeLabelPosition, - Indicators.OpeningRange.DefaultOpeningRangeLowLabel, - Indicators.OpeningRange.DefaultOpeningRangeLabelPosition - ); - } - } -} - #region NinjaScript generated code. Neither change nor remove. namespace NinjaTrader.NinjaScript.Indicators @@ -773,18 +716,18 @@ namespace NinjaTrader.NinjaScript.Indicators public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase { private OpeningRange[] cacheOpeningRange; - public OpeningRange OpeningRange(int openingRangePeriod, OpeningRangeBarType openingRangeType, bool enableExtensions, int numberOfExtensions, double extensionMultiplier, OpeningRangeColorScheme colorScheme, Stroke priceAboveStroke, Stroke priceBelowStroke, Stroke priceInsideStroke, Stroke openingRangeHighStroke, Stroke openingRangeMidStroke, Stroke openingRangeLowStroke, Stroke extensionStroke, bool showLabels, SimpleFont openingRangeFont, Brush openingRangeFontColor, string openingRangeHighLabel, OpeningRangeLabelPosition openingRangeHighLabelPosition, string openingRangeMidLabel, OpeningRangeLabelPosition openingRangeMidLabelPosition, string openingRangeLowLabel, OpeningRangeLabelPosition openingRangeLowLabelPosition) + public OpeningRange OpeningRange(int openingRangePeriod, OpeningRangeBarType openingRangeType) { - return OpeningRange(Input, openingRangePeriod, openingRangeType, enableExtensions, numberOfExtensions, extensionMultiplier, colorScheme, priceAboveStroke, priceBelowStroke, priceInsideStroke, openingRangeHighStroke, openingRangeMidStroke, openingRangeLowStroke, extensionStroke, showLabels, openingRangeFont, openingRangeFontColor, openingRangeHighLabel, openingRangeHighLabelPosition, openingRangeMidLabel, openingRangeMidLabelPosition, openingRangeLowLabel, openingRangeLowLabelPosition); + return OpeningRange(Input, openingRangePeriod, openingRangeType); } - public OpeningRange OpeningRange(ISeries input, int openingRangePeriod, OpeningRangeBarType openingRangeType, bool enableExtensions, int numberOfExtensions, double extensionMultiplier, OpeningRangeColorScheme colorScheme, Stroke priceAboveStroke, Stroke priceBelowStroke, Stroke priceInsideStroke, Stroke openingRangeHighStroke, Stroke openingRangeMidStroke, Stroke openingRangeLowStroke, Stroke extensionStroke, bool showLabels, SimpleFont openingRangeFont, Brush openingRangeFontColor, string openingRangeHighLabel, OpeningRangeLabelPosition openingRangeHighLabelPosition, string openingRangeMidLabel, OpeningRangeLabelPosition openingRangeMidLabelPosition, string openingRangeLowLabel, OpeningRangeLabelPosition openingRangeLowLabelPosition) + public OpeningRange OpeningRange(ISeries input, int openingRangePeriod, OpeningRangeBarType openingRangeType) { if (cacheOpeningRange != null) for (int idx = 0; idx < cacheOpeningRange.Length; idx++) - if (cacheOpeningRange[idx] != null && cacheOpeningRange[idx].OpeningRangePeriod == openingRangePeriod && cacheOpeningRange[idx].OpeningRangeType == openingRangeType && cacheOpeningRange[idx].EnableExtensions == enableExtensions && cacheOpeningRange[idx].NumberOfExtensions == numberOfExtensions && cacheOpeningRange[idx].ExtensionMultiplier == extensionMultiplier && cacheOpeningRange[idx].ColorScheme == colorScheme && cacheOpeningRange[idx].PriceAboveStroke == priceAboveStroke && cacheOpeningRange[idx].PriceBelowStroke == priceBelowStroke && cacheOpeningRange[idx].PriceInsideStroke == priceInsideStroke && cacheOpeningRange[idx].OpeningRangeHighStroke == openingRangeHighStroke && cacheOpeningRange[idx].OpeningRangeMidStroke == openingRangeMidStroke && cacheOpeningRange[idx].OpeningRangeLowStroke == openingRangeLowStroke && cacheOpeningRange[idx].ExtensionStroke == extensionStroke && cacheOpeningRange[idx].ShowLabels == showLabels && cacheOpeningRange[idx].OpeningRangeFont == openingRangeFont && cacheOpeningRange[idx].OpeningRangeFontColor == openingRangeFontColor && cacheOpeningRange[idx].OpeningRangeHighLabel == openingRangeHighLabel && cacheOpeningRange[idx].OpeningRangeHighLabelPosition == openingRangeHighLabelPosition && cacheOpeningRange[idx].OpeningRangeMidLabel == openingRangeMidLabel && cacheOpeningRange[idx].OpeningRangeMidLabelPosition == openingRangeMidLabelPosition && cacheOpeningRange[idx].OpeningRangeLowLabel == openingRangeLowLabel && cacheOpeningRange[idx].OpeningRangeLowLabelPosition == openingRangeLowLabelPosition && cacheOpeningRange[idx].EqualsInput(input)) + if (cacheOpeningRange[idx] != null && cacheOpeningRange[idx].OpeningRangePeriod == openingRangePeriod && cacheOpeningRange[idx].OpeningRangeType == openingRangeType && cacheOpeningRange[idx].EqualsInput(input)) return cacheOpeningRange[idx]; - return CacheIndicator(new OpeningRange(){ OpeningRangePeriod = openingRangePeriod, OpeningRangeType = openingRangeType, EnableExtensions = enableExtensions, NumberOfExtensions = numberOfExtensions, ExtensionMultiplier = extensionMultiplier, ColorScheme = colorScheme, PriceAboveStroke = priceAboveStroke, PriceBelowStroke = priceBelowStroke, PriceInsideStroke = priceInsideStroke, OpeningRangeHighStroke = openingRangeHighStroke, OpeningRangeMidStroke = openingRangeMidStroke, OpeningRangeLowStroke = openingRangeLowStroke, ExtensionStroke = extensionStroke, ShowLabels = showLabels, OpeningRangeFont = openingRangeFont, OpeningRangeFontColor = openingRangeFontColor, OpeningRangeHighLabel = openingRangeHighLabel, OpeningRangeHighLabelPosition = openingRangeHighLabelPosition, OpeningRangeMidLabel = openingRangeMidLabel, OpeningRangeMidLabelPosition = openingRangeMidLabelPosition, OpeningRangeLowLabel = openingRangeLowLabel, OpeningRangeLowLabelPosition = openingRangeLowLabelPosition }, input, ref cacheOpeningRange); + return CacheIndicator(new OpeningRange(){ OpeningRangePeriod = openingRangePeriod, OpeningRangeType = openingRangeType }, input, ref cacheOpeningRange); } } } @@ -793,14 +736,14 @@ namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns { public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase { - public Indicators.OpeningRange OpeningRange(int openingRangePeriod, OpeningRangeBarType openingRangeType, bool enableExtensions, int numberOfExtensions, double extensionMultiplier, OpeningRangeColorScheme colorScheme, Stroke priceAboveStroke, Stroke priceBelowStroke, Stroke priceInsideStroke, Stroke openingRangeHighStroke, Stroke openingRangeMidStroke, Stroke openingRangeLowStroke, Stroke extensionStroke, bool showLabels, SimpleFont openingRangeFont, Brush openingRangeFontColor, string openingRangeHighLabel, OpeningRangeLabelPosition openingRangeHighLabelPosition, string openingRangeMidLabel, OpeningRangeLabelPosition openingRangeMidLabelPosition, string openingRangeLowLabel, OpeningRangeLabelPosition openingRangeLowLabelPosition) + public Indicators.OpeningRange OpeningRange(int openingRangePeriod, OpeningRangeBarType openingRangeType) { - return indicator.OpeningRange(Input, openingRangePeriod, openingRangeType, enableExtensions, numberOfExtensions, extensionMultiplier, colorScheme, priceAboveStroke, priceBelowStroke, priceInsideStroke, openingRangeHighStroke, openingRangeMidStroke, openingRangeLowStroke, extensionStroke, showLabels, openingRangeFont, openingRangeFontColor, openingRangeHighLabel, openingRangeHighLabelPosition, openingRangeMidLabel, openingRangeMidLabelPosition, openingRangeLowLabel, openingRangeLowLabelPosition); + return indicator.OpeningRange(Input, openingRangePeriod, openingRangeType); } - public Indicators.OpeningRange OpeningRange(ISeries input , int openingRangePeriod, OpeningRangeBarType openingRangeType, bool enableExtensions, int numberOfExtensions, double extensionMultiplier, OpeningRangeColorScheme colorScheme, Stroke priceAboveStroke, Stroke priceBelowStroke, Stroke priceInsideStroke, Stroke openingRangeHighStroke, Stroke openingRangeMidStroke, Stroke openingRangeLowStroke, Stroke extensionStroke, bool showLabels, SimpleFont openingRangeFont, Brush openingRangeFontColor, string openingRangeHighLabel, OpeningRangeLabelPosition openingRangeHighLabelPosition, string openingRangeMidLabel, OpeningRangeLabelPosition openingRangeMidLabelPosition, string openingRangeLowLabel, OpeningRangeLabelPosition openingRangeLowLabelPosition) + public Indicators.OpeningRange OpeningRange(ISeries input , int openingRangePeriod, OpeningRangeBarType openingRangeType) { - return indicator.OpeningRange(input, openingRangePeriod, openingRangeType, enableExtensions, numberOfExtensions, extensionMultiplier, colorScheme, priceAboveStroke, priceBelowStroke, priceInsideStroke, openingRangeHighStroke, openingRangeMidStroke, openingRangeLowStroke, extensionStroke, showLabels, openingRangeFont, openingRangeFontColor, openingRangeHighLabel, openingRangeHighLabelPosition, openingRangeMidLabel, openingRangeMidLabelPosition, openingRangeLowLabel, openingRangeLowLabelPosition); + return indicator.OpeningRange(input, openingRangePeriod, openingRangeType); } } } @@ -809,14 +752,14 @@ namespace NinjaTrader.NinjaScript.Strategies { public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase { - public Indicators.OpeningRange OpeningRange(int openingRangePeriod, OpeningRangeBarType openingRangeType, bool enableExtensions, int numberOfExtensions, double extensionMultiplier, OpeningRangeColorScheme colorScheme, Stroke priceAboveStroke, Stroke priceBelowStroke, Stroke priceInsideStroke, Stroke openingRangeHighStroke, Stroke openingRangeMidStroke, Stroke openingRangeLowStroke, Stroke extensionStroke, bool showLabels, SimpleFont openingRangeFont, Brush openingRangeFontColor, string openingRangeHighLabel, OpeningRangeLabelPosition openingRangeHighLabelPosition, string openingRangeMidLabel, OpeningRangeLabelPosition openingRangeMidLabelPosition, string openingRangeLowLabel, OpeningRangeLabelPosition openingRangeLowLabelPosition) + public Indicators.OpeningRange OpeningRange(int openingRangePeriod, OpeningRangeBarType openingRangeType) { - return indicator.OpeningRange(Input, openingRangePeriod, openingRangeType, enableExtensions, numberOfExtensions, extensionMultiplier, colorScheme, priceAboveStroke, priceBelowStroke, priceInsideStroke, openingRangeHighStroke, openingRangeMidStroke, openingRangeLowStroke, extensionStroke, showLabels, openingRangeFont, openingRangeFontColor, openingRangeHighLabel, openingRangeHighLabelPosition, openingRangeMidLabel, openingRangeMidLabelPosition, openingRangeLowLabel, openingRangeLowLabelPosition); + return indicator.OpeningRange(Input, openingRangePeriod, openingRangeType); } - public Indicators.OpeningRange OpeningRange(ISeries input , int openingRangePeriod, OpeningRangeBarType openingRangeType, bool enableExtensions, int numberOfExtensions, double extensionMultiplier, OpeningRangeColorScheme colorScheme, Stroke priceAboveStroke, Stroke priceBelowStroke, Stroke priceInsideStroke, Stroke openingRangeHighStroke, Stroke openingRangeMidStroke, Stroke openingRangeLowStroke, Stroke extensionStroke, bool showLabels, SimpleFont openingRangeFont, Brush openingRangeFontColor, string openingRangeHighLabel, OpeningRangeLabelPosition openingRangeHighLabelPosition, string openingRangeMidLabel, OpeningRangeLabelPosition openingRangeMidLabelPosition, string openingRangeLowLabel, OpeningRangeLabelPosition openingRangeLowLabelPosition) + public Indicators.OpeningRange OpeningRange(ISeries input , int openingRangePeriod, OpeningRangeBarType openingRangeType) { - return indicator.OpeningRange(input, openingRangePeriod, openingRangeType, enableExtensions, numberOfExtensions, extensionMultiplier, colorScheme, priceAboveStroke, priceBelowStroke, priceInsideStroke, openingRangeHighStroke, openingRangeMidStroke, openingRangeLowStroke, extensionStroke, showLabels, openingRangeFont, openingRangeFontColor, openingRangeHighLabel, openingRangeHighLabelPosition, openingRangeMidLabel, openingRangeMidLabelPosition, openingRangeLowLabel, openingRangeLowLabelPosition); + return indicator.OpeningRange(input, openingRangePeriod, openingRangeType); } } }