I am trying to add the SimpleFont font type and size to my Draw.Text line where I call the current bar length. Unfortunately I am getting the error message: No overloaded method Text uses this number of arguments (11) (CS1501).
I have tried various approaches but I can´t get it work.
I have used part of the SampleChangeFont Inidcator and included it in my code. There the font type etc. works, but not on my Draw.Text line.
public class EMABarLength : Indicator { // private NinjaTrader.Gui.Tools.SimpleFont myFont; private SimpleFont largeFont; // This variable holds the large font. [Range(1, int.MaxValue), NinjaScriptProperty] public int TextOffset { get; set; } protected override void OnStateChange() { if (State == State.SetDefaults) { Name = "EMA Bar Length"; IsOverlay = true; TextOffset = 10; largeFont = new Gui.Tools.SimpleFont("Arial", 12); Calculate = Calculate.OnPriceChange; } // myFont = new NinjaTrader.Gui.Tools.SimpleFont("Arial", 12) { Size = 10, Bold = false }; // Instrument.MasterInstrument.PriceChange += OnPriceChange; } protected override void OnBarUpdate() { if (CurrentBar == Bars.Count -1) { Draw.Text(this, "BarLength" + CurrentBar, Math.Round((High[0] - Low[0]) / TickSize).ToString(), 0, Low[0] - (TickSize * TextOffset), Brushes.Gray); } if (CurrentBar < Bars.Count - 5) return; // Draw.Text(this, "BarLength" + CurrentBar, Math.Round((High[0] - Low[0]) / TickSize).ToString(), 0, Low[0] - (TickSize * TextOffset), 0, Brushes.LightSeaGreen, myFont, TextAlignment.Center, Brushes.Transparent, Brushes.Transparent, 100); // Draw.Text(this, "highText", true, High[0].ToString(), 1, High[0] + 2 * TickSize, 0, Brushes.Green, largeFont, TextAlignment.Justify, Brushes.Transparent, Brushes.Transparent, 0); Draw.Text(this, "BarLength" + CurrentBar, Math.Round((High[0] - Low[0]) / TickSize).ToString(), 0, Low[0] - (TickSize * TextOffset), Brushes.Gray, largeFont, TextAlignment.Justify, Brushes.Transparent, Brushes.Transparent, 0); } } }
Thanks!
Peter
Comment