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 geddyisodin, 04-25-2024, 05:20 AM
        8 responses
        58 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by halgo_boulder, 04-20-2024, 08:44 AM
        2 responses
        21 views
        0 likes
        Last Post halgo_boulder  
        Started by mishhh, 05-25-2010, 08:54 AM
        19 responses
        6,189 views
        0 likes
        Last Post rene69851  
        Started by gwenael, Today, 09:29 AM
        0 responses
        5 views
        0 likes
        Last Post gwenael
        by gwenael
         
        Started by Karado58, 11-26-2012, 02:57 PM
        8 responses
        14,830 views
        0 likes
        Last Post Option Whisperer  
        Working...
        X