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 kinfxhk, 07-14-2026, 09:39 AM
      0 responses
      125 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 07-13-2026, 10:18 AM
      0 responses
      105 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 07-13-2026, 09:50 AM
      0 responses
      85 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 07-13-2026, 07:21 AM
      0 responses
      105 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 07-11-2026, 02:11 AM
      0 responses
      84 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Working...
      X