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 Mindset, 04-21-2026, 06:46 AM
      0 responses
      67 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      95 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      53 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      108 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      63 views
      0 likes
      Last Post PaulMohn  
      Working...
      X