Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 zstheorist, Today, 07:52 PM
    0 responses
    5 views
    0 likes
    Last Post zstheorist  
    Started by pmachiraju, 11-01-2023, 04:46 AM
    8 responses
    150 views
    0 likes
    Last Post rehmans
    by rehmans
     
    Started by mattbsea, Today, 05:44 PM
    0 responses
    6 views
    0 likes
    Last Post mattbsea  
    Started by RideMe, 04-07-2024, 04:54 PM
    6 responses
    33 views
    0 likes
    Last Post RideMe
    by RideMe
     
    Started by tkaboris, Today, 05:13 PM
    0 responses
    6 views
    0 likes
    Last Post tkaboris  
    Working...
    X