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 Hwop38, 05-04-2026, 07:02 PM
    0 responses
    164 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    319 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    246 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    350 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    179 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Working...
    X