Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

compare 2 moving average

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

    compare 2 moving average

    is there an indicator compares 2 SMA?

    is there an indicator compares an SMA and an EMA?

    I need a quick way to see the difference between the 2 values.

    thanks

    #2
    Hello rexmie888,

    Welcome to the NinjaTrader forums!

    The example of the crossover strategy in the Strategy Builder 301 and the print in the NinjaScript Editor 401 shows how this would be developed.



    As an example of coding this:

    private SMA sma1;
    private SMA sma2;

    In OnStateChange() when State is State.DataLoaded:
    sma1 = SMA(7);
    sma2 = SMA(14);

    In OnBarUpdate():
    Print(string.Format("{0} | sma1: {1}, sma2: {2}", Time[0], sma1[0], sma2[0]));

    Below is a link to a forum post with helpful information about getting started with NinjaScript development.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thx for the info

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      597 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      343 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      103 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      556 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      555 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X