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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      82 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      43 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      64 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      68 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      56 views
      0 likes
      Last Post CarlTrading  
      Working...
      X