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 op1031, Yesterday, 05:16 PM
        1 response
        8 views
        0 likes
        Last Post NT-Roland  
        Started by sinpeople, Today, 07:20 AM
        1 response
        3 views
        0 likes
        Last Post NT-Roland  
        Started by Frank1000, Today, 03:05 AM
        1 response
        7 views
        0 likes
        Last Post NT-Roland  
        Started by ntdev, Today, 01:14 AM
        4 responses
        16 views
        0 likes
        Last Post ntdev
        by ntdev
         
        Started by ct, Today, 02:22 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_Jason  
        Working...
        X