sorry for my English which is not a language that I master (thanks Google).
I've been trying for a few days, by going through forum posts especially, to place a colored area in an indicator that I found on a platform. (thanks to its creator)
My idea was simple, to have a color zone between my high Donchian channel 100 and the one at 50 and a color zone between my low Donchian channel 100 and 50.
Not succeeding in combining the two I got my hands on a indicator grouping the two Donchian channels into a single code.
I'm trying to use Draw Region, but I don't understand how or where. I just want a simple modification but it's a gas plant!
I peeled the help, various message and download indicators which color the regions to understand, but I always have errors and if I post today it is good for a last resort.
I don't want to learn to code, to have a simple colored region on my graph.
I'm using the MaCrossBuilder indicator as an example as well, and although I noted the lines of codes, I don't understand what I need to change
https://ninjatraderecosystem.com/use...color-regions/
https://ninjatrader.com/support/help...t8/?region.htm
#region Using declarations using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Input; using System.Windows.Media; using System.Xml.Serialization; using NinjaTrader.Cbi; using NinjaTrader.Gui; using NinjaTrader.Gui.Chart; using NinjaTrader.Gui.SuperDom; using NinjaTrader.Gui.Tools; using NinjaTrader.Data; using NinjaTrader.NinjaScript; using NinjaTrader.Core.FloatingPoint; using NinjaTrader.NinjaScript.DrawingTools; #endregion //This namespace holds Indicators in this folder and is required. Do not change it. namespace NinjaTrader.NinjaScript.Indicators { public class TASCDonchianNT8 : Indicator { protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @""; Name = "TASCDonchianNT8"; Calculate = Calculate.OnBarClose; IsOverlay = true; DisplayInDataBox = true; DrawOnPricePanel = true; DrawHorizontalGridLines = true; DrawVerticalGridLines = true; PaintPriceMarkers = true; ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right; //Disable this property if your indicator requires custom values that cumulate with each new market data event. //See Help Guide for additional information. IsSuspendedWhileInactive = true; Len1 = 100; Len2 = 50; } else if (State == State.Configure) { AddPlot(Brushes.Green, "LongUpper"); AddPlot(Brushes.Violet, "ShortUpper"); AddPlot(Brushes.Violet, "ShortLower"); AddPlot(Brushes.Green, "LongLower"); } } protected override void OnBarUpdate() { Values[0][0] = MAX(High, Len1)[0]; Values[1][0] = MAX(High, Len2)[0]; Values[2][0] = MIN(Low, Len2)[0]; Values[3][0] = MIN(Low, Len1)[0]; } #region Properties [Range(1, int.MaxValue), NinjaScriptProperty] [Display(ResourceType = typeof(Custom.Resource), Name = "Len1", GroupName = "NinjaScriptParameters", Order = 0)] public int Len1 { get; set; } [Range(1, int.MaxValue), NinjaScriptProperty] [Display(ResourceType = typeof(Custom.Resource), Name = "Len2", GroupName = "NinjaScriptParameters", Order = 0)] public int Len2 { get; set; } #endregion } } #region NinjaScript generated code. Neither change nor remove. namespace NinjaTrader.NinjaScript.Indicators { public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase { private TASCDonchianNT8[] cacheTASCDonchianNT8; public TASCDonchianNT8 TASCDonchianNT8(int len1, int len2) { return TASCDonchianNT8(Input, len1, len2); } public TASCDonchianNT8 TASCDonchianNT8(ISeries<double> input, int len1, int len2) { if (cacheTASCDonchianNT8 != null) for (int idx = 0; idx < cacheTASCDonchianNT8.Length; idx++) if (cacheTASCDonchianNT8[idx] != null && cacheTASCDonchianNT8[idx].Len1 == len1 && cacheTASCDonchianNT8[idx].Len2 == len2 && cacheTASCDonchianNT8[idx].EqualsInput(input)) return cacheTASCDonchianNT8[idx]; return CacheIndicator<TASCDonchianNT8>(new TASCDonchianNT8(){ Len1 = len1, Len2 = len2 }, input, ref cacheTASCDonchianNT8); } } } namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns { public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase { public Indicators.TASCDonchianNT8 TASCDonchianNT8(int len1, int len2) { return indicator.TASCDonchianNT8(Input, len1, len2); } public Indicators.TASCDonchianNT8 TASCDonchianNT8(ISeries<double> input , int len1, int len2) { return indicator.TASCDonchianNT8(input, len1, len2); } } } namespace NinjaTrader.NinjaScript.Strategies { public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase { public Indicators.TASCDonchianNT8 TASCDonchianNT8(int len1, int len2) { return indicator.TASCDonchianNT8(Input, len1, len2); } public Indicators.TASCDonchianNT8 TASCDonchianNT8(ISeries<double> input , int len1, int len2) { return indicator.TASCDonchianNT8(input, len1, len2); } } } #endregion
Comment