Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

This should be easy but....

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

    This should be easy but....

    I am trying to write a strategy which alerts me if a moving average gives the same number two bars in a row but....

    if (Math.Abs(EMA(Close, 12[0] - EMA(Close, 12)[1]) ==0);

    {
    DrawDot("My dot" + CurrentBar, false, 0, Low[0], Color.Blue);
    }

    What am I doing wrong here?

    #2
    Hello ninjablanks,

    Conceptually looks OK. Are there any error messages in log tab of control center? You may need something like:

    if (CurrentBar < 1) return;



    Also - remove ; at end of if statement.

    if (Math.Abs(EMA(Close, 12)[0] - EMA(Close, 12)[1]) ==0)
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      It was a misplaced bracket dooh! Thanks for your help

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      589 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      342 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
      555 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      552 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X