Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

AddDataSeries Clarification

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

    AddDataSeries Clarification

    What on earth am I missing?????

    Code:
                else if (State == State.Configure)
                {
                    AddDataSeries("NQ MAR25", Data.BarsPeriodType.Minute, 5, Data.MarketDataType.Last);  // [1]
                    AddDataSeries("NQ MAR25", Data.BarsPeriodType.Minute, 60, Data.MarketDataType.Last);  // [2]
                    AddDataSeries(BarsPeriodType.Day, 1);  // [3]
    ​
    Code:
                
    Print("SMA10 of 60 min: " + SMA(BarsArray[2], 10)[0] + " SMA20 of 60min: " + SMA(BarsArray[2], 20)[0]);
    ​
    SMA10 of 60 min: 21630.5 SMA20 of 60 min: 21250.5

    This is correct

    When I try to get the 10 and 20 SMA of the daily, I get the SAME value for both the 10Daily SMA and the 20 daily SMA, and on the daily chart, they are NOT the same!!! grrrr

    Code:
                
    Print("SMA10 of Daily: " + SMA(BarsArray[3], 10)[0] + " SMA20 of Daily: " + SMA(BarsArray[3], 20)[0]);
    ​


    SMA10 of Daily: 21630.5 SMA20 of Daily: 21630.5
    Last edited by nelslynn; 01-10-2025, 08:15 PM.

    #2
    Hello nelslynn,

    I would expect the value of both indicators to be the same until there are more than 10 bars of BarsArray[3]. (As before there are more than 10 bars, both series would have 10 bars or less to process)

    What is the value of CurrentBars[3] when these values are produced?
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by kinfxhk, 07-13-2026, 10:18 AM
    0 responses
    58 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 09:50 AM
    0 responses
    41 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 07:21 AM
    0 responses
    46 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-11-2026, 02:11 AM
    0 responses
    37 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    157 views
    0 likes
    Last Post SalmaTrader  
    Working...
    X