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

pass values between scripts with public

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

    pass values between scripts with public

    Hi all


    Is it possible to post values between realtime scripts, ie to make an index or plot a value from one indicator to another plot using public statement?

    if so any examples

    thanks

    tinkerz

    #2
    tinkerz,

    What you can do is expose values which you can access from other scripts. To do so please see here: http://www.ninjatrader.com/support/f...ead.php?t=4991

    If the value you are trying to share is already a plot then its already accessible from your other scripts. Just like how you can call SMA(20)[0] from any script, you can call any plot from your own indicators from other scripts.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks, for this, I would like to plot the result from the //send to and indicator, I am not sure i need to add it into and indicator though?

      I will run the //send in real time and just want to collect the result

      //collect
      // Add(FullOrderBookDS());
      Plot0.Set(FullOrderBookDS().SendBidBookAVG);

      //send
      #region Properties
      [Browsable(false)]
      [XmlIgnore()]
      public double SendAskBookAVG
      {
      // We need to call the Update() method to ensure our exposed variable is in up-to-date.
      get { Update(); return AskBookAVG; }
      }

      Comment


        #4
        tinkerz,

        All you need to do is expose a property for the variable you want other indicators to have access to. There is no "sending" per se. Rather there is accessing to it. The accessing is done in the other script.

        In my prior post there should be a reference sample link that shows you an exposed bool variable being accessed by a strategy. How you expose that bool would be done the same way for doubles and how you access it from the strategy would be done the same way too.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          When I use Add I am opening a script, then i can get access to the public function, to in effect I am running the script, it just "hidden"?

          Comment


            #6
            tinkerz,

            Add() from a strategy to add an indicator just adds that indicator onto the chart for visualizations. You do not need to use Add() to add an indicator to access its methods and properties. You can just directly access the indicator right away without Add() being a prerequisite.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              but you run the script in effect in the background?

              Comment


                #8
                Correct. It will be run in the background if accessed.
                Josh P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by ghoul, Today, 06:02 PM
                3 responses
                14 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by jeronymite, 04-12-2024, 04:26 PM
                3 responses
                44 views
                0 likes
                Last Post jeronymite  
                Started by Barry Milan, Yesterday, 10:35 PM
                7 responses
                20 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by AttiM, 02-14-2024, 05:20 PM
                10 responses
                180 views
                0 likes
                Last Post jeronymite  
                Started by DanielSanMartin, Yesterday, 02:37 PM
                2 responses
                13 views
                0 likes
                Last Post DanielSanMartin  
                Working...
                X