• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

EMA uptrend and downtrend indicator

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

    EMA uptrend and downtrend indicator

    Hy (sorry my poor english)

    pls help me

    how to use EMA(10) same like a trendline indicator

    Code:
     private in period10 =10;
      private trend bool = true;     //(uptrend)
      private trend bool = false;   //(downtrend)
    
                 if(Close[0] > EMA(period10)....)
                          Trend = true;
    
                 if(....... < .....)
                        Trend = false;
           
           else
                if(trend)
              BackColor = Color.LightSalmon;  
                  (i think this is a downtrend)

    pls help
    i'dont know how to finish it

    #2
    Hello hunadamka,

    Thank you for your post and welcome to the NinjaTrader Support Forum!

    Based on your inquiry I would use the following code:
    Code:
    private int trend = 0;
    private int period = 10;
    ...
    if(Close[0] > EMA(period)[0])
    {
    trend = 1; // 1 = up trend.
    }
    else if (Close < EMA(period)[0])
    {
    trend = 2; // 2 = down trend.
    }
    ...
    if(trend == 1)
    {
    // Do something.
    }
    else if(trend == 2)
    {
    // Do something.
    }
    Patrick H.NinjaTrader Customer Service

    Comment


      #3
      thank you
      for a quick help!

      and now i know how to colorize background color and line : )

      THX

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by manugarc, Today, 01:15 PM
      0 responses
      6 views
      0 likes
      Last Post manugarc  
      Started by JMont1, Today, 11:42 AM
      0 responses
      4 views
      0 likes
      Last Post JMont1
      by JMont1
       
      Started by Steve L, Yesterday, 10:04 PM
      0 responses
      4 views
      0 likes
      Last Post Steve L
      by Steve L
       
      Started by marianfed, Yesterday, 09:47 PM
      0 responses
      5 views
      0 likes
      Last Post marianfed  
      Started by hir04068, Yesterday, 09:29 PM
      0 responses
      8 views
      0 likes
      Last Post hir04068  
      Working...
      X