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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    43 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    30 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    48 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    38 views
    0 likes
    Last Post CarlTrading  
    Working...
    X