Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Adding a multi-timeframe instrument via variable integer vs. absolute integer

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

    Adding a multi-timeframe instrument via variable integer vs. absolute integer

    All,

    An interesting anomaly in adding a multi-time frame instrument using the standard
    Code:
    Add("^SP500",PeriodType.Minute,5);
    versus
    Code:
    Add("^SP500",PeriodType.Minute, Period); 
       where "Period" is defined in the variables region as "private int Period = 5;
    Where the absolute "5" period is used all behaves as expected, with the following code showing the 15min Primary dataseries updating and the added 5min Secondary dataseries updating each 5mins. Where the variable integer "Period" is used the below code shows the 15min Primary dataseries updating and the added 5min Secondary dataseries updating each 1min.

    Code:
    if (FirstTickOfBar)
    {
      if(BarsInProgress >= 0 && BarsInProgress <= 3) 
      {
        Print (BarsInProgress + " - " + Time.ToString() 
      }
      else
      {
        Print("Unexpected value for BarsInProgress: " + BarsInProgress);
      }
    }
    Any ideas are welcome.

    Regards
    Shannon

    #2
    Shannon, please try printing BarsPeriod.Value to check which ones are added with your script - http://www.ninjatrader-support.com/H...arsPeriod.html

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by kinfxhk, 07-14-2026, 09:39 AM
    0 responses
    127 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 10:18 AM
    0 responses
    105 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 09:50 AM
    0 responses
    85 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 07:21 AM
    0 responses
    105 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-11-2026, 02:11 AM
    0 responses
    86 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X