Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Angulation between 2 EMAs

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

    Angulation between 2 EMAs

    HI

    I have formula in my logic to calculate the difference between EMAs. My question is, Do i need two seprate emaAngulation8B for short and long? or Math.abs should do it just fine.
    For example if angulation short i enter short, if angulation is long i enter long
    double emaAngulation8B = Math.Abs(fastEMA[0] - slowEMA[0]);








    #2
    Hello tkaboris,

    Subtracting one ema from another would produce a positive or negative difference. Using Math.Abs will prevent the negative result making a non-negative value always. If that is what you are trying to do then that logic would accomplish that.

    If the purpose is to differentiate long vs short you may want to remove the Math.Abs here so you can get a positive or negative value. That would let you know a direction of difference for the purpose of choosing long or short.

    Your emaAngulation8B variable is going to be either the total difference discarding direction or a directional difference where you are considering the difference of the Fast plot in relation to the Slow plot.

    JesseNinjaTrader Customer Service

    Comment


      #3
      Ok i just need angulation size.... However for some reason my longs are not working. i checked logic and cant figure out.

      I have
      EMAAngulation8B = 30;

      in my OnBarUpdate i have
      double emaAngulation8B = Math.Abs(fastEMA[0] - slowEMA[0]);

      and in my logic for Longs for bounce from 8 ema i have
      if (Trade8B

      && (Close[1] < Open[1] && High[1] > Open[1]) // previous bar bearish no wick
      && (Close[1] >= EMA(8)[1] && Close[0] > Open[0]) // Bar doesnt close below ema and current bar bullish
      && emaAngulation8B > EMAAngulation8B * TickSize
      )

      {

      entryOrder = SubmitOrderUnmanaged(0, OrderAction.Buy, OrderType.Market, TradeSize, 0, 0, "", "8B");
      return;
      }

      Am I missing something?​

      Comment


        #4
        Hello tkaboris,

        I am not familiar with the term angulation size, if that is a math concept you can use google to locate the formula for that. Subtracting one value from another is commonly known as a difference. The abs or absolute value of a number would be its positive value representation, for example -1 is 1.

        The Math.Abs(fastEMA[0] - slowEMA[0]); could be read as the following when you get a positive or negative result:

        2000.25 - 2000.75 = 0.50
        2000.75 - 2000.25 = 0.50

        You otherwise need to use a Print here to see what the values are from your equation to better understand how that is effecting the condition.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by r68cervera, Today, 05:29 AM
        0 responses
        2 views
        0 likes
        Last Post r68cervera  
        Started by geddyisodin, Today, 05:20 AM
        0 responses
        3 views
        0 likes
        Last Post geddyisodin  
        Started by JonesJoker, 04-22-2024, 12:23 PM
        6 responses
        35 views
        0 likes
        Last Post JonesJoker  
        Started by GussJ, 03-04-2020, 03:11 PM
        12 responses
        3,239 views
        0 likes
        Last Post Leafcutter  
        Started by AveryFlynn, Today, 04:57 AM
        0 responses
        6 views
        0 likes
        Last Post AveryFlynn  
        Working...
        X