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 charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      68 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      150 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      162 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      100 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      288 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Working...
      X