• 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

General Programming - (Indicator Development)

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

    General Programming - (Indicator Development)

    OK, looking for any guidance here (I have attached a picture and labeled the areas I am talking about). No 1. I am using 2 EMA's one set at 14 and the other set at 25. What I am trying to do is that when the 2 EMA's are either similar (i would like to be able to adjust the inputs) or are at a certain close distance apart, the body of the bar changes to YELLOW (or any other color). basically to warn that the EMA's are on top of each other or getting close. Some significant moves tend to follow once this happens. No 2. I am trying to figure out how to produce an extreme signal once the security is a certain distance (again I would like to try to have this scale-able and input different variables for different markets) from these 2 EMA's. Again, I have attached a picture (it seems so) of an example of what I am trying to do. I have failed so far so looking for some help with the programming or suggestions.

    One last thing-is it possible to not have the EMA's on the actual chart?
    Attached Files
    Last edited by Labs905; 05-22-2015, 09:23 AM.

    #2
    Hello Labs905,

    Thanks for your post.

    For #1, one way to do this would be to use the tick difference between the EMAs and then you can set the minimum tick difference for the detection level. For example:

    Code:
    int tickdiff = Convert.ToInt32(Math.Abs(EMA(14)[0] - EMA(25)[0]) / TickSize);
    
    if (tickDiff < detectionLevel)
    {
    BarColor = Color.Yellow;  // color the bar yellow when below detectionLevel
    }
    Using Math.Abs() to get the absolute difference between the EMAs then converting that to Ticks with TickSize (makes it work on all instruments) and then converting it to an integer (you could use as double if you want to skip conversion step). The variable detectionLevel would be something you could set in the user interface to find what works for you.

    TickSize: http://www.ninjatrader.com/support/h...l?ticksize.htm

    Alternatively you might consider using CrossAbove() or CrossBelow();
    http://www.ninjatrader.com/support/h...crossabove.htm
    http://www.ninjatrader.com/support/h...crossbelow.htm

    For #2 again you could use the tick difference but this time between perhaps the close of the current bar to one or the other of the EMAs.

    You do not need to show the EMAs on the chart.

    Please let me know if I can be of further assistance.
    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by priceisking, Today, 12:51 PM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_PaulH  
    Started by chartish, Today, 10:33 AM
    3 responses
    15 views
    0 likes
    Last Post chartish  
    Started by casabella, Today, 11:51 AM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_PaulH  
    Started by Johnny, Today, 11:42 AM
    1 response
    13 views
    0 likes
    Last Post NinjaTrader_Jermaine  
    Started by habibalex, Today, 09:03 AM
    2 responses
    13 views
    0 likes
    Last Post sledge
    by sledge
     
    Working...
    X