Announcement

Collapse
No announcement yet.

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 Hwop38, 05-04-2026, 07:02 PM
        0 responses
        164 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        318 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        246 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        350 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        179 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Working...
        X