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 SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    47 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    22 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    15 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    21 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    23 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X