Announcement

Collapse
No announcement yet.

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 fredrikn, 05-08-2019, 04:01 AM
                57 responses
                4,389 views
                2 likes
                Last Post Momentum  
                Started by Blairski, Yesterday, 09:19 AM
                2 responses
                11 views
                0 likes
                Last Post Blairski  
                Started by tonynt, Today, 09:33 AM
                1 response
                6 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by minotti1, Today, 08:31 AM
                1 response
                13 views
                0 likes
                Last Post NinjaTrader_Jim  
                Started by SmartArtsStudio, 05-15-2021, 10:46 AM
                1 response
                15 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Working...
                X