Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

display in data box but not on chart

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

    display in data box but not on chart

    I am doing cycle counts on the Stoch. I've written an indicator that plots the stochastic the way I want.

    I would like to count cycles and display in the Data Box, but don't want them to display on the chart. Can I do that?

    I can also write a separate indicator, but would prefer to have it as one indicator


    #2
    Hi cre8able, thanks for writing in.

    You would need to have two scripts for this. The databox-only script will implement a plot and plot the values in OnBarUpdate normally, but will also override OnRender and simply return from OnRender to cancel out the plot rendering. This would make the plot show up in the data box but not the chart.

    Please let me know if you have any further questions,
    -ChrisL

    Comment


      #3
      hey Chris.

      thanks makes sense but how do I go about changing OnRender()?

      like this?

      protected override void OnRender(ChartControl char tControl, ChartScale chartScale)
      {
      Return();
      }

      Comment


        #4
        Hi cre8able, thanks for your reply.

        That is correct, returning from the OnRender override will prevent the indicator from rendering any graphics to the chart so the plot will only show up in the data box.

        Comment


          #5
          Hello,

          could you please provide, how exactly the code is written for this? I need the same. There is no exact example in the library for OnRender.

          AND

          another question, i would like to get a button in the chart, to switch it on and off, that the indicator is vivible if i would like to check something and when the strategy is running I don´t need to see it, a button would be the perfect solution.
          Last edited by Triple_M; 08-17-2023, 04:06 AM.

          Comment


            #6
            Hello Triple_M,

            Welcome to the NinjaTrader forums!

            cre8able had some some minor syntax errors that would prevent compile. The 'return' is not a method and is not capitalized.
            Code:
            protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
            {
                return;
            }

            See the heading 'Return values' in the microsoft programming guide on c#.
            A method in C# is a code block that contains a series of statements. A program runs the statements by calling the method and specifying arguments.


            Attached is an example with the code from post # 3 corrected and copied and pasted in.
            NoRenderPlotLineTest_NT8.zip
            Attached Files
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by CarlTrading, 03-31-2026, 09:41 PM
            1 response
            80 views
            1 like
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            40 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            63 views
            2 likes
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            63 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            54 views
            0 likes
            Last Post CarlTrading  
            Working...
            X