Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Question about public override void Plot()

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

    Question about public override void Plot()

    Hello.

    I've got a script that uses "public override void Plot()". I want to put that code in the OnBarUpdate() section. I want to do that because I want to pass a value, calculated in the Plot() method to a StringSeries variable. Then I can access that variable from a strategy.

    Currently, if I create a StringSeries variable in the Plot() section the value is not accessible from a strategy.

    It seems that the StringSeries variable has to be in the OnBarUpdate() section to work properly.

    If that is correct how do I put the "public override void Plot()" code in the OnBarUpdate() section?

    I'm attaching the code.

    Thanks
    Attached Files

    #2
    rcsingleton, you will need to ensure your StringSeries is properly exposed so it could then be accessed from other scripts - http://www.ninjatrader.com/support/f...ead.php?t=4991

    Comment


      #3
      hi Bertrand,

      I've done that. I've put "private StringSeries haDir" and "haDir = new StringSeries(this)" and the correct code in #Properties section.

      That doesn't change anything. There is something about the fact that any value that is generated outside of OnBarUpdate() is just not accessible from another script.

      The StringSeries value has to be in OnBarUpdate(). So isn't there anyway to eliminate the "public override void Plot()" and put that code in OnBarUpdate()?
      Last edited by rcsingleton; 04-18-2011, 08:25 AM.

      Comment


        #4
        Your understanding is correct rcsingleton - the custom visualization is done here by overriding the default Plot method, the values themselves underlying would be calculated still in OnBarUpdate() so I feel you should be able to calculate your custom logic there, too?

        Comment


          #5
          hello.

          Yes, we are on the same page. I just need a little direction on how to put the override Plot() code in the OnBarUpdate() section.

          I'm not sure of the syntax. Can I just move the Plot() code inside of OnBarUpdate() and remove the "public override Plot()" entry?

          Can you give me a coding example of how to do that?

          Thanks

          Comment


            #6
            I would not have a sample unfortunately as there's no general concept here involved to move code developed for overriding the Plot method to the OnBarUpdate() - what you would need to do is developing your calculation output with the series available to you in OnBarUpdate(), then you could also expose those for access from another script.

            Comment


              #7
              Yes, but I need a result that is calculated in Plot() in order to calculate the StringSeries value. Because its override VOID Plot() I can't return that result back to OnBarUpdate() in order to calculate the StringSeries value.

              Can override VOID Plot() be changed to "override string Plot()" so I can return a value?

              Comment


                #8
                I would unfortunately not be aware of a way, as the support of the overriden Plot method is very limited - we provide working examples for coders who want to look into this area.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                579 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                334 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                101 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
                551 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X