• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.


No announcement yet.

Partner 728x90


Indicator called from strategy not drawing devices

  • Filter
  • Time
  • Show
Clear All
new posts

    Indicator called from strategy not drawing devices

    Hey guys,

    I have a custom indicator that draws a device (either diamonds, dots or whatever the user wants) on the main panel of a chart at an appropriate place. It works like a champ. That's all it does - it doesn't draw anything else, not plots, not anything.

    The first attached image is what the indicator is supposed to look like - it works when I use it like a regular indicator on a chart. (Ignore the text)

    The second attached image is what I'm getting. It shows T or F where the bool Series shows what the values are. Where there is a "T" is where there should be a device.

    However, when I call this indicator from a strategy, I can't get it to draw the devices. It's supposed to draw diamonds by default but if you set it to a different device, it won't draw those either.

    I've stepped through the code in VS and I come to this method:

    private static T ChartMarkerCore<T>(NinjaScriptBase owner, string tag, bool isAutoScale, 
    		int barsAgo, DateTime time, double yVal, Brush brush, bool isGlobal, string templateName) where T : ChartMarker
    			if (owner == null)
    				throw new ArgumentException("owner");
    			if (time == Core.Globals.MinDate && time == Core.Globals.MinDate && barsAgo == int.MinValue)
    				throw new ArgumentException("bad start/end date/time");
    			if (yVal.ApproxCompare(double.MinValue) == 0 || yVal.ApproxCompare(double.MaxValue) == 0)
    				throw new ArgumentException("bad Y value");
    			if (isGlobal && tag[0] != GlobalDrawingToolManager.GlobalDrawingToolTagPrefix)
    				tag = string.Format("{0}{1}", GlobalDrawingToolManager.GlobalDrawingToolTagPrefix, tag);
    			T chartMarkerT = DrawingTool.GetByTagOrNew(owner, typeof(T), tag, templateName) as T;
    			if (chartMarkerT == null)
    				return default(T);
    What's happening is chartMarkerT is null and we're returning and not drawing anything. The execution makes it through the exception traps.

    I have included my indicator and a test strategy if you want to try to reproduce this. I'm not sure if the problem is me or not but since the devices plot as expected if you use the indicator as a straight-out indicator and not when you call it in as simple a strategy as I can put together, I'm thinking it may not be me.

    Thanks guys!
    Attached Files
    Last edited by traderpards; 10-14-2015, 01:19 PM.


    Thank you for sharing the issue with us. I can reproduce the issue at will on my end, as well. What I've found thus far is that the issue appears to come from your use of Draw.Text in the strategy. Without the calls to Draw.Text, your indicator plots its devices as expected for me, but when using Draw.Text in the strategy, the indicator does not plot its devices.

    I am going to continue to investigate this today, and I will post back here with any updates as to the cause or any action items on our end.

    UPDATE: I was able to reproduce this with simplified test scripts, to verify that the issue does indeed come from the use of drawing methods in both the indicator and the strategy. I have reported this to our team with tracking ID # NTEIGHT-8965.
    Last edited by NinjaTrader_DaveI; 10-14-2015, 11:09 AM.
    Dave I.NinjaTrader Product Management


      Thanks! Glad it wasn't me... And I noticed a second too late that there is a thread for posting issues. I tried to delete this and repost elsewhere but I couldn't figure out how to delete this. Sorry about that!


        I'm happy to report that NTEIGHT-8965 has been resolved in our latest internal build, and you should see the fix applied in the Beta 6 build.
        Dave I.NinjaTrader Product Management


        Latest Posts


        Topics Statistics Last Post
        Started by teafortwo, Today, 04:26 AM
        4 responses
        Last Post bltdavid  
        Started by borjanews, Today, 06:13 PM
        0 responses
        Last Post borjanews  
        Started by Austiner87, Today, 05:13 PM
        0 responses
        Last Post Austiner87  
        Started by Austiner87, Today, 04:59 PM
        0 responses
        Last Post Austiner87  
        Started by Austiner87, Today, 04:58 PM
        0 responses
        1 view
        Last Post Austiner87