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 cmoran13, 04-16-2026, 01:02 PM
    0 responses
    46 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    28 views
    0 likes
    Last Post PaulMohn  
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    163 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    98 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    158 views
    2 likes
    Last Post CaptainJack  
    Working...
    X