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 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
    318 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