Announcement

Collapse
No announcement yet.

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 Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    603 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    349 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    104 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    560 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    560 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X