Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Global Objects Issue

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

    Global Objects Issue

    Code:
    Draw.Text(this,"vv"+CurrentBar,s,0,y,false,"CrimFill");
    If I draw the above applying my Template "CrimFill" the text shows up; if I change the template CrimFill" to Attach to all Charts - it disappears from the original chart and does not appear on other charts?
    My Charts have the setting Show Global Draw Objects ticked so I am mystified.
    This behaviour happens if I simply draw text randomly and apply the Template as well.

    #2
    Update - Ok so If I reset the template to be on All Charts it works historically but not in real time?
    Ah Ok so my CrossHairs also no longer work in Global - so it's a bigger issue.
    I shall repair and see if that solves the issue.
    Last edited by Mindset; 03-17-2025, 06:33 AM.

    Comment


      #3
      Ok so a repair seems to have fixed it.

      Comment


        #4
        Ok so it's repeating the same issue again.

        Comment


          #5
          Hello Mindset,

          Try;

          Draw.Text(this,"vv"+CurrentBar,s,0,y,true,"CrimFill");
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            yes I tried that Chelsea - Im having some serious issues with this - It now only plots live on the volumetric chart, and historically on other charts -whether I have true or false. Makes no difference.
            I shall persevere as at one stage I had it working but it was sucking up resources at a phenomenal rate as it was plotting all the objects and I am trying to restrict it to visible bars only.

            Code:
            string s = (calc.ToString("N2"));
                                double y = High[0]+TickSize*2;
                                if(Close[0] < Open[0])
                                    y = Low[0] -TickSize *2;​
             int firstVisibleBar = ChartBars.FromIndex;
                int lastVisibleBar = ChartBars.ToIndex;    
            // Check if the current bar is within the visible range
                if (CurrentBar >= firstVisibleBar && CurrentBar <= lastVisibleBar)
                {
                                {
                                    if(calc > deltaThreshold)
                                      
                                    
                                        Draw.Text(this,"vv"+( CurrentBar),s,0,y,true,"CrimFill");
                                
                              
                                }
            ​
            Last edited by Mindset; 03-17-2025, 12:11 PM.

            Comment


              #7
              Hello Mindset,

              Drawing tool methods should not be called from OnRender() and should be called from a data driven method only.
              OnRender() is for custom rendering only.
              The visible chart bars will only be relevant in OnRender() so would not be applicable here.

              I've made a test script and I'm not seeing an issue with just a few objects.
              GlobalTemplateTest_NT8.zip

              If you are planning on having a large amount of shapes or text, it would be recommended to custom render the shapes and text and not Drawing tool methods.
              Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.

              Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.

              Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.

              Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.


              An example of rendering text can be found on the User App Share.
              Simple script that adds a background watermark of the instrument symbol (and expiry if a future) to the chart. (Updated July 10th, 2018 &dash; The opacity needed to be casted as a double and divided by 100 to be between 0 and 1) (Update: August 24th, 2021 &#8211; Subtracted the ChartPanel.Y so indicator can be [&#8230;]


              An example of rendering a scrollable object can be found on the forum here:
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Ah ok thanks for that - did not know about Drawing inside OnRender. I will alter my code accordingly.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                55 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                37 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                17 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                19 views
                0 likes
                Last Post TheRealMorford  
                Started by Mindset, 02-28-2026, 06:16 AM
                0 responses
                49 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Working...
                X