Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Understanding IdataSeries .

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

    Understanding IdataSeries .

    I am trying to use the foollowing condition:
    if (CrossBelow(Highs[1][0], SMA (BarsArray[1],SMACycle)[0],1))

    compiler shows me this error;
    argument 2 cannot convert from double to NT idataseries?

    How to fix it and what does this error means?

    #2
    Hi dafonseca,

    Highs[1][0] has a bars ago value '[0]' which means this will return a double that is the value of the SMA on the current bar. The same is true of SMA(BarsArray[1],SMACycle)[0].

    This means that you are trying to detect when a double value (which does not change) crosses another double value (which also will not change). In other words there is no data series to detect a cross on as a cross detection looks to see if the first value from a bar ago is less than the second value a bar ago and then the first value from the current bar is greater than the second value from the current bar.

    The crossabove/crossbelow needs at least one dataseries but I think you want two dataseries.

    Try instead:
    Code:
    if (CrossBelow(Highs[1], SMA(BarsArray[1],SMACycle),1))
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    83 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    45 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    65 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    68 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    57 views
    0 likes
    Last Post CarlTrading  
    Working...
    X