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 PropTraderz, Today, 05:54 PM
    0 responses
    4 views
    0 likes
    Last Post PropTraderz  
    Started by several, Today, 06:19 AM
    10 responses
    25 views
    0 likes
    Last Post several
    by several
     
    Started by PropTraderz, Today, 05:19 PM
    0 responses
    7 views
    0 likes
    Last Post PropTraderz  
    Started by zagier, 01-15-2025, 05:10 AM
    12 responses
    54 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by td_910, 06-22-2022, 11:54 AM
    10 responses
    147 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Working...
    X