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 NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    56 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    132 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    73 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    49 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X