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 charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      70 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      152 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      162 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      100 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      288 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Working...
      X