Removing all properties besides the opening range period and type from the indicator constructor

This commit is contained in:
moshferatu 2024-07-11 12:06:42 -07:00
parent a77f3f9288
commit 9135112ebc

View File

@ -14,7 +14,6 @@ using System.Windows.Media;
using System.Xml.Serialization; using System.Xml.Serialization;
#endregion #endregion
//This namespace holds Indicators in this folder and is required. Do not change it.
namespace NinjaTrader.NinjaScript.Indicators namespace NinjaTrader.NinjaScript.Indicators
{ {
public class OR public class OR
@ -474,20 +473,16 @@ namespace NinjaTrader.NinjaScript.Indicators
public OpeningRangeBarType OpeningRangeType public OpeningRangeBarType OpeningRangeType
{ get; set; } { get; set; }
[NinjaScriptProperty]
[RefreshProperties(RefreshProperties.All)] [RefreshProperties(RefreshProperties.All)]
[Display(Name = "Enable Extensions", Description = "Whether to enable opening range extensions", Order = 3, GroupName = "Opening Range")] [Display(Name = "Enable Extensions", Description = "Whether to enable opening range extensions", Order = 3, GroupName = "Opening Range")]
public bool EnableExtensions { get; set; } 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")] [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; } public int NumberOfExtensions { get; set; }
[NinjaScriptProperty]
[Display(Name = "Extension Multiplier", Description = "Multiplier used for calculating extension levels", Order = 5, GroupName = "Opening Range")] [Display(Name = "Extension Multiplier", Description = "Multiplier used for calculating extension levels", Order = 5, GroupName = "Opening Range")]
public double ExtensionMultiplier { get; set; } public double ExtensionMultiplier { get; set; }
[NinjaScriptProperty]
[PropertyEditor("NinjaTrader.Gui.Tools.StringStandardValuesEditorKey")] [PropertyEditor("NinjaTrader.Gui.Tools.StringStandardValuesEditorKey")]
[TypeConverter(typeof(OpeningRangeColorSchemeConverter))] [TypeConverter(typeof(OpeningRangeColorSchemeConverter))]
[RefreshProperties(RefreshProperties.All)] [RefreshProperties(RefreshProperties.All)]
@ -495,53 +490,43 @@ namespace NinjaTrader.NinjaScript.Indicators
public OpeningRangeColorScheme ColorScheme public OpeningRangeColorScheme ColorScheme
{ get; set; } { get; set; }
[NinjaScriptProperty]
[Display(Name = "Price Above", Description = "Opening range lines drawn on chart when price is > ORH", Order = 2, GroupName = "Appearance")] [Display(Name = "Price Above", Description = "Opening range lines drawn on chart when price is > ORH", Order = 2, GroupName = "Appearance")]
public Stroke PriceAboveStroke public Stroke PriceAboveStroke
{ get; set; } { get; set; }
[NinjaScriptProperty]
[Display(Name = "Price Below", Description = "Opening range lines drawn on chart when price is < ORL", Order = 3, GroupName = "Appearance")] [Display(Name = "Price Below", Description = "Opening range lines drawn on chart when price is < ORL", Order = 3, GroupName = "Appearance")]
public Stroke PriceBelowStroke public Stroke PriceBelowStroke
{ get; set; } { get; set; }
[NinjaScriptProperty]
[Display(Name = "Price Inside", Description = "Opening range lines drawn on chart when price is inside OR", Order = 4, GroupName = "Appearance")] [Display(Name = "Price Inside", Description = "Opening range lines drawn on chart when price is inside OR", Order = 4, GroupName = "Appearance")]
public Stroke PriceInsideStroke public Stroke PriceInsideStroke
{ get; set; } { get; set; }
[NinjaScriptProperty]
[Display(Name = "Opening Range High", Description = "Opening range high line drawn on chart", Order = 5, GroupName = "Appearance")] [Display(Name = "Opening Range High", Description = "Opening range high line drawn on chart", Order = 5, GroupName = "Appearance")]
public Stroke OpeningRangeHighStroke public Stroke OpeningRangeHighStroke
{ get; set; } { get; set; }
[NinjaScriptProperty]
[Display(Name = "Opening Range Mid", Description = "Opening range mid line drawn on chart", Order = 6, GroupName = "Appearance")] [Display(Name = "Opening Range Mid", Description = "Opening range mid line drawn on chart", Order = 6, GroupName = "Appearance")]
public Stroke OpeningRangeMidStroke public Stroke OpeningRangeMidStroke
{ get; set; } { get; set; }
[NinjaScriptProperty]
[Display(Name = "Opening Range Low", Description = "Opening range low line drawn on chart", Order = 7, GroupName = "Appearance")] [Display(Name = "Opening Range Low", Description = "Opening range low line drawn on chart", Order = 7, GroupName = "Appearance")]
public Stroke OpeningRangeLowStroke public Stroke OpeningRangeLowStroke
{ get; set; } { get; set; }
[NinjaScriptProperty]
[Display(Name = "Extension", Description = "Opening range extensions lines drawn on chart", Order = 8, GroupName = "Appearance")] [Display(Name = "Extension", Description = "Opening range extensions lines drawn on chart", Order = 8, GroupName = "Appearance")]
public Stroke ExtensionStroke public Stroke ExtensionStroke
{ get; set; } { get; set; }
[NinjaScriptProperty]
[Display(Name = "Show Labels", Order = 1, GroupName = "Labels")] [Display(Name = "Show Labels", Order = 1, GroupName = "Labels")]
public bool ShowLabels public bool ShowLabels
{ get; set; } { get; set; }
[NinjaScriptProperty]
[Display(Name = "Font", Description = "Font used to display the opening range labels", Order = 2, GroupName = "Labels")] [Display(Name = "Font", Description = "Font used to display the opening range labels", Order = 2, GroupName = "Labels")]
public SimpleFont OpeningRangeFont public SimpleFont OpeningRangeFont
{ get; set; } { get; set; }
[XmlIgnore] [XmlIgnore]
[NinjaScriptProperty]
[Display(Name = "Font Color", Description = "Color of the text used to label the opening range levels", Order = 3, GroupName = "Labels")] [Display(Name = "Font Color", Description = "Color of the text used to label the opening range levels", Order = 3, GroupName = "Labels")]
public Brush OpeningRangeFontColor public Brush OpeningRangeFontColor
{ get; set; } { get; set; }
@ -553,32 +538,26 @@ namespace NinjaTrader.NinjaScript.Indicators
set { OpeningRangeFontColor = Serialize.StringToBrush(value); } set { OpeningRangeFontColor = Serialize.StringToBrush(value); }
} }
[NinjaScriptProperty]
[Display(Name = "Opening Range High", Order = 4, GroupName = "Labels")] [Display(Name = "Opening Range High", Order = 4, GroupName = "Labels")]
public string OpeningRangeHighLabel public string OpeningRangeHighLabel
{ get; set; } { get; set; }
[NinjaScriptProperty]
[Display(Name = " Label Position", Order = 5, GroupName = "Labels")] [Display(Name = " Label Position", Order = 5, GroupName = "Labels")]
public OpeningRangeLabelPosition OpeningRangeHighLabelPosition public OpeningRangeLabelPosition OpeningRangeHighLabelPosition
{ get; set; } { get; set; }
[NinjaScriptProperty]
[Display(Name = "Opening Range Mid", Order = 6, GroupName = "Labels")] [Display(Name = "Opening Range Mid", Order = 6, GroupName = "Labels")]
public string OpeningRangeMidLabel public string OpeningRangeMidLabel
{ get; set; } { get; set; }
[NinjaScriptProperty]
[Display(Name = " Label Position", Order = 7, GroupName = "Labels")] [Display(Name = " Label Position", Order = 7, GroupName = "Labels")]
public OpeningRangeLabelPosition OpeningRangeMidLabelPosition public OpeningRangeLabelPosition OpeningRangeMidLabelPosition
{ get; set; } { get; set; }
[NinjaScriptProperty]
[Display(Name = "Opening Range Low", Order = 8, GroupName = "Labels")] [Display(Name = "Opening Range Low", Order = 8, GroupName = "Labels")]
public string OpeningRangeLowLabel public string OpeningRangeLowLabel
{ get; set; } { get; set; }
[NinjaScriptProperty]
[Display(Name = " Label Position", Order = 9, GroupName = "Labels")] [Display(Name = " Label Position", Order = 9, GroupName = "Labels")]
public OpeningRangeLabelPosition OpeningRangeLowLabelPosition public OpeningRangeLabelPosition OpeningRangeLowLabelPosition
{ get; set; } { get; set; }
@ -730,42 +709,6 @@ public enum OpeningRangeLabelPosition
Center 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. #region NinjaScript generated code. Neither change nor remove.
namespace NinjaTrader.NinjaScript.Indicators namespace NinjaTrader.NinjaScript.Indicators
@ -773,18 +716,18 @@ namespace NinjaTrader.NinjaScript.Indicators
public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
{ {
private OpeningRange[] cacheOpeningRange; 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<double> 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<double> input, int openingRangePeriod, OpeningRangeBarType openingRangeType)
{ {
if (cacheOpeningRange != null) if (cacheOpeningRange != null)
for (int idx = 0; idx < cacheOpeningRange.Length; idx++) 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 cacheOpeningRange[idx];
return CacheIndicator<OpeningRange>(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<OpeningRange>(new OpeningRange(){ OpeningRangePeriod = openingRangePeriod, OpeningRangeType = openingRangeType }, input, ref cacheOpeningRange);
} }
} }
} }
@ -793,14 +736,14 @@ namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
{ {
public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase 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<double> 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<double> 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 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<double> 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<double> 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);
} }
} }
} }