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 sjsj2732, 03-23-2026, 04:31 AM
    0 responses
    69 views
    0 likes
    Last Post sjsj2732  
    Started by NullPointStrategies, 03-13-2026, 05:17 AM
    0 responses
    312 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    306 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    146 views
    1 like
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    105 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Working...
    X