I am using the latest NT8.0.22 version.
I have written an indicator that part of easier debug prints the Bar index on top of each bar and print Z1, Z2, Z3, etc. based on some algorithem.
It also generates two data series to be used by the strategy that will use it
The indicator itself draw text with no problem on the Chart (marked in Arrows two type of text drawing i do). However when i include this indicator i made to a strategy it will not draw any text from the strategy itself. Also it looks as if i am unable to extract the data from its two data series that the indicator generates (not 100% sure about this part).
The function and variables in the indicator responsible to draw the text is:
// ----------------- Text Fonts size & color -----------------
private Brush textBrush = Brushes.DimGray;
private Brush DrawText_ZigZagWeightBrush = Brushes.OrangeRed;
private Gui.Tools.SimpleFont BarNumFont = new Gui.Tools.SimpleFont() { Size = 10 };
private Gui.Tools.SimpleFont DrawText_ZigZagWeightFont = new Gui.Tools.SimpleFont() { Size = 14 };
//================================================== =========
// Draw text on Chart
//================================================== =========
private void Draw_BarNum(string text, int barsAgo, double y_Axis, int yOffset)
{
Draw.Text(this, text + CurrentBar, false, text, barsAgo, y_Axis, yOffset, textBrush, BarNumFont, TextAlignment.Center, Brushes.Transparent, Brushes.Transparent, 0);
}
code snippets from my strategy
=======================
public class DualZigZagReversalEK : Strategy
{
private NinjaTrader.NinjaScript.Indicators.EK.DualZigZag _DualZigZag;
.........
protected override void OnStateChange()
{
.....
.....
....
else if (State == State.DataLoaded)
{
_DualZigZag = DualZigZag(Close, 10, 20);
When i try to debug it using Visual Studio i get the following when the indicator is calling my function "Draw_BarNum()" to text draw the bar.
I press F11 in the debugger and enter into Draw.Text method.The method will exit on txt=null (not my text some internal vars).
Any idea what is the problem?
public static partial class Draw
{
private static Text TextCore(NinjaScriptBase owner, string tag, bool autoScale, string text,
int barsAgo, DateTime time, double y, int? yPixelOffset, Brush textBrush, TextAlignment? textAlignment,
Gui.Tools.SimpleFont font, Brush outlineBrush, Brush areaBrush, int? areaOpacity, bool isGlobal, string templateName,
DashStyleHelper outlineDashStyle, int outlineWidth)
{
if (barsAgo == int.MinValue && time == Core.Globals.MinDate)
throw new ArgumentException("Text: Bad barsAgo/time parameters");
if (string.IsNullOrWhiteSpace(tag))
throw new ArgumentException(@"tag cant be null or empty", "tag");
if (isGlobal && tag[0] != GlobalDrawingToolManager.GlobalDrawingToolTagPrefi x)
tag = GlobalDrawingToolManager.GlobalDrawingToolTagPrefi x + tag;
Text txt = DrawingTool.GetByTagOrNew(owner, typeof(Text), tag, templateName) as Text;
if (txt == null)
return null; <----- txt is NULL so the method exit and dont continue to draw.
Comment