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 CaptainJack, 05-29-2026, 05:09 AM
    0 responses
    226 views
    0 likes
    Last Post CaptainJack  
    Started by CaptainJack, 05-29-2026, 12:02 AM
    0 responses
    144 views
    0 likes
    Last Post CaptainJack  
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    157 views
    1 like
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    237 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    196 views
    0 likes
    Last Post CarlTrading  
    Working...
    X