Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator Draw Objects not Appearing

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Indicator Draw Objects not Appearing

    Hi,

    I have developed an indicator that draws rectangular drawing objects onto the chart.

    Click image for larger version

Name:	Screenshot 2021-01-06 at 15.37.08.png
Views:	345
Size:	142.6 KB
ID:	1135332

    I have set a parameter (Zone Charting Start Date) in the Indicator properties window to determine how far back in the historical data to look when calculating were these rectangular drawing objects are to be drawn from. The default is 5 days.

    Sample Code:
    // if bar time is earlier than the Zone Charting Start Date then do not chart
    if (DateTime.Compare(Time[0],ZoneChartingStartDateTime) < 0)
    return;


    There are a number of rules that determine if the rectangular drawing object will be drawn and these are all managed by a bespoke class object (PullBack) that I have set up. These class objects are created and updated on each OnBarUpdate event and multiple class objects are stored in a list (PullBacks) until such time as all the rules are validated or a rule is invalid.
    Sample Code:
    private PullBackClass PullBack;
    private List<PullBackClass> PullBacks;

    If a rule becomes invalid then the class object is removed from the list

    Sample Code:
    PullBacks.RemoveAt(i);

    If all rules are validated then the rectangular drawing object is drawn

    Sample Code:
    Draw.Rectangle(this, "LAXZone" + PullBacks[i].PBStartSwingValue, false, PullBacks[i].PBSBarsBack, PullBacks[i].PBStartSwingValue, 0, PullBacks[i].PBEndSwingValue, Brushes.Transparent, Brushes.LightBlue, 60);

    The indicator is meant to be used on Futures Instruments at small intervals (133 Tick).

    The problem I am encountering is that for some unknown reason the rectangular drawing objects are not being drawn at this Tick interval (eg: 133) but will be drawn at high Tick intervals (eg: 150 Tick). However, this problem is not consistant as it works fine on some computers but does not work on other computers.

    Could this problem be caused by there being too many drawing objects & class objects being created in the lower timeframes?
    Do I need to do some sort of "house cleaning"?
    Is this a computer resource issue (eg: memory)? ​​​​

    Other than these thoughts I do not know what could be causing this problem. Does anyone have any ideas on the root cause of this problem?

    Attached Files

    #2
    Hello MarkF60,

    Drawing objects are drawn on the primary series only at whatever primary series bar number, or bar date and price is provided.

    If the drawn objects are not appearing on the expect bars, this would be due to the logic supplying those primary bar number or date and price values to the Draw method.

    Use prints to see what bars ago and price values for the primary series are being supplied by the logic.


    Print the time of the bar, and print the values being supplied to the draw method.

    Save the output to a text file and post this with your next post, let us know what values are incorrect and what values are you expecting, and we will be happy to assist with analyzing the output.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I have now found the root cause of the problem. Thanks for your advice

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      585 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      340 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      103 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      554 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      552 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X