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

MRO & previous bars

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

    MRO & previous bars

    I'm trying to find if a crossover has occured between two SMAs, but I apparently have the syntax incorrect. Could anyone please point out the error?

    I'm trying to see if there has been a crossing of a 63 SMA with a 63 SMA that has a 21 bar offset, within the last 7 bars, so I copied this directly out of the strategy wizard

    CrossAbove(SMA(63), SMA(63), 1)

    and placed it in my indicator inside an MRO statement;

    int time = MRO(delegate {return CrossAbove(SMA(63), SMA(63), 1);},1,7);

    , but it doesn't work. I also added the following line before the above MRO;

    if (CurrentBar < 84) return;

    Can anyone point out my error?

    Thanks,

    Safetrading


    #2
    Hello,

    I suggest doing a comparison rather than a crossabove. So something like this:

    if(SMA(63)[0] > SMA(63)[21])
    {

    //do something here

    }
    DenNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Jon17, Today, 04:33 PM
    0 responses
    1 view
    0 likes
    Last Post Jon17
    by Jon17
     
    Started by Javierw.ok, Today, 04:12 PM
    0 responses
    4 views
    0 likes
    Last Post Javierw.ok  
    Started by timmbbo, Today, 08:59 AM
    2 responses
    10 views
    0 likes
    Last Post bltdavid  
    Started by alifarahani, Today, 09:40 AM
    6 responses
    40 views
    0 likes
    Last Post alifarahani  
    Started by Waxavi, Today, 02:10 AM
    1 response
    19 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Working...
    X