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 sjsj2732, Yesterday, 04:31 AM
    0 responses
    33 views
    0 likes
    Last Post sjsj2732  
    Started by NullPointStrategies, 03-13-2026, 05:17 AM
    0 responses
    286 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    284 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    133 views
    1 like
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    91 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Working...
    X