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 CaptainJack, 05-29-2026, 05:09 AM
      0 responses
      234 views
      0 likes
      Last Post CaptainJack  
      Started by CaptainJack, 05-29-2026, 12:02 AM
      0 responses
      150 views
      0 likes
      Last Post CaptainJack  
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      162 views
      1 like
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      243 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      198 views
      0 likes
      Last Post CarlTrading  
      Working...
      X