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 sjsj2732, Yesterday, 04:31 AM
    0 responses
    39 views
    0 likes
    Last Post sjsj2732  
    Started by NullPointStrategies, 03-13-2026, 05:17 AM
    0 responses
    290 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    289 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    135 views
    1 like
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    96 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Working...
    X