Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Where do i place some variables ?

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

  • NinjaTrader_RyanM1
    replied
    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().

    Leave a comment:


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

    Leave a comment:


  • NinjaTrader_RyanM1
    replied
    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

    Leave a comment:


  • mate41
    started a topic Where do i place some variables ?

    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 ?

Latest Posts

Collapse

Topics Statistics Last Post
Started by fmcap, Today, 10:49 PM
0 responses
2 views
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