• 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 behindthewheel, Today, 10:39 AM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_Jim  
      Started by Newtrader101, Today, 10:46 AM
      3 responses
      7 views
      0 likes
      Last Post NinjaTrader_ChristopherJ  
      Started by tecmisc1, Today, 10:42 AM
      1 response
      6 views
      0 likes
      Last Post tecmisc1  
      Started by ballboy11, Today, 10:35 AM
      1 response
      11 views
      0 likes
      Last Post NinjaTrader_Kate  
      Started by fredfred, Today, 10:30 AM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_Melissa  
      Working...
      X