Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Where do i place some variables ?

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

    Where do i place some variables ?

    Hello,
    when some variables are only to be initiated once; before the "on bar update"; where are they to be set ?
    And is this true for all types of variables ?

    #2
    Hi mate41,

    Best practice here is to declare all variables in the Variables region.

    For actions you want to take only once before OnBarUpdate(), there is dedicated handler OnStartup()
    http://www.ninjatrader.com/support/h.../onstartup.htm
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      RyanM,
      mm.... seems doesn't work:
      protected override void OnStartUp()
      {
      sess_Open = CurrentDayOHL().CurrentOpen[0];
      }
      sess_Open as a variable(double) under Variables.

      Comment


        #4
        OnStartup() is called before OnBarUpdate() so you do not have access to bar objects there.

        If you're trying to access indicator or bar values, will need to access in OnBarUpdate().
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by fmcap, Today, 10:49 PM
        0 responses
        1 view
        0 likes
        Last Post fmcap
        by fmcap
         
        Started by iradielt, Today, 10:06 PM
        0 responses
        2 views
        0 likes
        Last Post iradielt  
        Started by gbajaj, Today, 03:35 PM
        2 responses
        11 views
        0 likes
        Last Post gbajaj
        by gbajaj
         
        Started by space_trader, Today, 03:19 PM
        2 responses
        8 views
        0 likes
        Last Post space_trader  
        Started by max1ci6, Today, 02:02 AM
        4 responses
        28 views
        0 likes
        Last Post joromero  
        Working...
        X