Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help with coding Moving average differences

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

    Help with coding Moving average differences

    Hello everyone,

    Thanks for all your support on here, its really appreciated for a newbie.

    How do I code the difference between two simple moving averages as the offset function doesn't really work and the trades are just triggered on the close of the cross-over and not the difference between the two SMA's

    For example, I want to trigger a LONG trade if the difference between an SMA(5) and SMA(20) is >10 points and reverse if the difference is negative 10 pts.

    I had a go at the coding but kept getting errors due to my lack of C# skills.

    If anyone out here can help, I can keep the grey hairs at bay!

    cheers,

    Leonie

    #2
    See the following image for the condition where you would EnterLong(), to EnterShort(), just change to "<" and change "10" to "-10".
    Attached Files
    RayNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    558 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    545 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X