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

Aroon Cross Above / Cross Below Syntax

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

    Aroon Cross Above / Cross Below Syntax

    Hello,

    The Aroon indicator exposes two plots the Up plot and the Down plot.

    Would anyone kindly provide the following:

    1) the syntax to check when the Up plot Crosses above the Down plot and vice versa?
    I have tried a few different variations using the CrossAbove/Below methods as follows but can't quite get it to work. Therefore, to avoid confusion I just won't post my incorrect trials.


    2) How to check if the Up plot or if the Down plot is Rising?
    if I try: Rising(Aroon(21)) -> Idon't know how to specify whether to check for the Up or Down plot.


    Help is much appreciated, thank you!
    Last edited by MercuryScripter; 01-22-2016, 12:40 AM.

    #2
    Hello MercuryScripter,

    Thanks for your post.

    For the cross above/crossbelow:

    if (CrossAbove(Aroon(21).Up, Aroon(21).Down, 1)
    {
    // do something
    }

    if (CrossBelow(Aroon(21).Up, Aroon(21).Down, 1)
    {
    // do something
    }

    For the rising/falling:

    if (Rising(Aroon(21).Up)) // note you can select the .Up or the .Down here
    {
    // do something
    }

    if (Falling((Aroon(21).Up)) // note you can select the .Up or the .Down here
    {
    // do something
    }
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Paul View Post
      Hello MercuryScripter,

      Thanks for your post.

      For the cross above/crossbelow:

      if (CrossAbove(Aroon(21).Up, Aroon(21).Down, 1)
      {
      // do something
      }

      if (CrossBelow(Aroon(21).Up, Aroon(21).Down, 1)
      {
      // do something
      }

      For the rising/falling:

      if (Rising(Aroon(21).Up)) // note you can select the .Up or the .Down here
      {
      // do something
      }

      if (Falling((Aroon(21).Up)) // note you can select the .Up or the .Down here
      {
      // do something
      }
      This is perfect Paul! Thank you. What I was getting wrong is I was passing in a BarsAgo index, and it didn't register to me that broke the series.

      Comment


        #4
        Hello Paul,

        I've got a follow up question for you please. So I've added a secondary TimeFrame to my strategy and simply trying to check for Bullish and Bearish Aroon Crosses on the secondary TF, however, I'm not getting the desired results with the following code I've concocted. Your help correcting this would be much appreciated!

        Code:
        if(BarsInProgress == 1)
        {
        	
        	if(CrossAbove(Aroon(BarsArray[1], 21).Up, Aroon(BarsArray[1], 21).Down, 1))
        	{			
        	  Print(Time[0].ToString() +  " - " + BarsPeriods[1].Value.ToString() + " " + BarsPeriods[1].Id.ToString() + " Bullish Cross" );
        	}
        
                  if(CrossAbove(Aroon(BarsArray[1], 21).Down, Aroon(BarsArray[1], 21).Up, 1))
        	{			
        	  Print(Time[0].ToString() +  " - " + BarsPeriods[1].Value.ToString() + " " + BarsPeriods[1].Id.ToString() + " Bearish Cross" );
        	}
        
        }
        Last edited by MercuryScripter; 01-24-2016, 06:25 PM.

        Comment


          #5
          Hello MercuryScripter,

          Thanks for your post.

          The code is being bracketed by the BarsInProgress meaning it will only calculate when the secondary bars has called onbarUpdate, is that what you want to happen?

          Can you provide further info about what you are seeing or not seeing? (Perhaps a chart marked up may help).
          Paul H.NinjaTrader Customer Service

          Comment


            #6
            Originally posted by NinjaTrader_Paul View Post
            Hello MercuryScripter,

            Thanks for your post.

            The code is being bracketed by the BarsInProgress meaning it will only calculate when the secondary bars has called onbarUpdate, is that what you want to happen?

            Can you provide further info about what you are seeing or not seeing? (Perhaps a chart marked up may help).
            Hello Paul,

            My objective is as follows:

            I am loading a strategy on a 15 min chart of ES 03-16. In the strategy I've added a secondary 60 min series of ES 03-16.

            I am checking Bullish / Bearish Aroon crosses on the 15 min and the 60 min and printing to the output window.

            I am unable to get the 60 min crosses to print correctly on the output window with the code I provided in my last post.
            Last edited by MercuryScripter; 01-25-2016, 09:22 AM.

            Comment


              #7
              Hello MercuryScripter,

              Thanks for your reply.

              Sorry, I do not understand what, "...get the 60 min crosses to print correctly on the output window..." means. Are they printing incorrect values, not at all, sometimes correct sometime not? Is that they are not printing at the right times?

              If you are running with CalcuateOnBarClose = true then I would expect to see print out once per hour.
              If it is set to false then it would be on each tick of the added data series.
              Paul H.NinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_Paul View Post
                Hello MercuryScripter,

                Thanks for your reply.

                Sorry, I do not understand what, "...get the 60 min crosses to print correctly on the output window..." means. Are they printing incorrect values, not at all, sometimes correct sometime not? Is that they are not printing at the right times?

                If you are running with CalcuateOnBarClose = true then I would expect to see print out once per hour.
                If it is set to false then it would be on each tick of the added data series.
                Hello Paul - Whilst responding to your post like below I figured out what the problem was. Just for edification I'll still submit the response I was going to provide but I'll also include my resolution at the very bottom.

                Sorry I did not clarify. Here is a sample of the output prints: The issue as you can see is that the logic printed that a 60 min Bullish Cross occurred on the 60 min timeframe of the ES 03-16 on 1/31/2016 at 1:00PM. If you plot a 21 Period Aroon on the 60 min ES 03-16 chart you will see that no such cross occurred... In fact the actual 60 min Bullish Cross occurred on 1/20 at 8:00 pm.

                1/20/2016 3:15:00 PM - 15 Minute Bullish Cross - 100 / 57.14
                1/21/2016 12:00:00 AM - 15 Minute Bearish Cross - 66.67 / 100
                1/21/2016 6:15:00 AM - 15 Minute Bullish Cross - 47.62 / 33.33
                1/21/2016 8:15:00 AM - 15 Minute Bearish Cross - 9.52 / 23.81
                1/21/2016 8:30:00 AM - 15 Minute Bullish Cross - 100 / 19.05
                1/21/2016 10:30:00 AM - 15 Minute Bearish Cross - 66.67 / 90.48
                1/21/2016 11:15:00 AM - 15 Minute Bullish Cross - 100 / 76.19
                1/21/2016 1:00:00 PM - 60 Minute Bullish Cross - 100 / 43.9
                1/21/2016 3:45:00 PM - 15 Minute Bearish Cross - 33.33 / 76.19
                1/21/2016 8:15:00 PM - 15 Minute Bullish Cross - 38.1 / 14.29
                1/21/2016 9:15:00 PM - 15 Minute Bearish Cross - 19.05 / 47.62
                1/21/2016 10:30:00 PM - 15 Minute Bullish Cross - 52.38 / 23.81
                1/21/2016 10:45:00 PM - 15 Minute Bearish Cross - 47.62 / 100
                1/22/2016 12:15:00 AM - 15 Minute Bullish Cross - 100 / 71.43
                1/24/2016 11:30:00 PM - 15 Minute Bearish Cross - 0 / 52.38
                1/25/2016 12:15:00 AM - 15 Minute Bullish Cross - 100 / 38.1
                1/25/2016 2:30:00 AM - 15 Minute Bearish Cross - 57.14 / 100
                1/25/2016 7:45:00 AM - 15 Minute Bullish Cross - 57.14 / 33.33
                1/25/2016 9:00:00 AM - 15 Minute Bearish Cross - 33.33 / 100

                Resolution: I realized that the 60 min series in the strategy was referencing a different Aroon period (not 21) hence the reason for the discrepancy.

                I was quick to doubt my code, but it was correct all along. Thank you for this positive interaction and your time!

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by sidlercom80, 10-28-2023, 08:49 AM
                170 responses
                2,271 views
                0 likes
                Last Post sidlercom80  
                Started by Irukandji, Yesterday, 02:53 AM
                2 responses
                17 views
                0 likes
                Last Post Irukandji  
                Started by adeelshahzad, Today, 03:54 AM
                0 responses
                3 views
                0 likes
                Last Post adeelshahzad  
                Started by CortexZenUSA, Today, 12:53 AM
                0 responses
                3 views
                0 likes
                Last Post CortexZenUSA  
                Started by CortexZenUSA, Today, 12:46 AM
                0 responses
                1 view
                0 likes
                Last Post CortexZenUSA  
                Working...
                X