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

Moving Data between Indicators

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

    Moving Data between Indicators

    I think I have made an error here.

    In one indicator I put this code

    Code:
            [Browsable(false)]    
            [XmlIgnore()]        
            public int binary
            {
                get { return Binary; }
            }

    And the other I put this initialize

    Code:
            protected override void Initialize()
            {    
        
    //            dbconnection =new SqlConnection(ConnectionString);
    //            dbconnection.Open();
                
                DATA1 = Absorption(2000).binary;
    Then this is onbarupdate

    So its not updating, what am I doing wrong.

    This is working on tick by tick basis, so I have a timer loop on the 2 indicator, the one that will do the collection.

    Do I have to use update.xx somewhere and if so, will mean the 2n indicator will force the 1st indicator to calc the whole script?

    Thanks

    Tinkerz

    #2
    Hello Tinkerz,

    The basic framework for this is available in the following sample:


    Yes, for any non *Series value you would like to expose, you will need to force an Update() call in the get accessor.

    We typically use convention public = uppercase, and private = lowercase, but as long as you are accessing the public value from another script, it should be fine.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      I noticed by chance that declaring

      public static double Binary=0;

      in 2 or more indicators, but in only 1 indicator placing data in it, then the other 2 or more will collect it.

      Tinkerz

      Comment


        #4
        Here is how I did it


        Make sure this is nested in namespace

        namespace NinjaTrader.Indicator
        {
        public static class GlobalVar
        {
        static double _globalValue;

        public static double GlobalValue
        {
        get { return _globalValue;
        }
        set { _globalValue = value; }
        }
        }

        Then calling from another indicator

        Total[0] = GlobalVar.GlobalValue;

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Segwin, 05-07-2018, 02:15 PM
        14 responses
        1,789 views
        0 likes
        Last Post aligator  
        Started by Jimmyk, 01-26-2018, 05:19 AM
        6 responses
        837 views
        0 likes
        Last Post emuns
        by emuns
         
        Started by jxs_xrj, 01-12-2020, 09:49 AM
        6 responses
        3,293 views
        1 like
        Last Post jgualdronc  
        Started by Touch-Ups, Today, 10:36 AM
        0 responses
        13 views
        0 likes
        Last Post Touch-Ups  
        Started by geddyisodin, 04-25-2024, 05:20 AM
        11 responses
        63 views
        0 likes
        Last Post halgo_boulder  
        Working...
        X