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

SImple EMA Indicator Not Behaving!!

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

    SImple EMA Indicator Not Behaving!!

    Hey guys, I wrote a simple Program that Draws an Arrow Conditions are Met. However, I'm trying to make it so that UPTREND is Only established when the fast EMA over "n" periods has been Above Middle EMA, and Vice Versa for DOWNTREND.

    I'm attempting to use
    Code:
    if( (MAX(EntryEMA, 5)[1] > (MAX(TrendEMA, 5)[1])) && (TrendEMA[0] > GrandEMA[0]))
    			{
    				upTrend = true;		downTrend = false;	beginShorts = false;
    			}
    But it seems to not be working. Sadly my knowledge of MAX/MIN is limited, as it's Still Showing Arrows everywhere. I've Attached the Indicator if someone with more experience can please help me out. I'd appreciate it.

    Thank You!!

    Attached Files

    #2
    Hi ginx10k,

    Thanks for your post.

    The MAX will return the highest value in the entire series. Using the [1] gives you the second highest value in the series. This does not return a BarsAgo value but returns the actual highest price/value.

    http://www.ninjatrader.com/support/h...aximum_max.htm

    If you are wanting a BarsAgo value, use HighestBar().

    http://www.ninjatrader.com/support/h...highestbar.htm


    With your current code, if the second highest value in EntryEMA is greater than the second highest bar in TrendEMA on one bar, it will remain so until TrendEMA makes two highs that are higher than the second highest high in EntryEMA.

    So it would be expected this stays true on every bar.

    Let me if this doesn't help.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you, it did help. If i have further questions I'll post here. but I got it for now. Thanks so much!!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by cmtjoancolmenero, 04-29-2024, 03:40 PM
      17 responses
      55 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by Ashkam, 04-29-2024, 09:28 AM
      3 responses
      28 views
      0 likes
      Last Post NinjaTrader_ChristopherJ  
      Started by i2ogu3, Yesterday, 11:31 PM
      1 response
      14 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by NinjaTrader_ChelseaB, 03-14-2017, 10:17 AM
      229 responses
      34,328 views
      7 likes
      Last Post rare312
      by rare312
       
      Started by Graci117, Yesterday, 11:40 PM
      1 response
      12 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Working...
      X