Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnRender() AGAIN! and other custom functions

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

    OnRender() AGAIN! and other custom functions

    Hello!
    I have drawn rectangles successfully in a custom function that I call in OnBarUpdate(). I am very limited with this way since I can not draw texts next to my recatngles. OnRender() would be a perfect solution, but before modifying my huge code, I would like to have some help here on how to deal with it.

    I have the following:
    HTML Code:
    protected override void OnBarUpdate()
    {
         if(NewBar() == true)
        {
             DrawMyRectangles();
        }
    }
    #region Helpers
    void DrawMyRectangles()
    {}
    #endregion
    The function OnRender() is like OnBarUpdate() a "protected override void". How can I call this function in OnBarUpdate(), replacing by this way the fucntion DrawMyRectangles();? Is it possible? If not, could someone please guide me here by pointing out how to fix the problem? I am wondering if I can simply write the code of the function DrawMyRectangles(); directy in OnRender() without having to call it in OnBarUpdate() anymore?

    Also, I use to draw texts in OnRender(), but these texts are till now fixed texts. Is there a documentation on how to draw texts in OnRender() base on Time[0] for example? That mean, these texts would be dynamic. What could be the syntax of the function writing the dynamic text in OnRender()?

    Many thanks!
    Last edited by Stanfillirenfro; 04-17-2023, 10:16 AM.

    #2
    Hello Stanfillirenfro,

    Thank you for your post.

    Based on your description, you should run any calculations directly in OnBarUpdate() or use DrawMyRectangles() to run any needed calculations, then use OnRender() to visually render your rectangles. For more details, I suggest reviewing the following resources:NinjaTrader comes with the indicator "SampleCustomRender" which you may review for an example of different concepts in OnRender().

    Please let us know if we may be of further assistance.

    Comment


      #3
      Many thanks NinjaTrader_Emily for your reply and valuable help.

      I will revert to you for sure after having a look on the details!

      Thanks!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      651 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      370 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      109 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      574 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      577 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X