Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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
    BertrandNinjaTrader Customer Service

    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?
        BertrandNinjaTrader Customer Service

        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.
            BertrandNinjaTrader Customer Service

            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.
                BertrandNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by traderqz, Today, 12:06 AM
                6 responses
                12 views
                0 likes
                Last Post traderqz  
                Started by Skifree, Today, 03:41 AM
                3 responses
                12 views
                0 likes
                Last Post Skifree
                by Skifree
                 
                Started by traderqz, Yesterday, 09:06 AM
                5 responses
                33 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by guillembm, Today, 11:25 AM
                1 response
                6 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by owensd, 04-21-2024, 11:34 PM
                9 responses
                34 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Working...
                X