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 lorem, Yesterday, 09:18 AM
    4 responses
    14 views
    0 likes
    Last Post lorem
    by lorem
     
    Started by Spiderbird, Today, 12:15 PM
    0 responses
    5 views
    0 likes
    Last Post Spiderbird  
    Started by cmtjoancolmenero, Yesterday, 03:58 PM
    12 responses
    42 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by FrazMann, Today, 11:21 AM
    0 responses
    6 views
    0 likes
    Last Post FrazMann  
    Started by geddyisodin, Yesterday, 05:20 AM
    8 responses
    52 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Working...
    X