Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MA Cross Alert in Market Analyzer

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

    MA Cross Alert in Market Analyzer

    Is it possible to create an alert in Market Analyzer when 2 MA's cross?

    #2
    Hi rcmcd,

    This is possible to do but would require a simple custom coded indicator.

    The indicator would need to detect the cross and then plot 1 when the crossabove is detected, -1 when a crossbelow is detected, and 0 when there is no cross.

    In the Market Analyzer, you would add this as an indicator column. Then you can use alert, cell, and filter conditions on this.


    If you are interested in creating this indicator, below are a few resources to help you get started.

    The best way to begin learning NinjaScript is to use the Strategy Wizard. With the Strategy Wizard you can setup conditions and variables and then see the generated code in the NinjaScript Editor by clicking the View Code button.
    I'm also proving a link to a recently recorded 'Automated Strategy Development Webinar' video for you to view at your own convenience: Automated Strategy Development Level 1 - NinjaTrader Training - 3/26/2013

    We also have great resources in relation to Strategy Development on our Support Forum. There is a very active developer community in our support forum that supplements the responses provided by NinjaTrader support staff providing all users with an exceptional support experience.
    Take me to your support forum!

    There are a few Sample Automated Strategies which come pre-configured in NinjaTrader that you can use as a starting point. These are found under Tools--> Edit NinjaScript--> Strategy. You will see locked strategies where you can see the details of the code, but you will not be able to edit (you can though always create copies you can later edit via right click > Save as)

    We also have some Reference samples online as well as ‘Tips and Tricks’ for both indicators and strategies:
    Click here to see our NinjaScript Reference Samples
    Click here to see our NinjaScript Tips

    These samples can be downloaded, installed and modified from NinjaTrader and hopefully serve as a good base for your custom works.

    Further, the following link is to our help guide with an alphabetical reference list to all supported methods, properties, and objects that are used in NinjaScript.
    Alphabetical Reference

    We also have a few tutorials in our help guide for both Indicators and Strategies.
    Indicator tutorials
    Strategy tutorials

    Last, if you would like to have this strategy coded for you, you may contact one of our professional NinjaScript consultants.
    Click here to see our Consultants page
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by rcmcd View Post
      Is it possible to create an alert in Market Analyzer when 2 MA's cross?
      Originally posted by NinjaTrader_ChelseaB View Post
      Last, if you would like to have this strategy coded for you, you may contact one of our professional NinjaScript consultants.
      Click here to see our Consultants page
      Hi rcmcd,

      As Chelsea mentioned this is definitely possible and she has given an excellent set of resources for anyone wanting to code this themselves. You must have a plot created that can then be referenced in the Market Analyzer as Chelsea described.

      With regards to her last point, if anyone is not wanting to code this themselves and instead looking for an existing solution, we are a proud NinjaTrader partner and have our Ultimate Moving Average Cross alert indicator bundle available. It includes an indicator for use on charts and also an additional indicator specifically written for use in the Market Analyzer and Strategies.
      If anyone is interested, further information can be found at www.globaltradingtools.com/software/ultimate-moving-average-cross-alert-indicator-ninjatrader/

      Thanks very much for your time!
      Cheers
      Stuart

      Comment


        #4
        Question along the same lines as alerts for Market Analyzer. Is there a way to set up a column that will give the results of say 4 or more other columns in the Market Analyzer. The one column set up will be able to alert when the other 4 columns are all the same for instance.
        Thanks,
        PanamaJack

        Comment


          #5
          Hi PanamaJack,

          This is also possible to do, however, you will start needing to check things in OnFundamentalData().

          A lot of the columns in the Market Analyzer are using fundamental data that comes directly from the provider.

          Below is a link to the help guide on OnFundamentalData().
          http://www.ninjatrader.com/support/h...mentaldata.htm

          The method for having this work in the Market Analyzer is the same. You would set the plot to 0 when all 4 values are not matching and then 1 when all 4 values are matching. The difference would be the conditions you are checking in the script.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            i'm really struggling with this "plot0" functionality.
            perhaps someone can point me into the right direction?
            according to the idea in this thread i'd like to do the following:

            if close [0] > SMA (50) [0] -> result (in indicator window) should be "+1"
            if close [0] >= SMA (25) [0] && < SMA (50) [0] -> result should be "0"
            if close [0] < SMA (25) [0] -> result should be "-1"

            the first errors appear after trying to overwork the condition:
            "Plot0.Set"

            thanks!!

            Comment


              #7
              Hello,

              Thank you for the question.

              The syntax should be Plot0.Set(-1); 1 or 0 as an example, can you tell me what specific error you are getting or could you provide the specific syntax causing the problem?

              If you do not have a property defined for Plot0 this may be the case, you can also try using Value.Set(1);

              I look forward to being of further assistance.
              JesseNinjaTrader Customer Service

              Comment


                #8
                Hi Jesse,

                thanks for your asssitance,

                attached my indicator (better: my trial to learn .....).
                using your suggestion means:
                - a lot of errors are deleted now
                - but the indicator is only drawing "-1"
                - and i had to comment out the middle condition because of an error

                may i ask you to have a look at it?
                thanks a lot
                Attached Files

                Comment


                  #9
                  Hello,

                  It looks like this could be due to the syntax/structure you are using. C# is very stucture orientied so the following syntax is not doing what you would expect it to:

                  Code:
                  Plot0.Set(1);
                  if (Close[0] > SMA (50)[0]);
                  
                  //Plot0.Set (0);
                  //if (Close [0] >= SMA (25)[0]) "&&" (Close [0] < SMA (50)[0]);
                  
                  Plot0.Set(-1);
                  if (Close[0] < SMA (50)[0]);


                  Instead you could try the following syntax which should produce a result more in line with what you are looking for:


                  Code:
                  Plot0.Set(0);
                  if (Close[0] > SMA (50)[0])
                  {
                  	Plot0.Set(1);
                  } 
                  else if (Close[0] < SMA (50)[0])
                  {
                  	Plot0.Set(-1);
                  }
                  This would set a default value of 0 which will always be used in the case one of the conditions does not, in this situation this would not occur because the SMA will be above or below the price.

                  This is important to set a default specifically for Market Analyzer indicators because otherwise the Close price is used if no condition sets the plot.

                  If statements do not ever need terminated with a semicolon if(something);
                  Instead using the method body as shown above would execute the code inside the { } if the condition is true.

                  Also the statement:

                  if (Close [0] >= SMA (25)[0]) "&&" (Close [0] < SMA (50)[0]);

                  could be formed as:
                  Code:
                  if (Close [0] >= SMA (25)[0] && Close [0] < SMA (50)[0]) 
                  {
                  
                  }
                  I look forward to being of further assistance.
                  JesseNinjaTrader Customer Service

                  Comment


                    #10
                    Hi Jesse,

                    on the first view (and after changing the second condition from 50 to 25) it looks like it's working fine.

                    So, thank you very much so far!
                    On the second view: the condition is only working with "50" correct concerning the sma 50.
                    this is a kind of price against sma.

                    how can i add the middle condition, if price is between the two sma's?
                    using your suggestion gives wrong output
                    any ideas?

                    thanks you
                    Last edited by Tradexxx; 12-11-2015, 01:32 PM.

                    Comment


                      #11
                      i have tried to rebuild this with a normal sma/price cross situation, but it's not working there also.
                      is this something that can't be done in NT??

                      Comment


                        #12
                        Hello,

                        What you are trying is certainly possible using NinjaScript or to make a indicator specific for the MA, can you provide the current modified code so I can see what you are trying that is not working?

                        The logic and conditions in the indicator would need to make logical sense in order to work correctly with the MA, additionally if a value is not set the close price is used instead so there can be some extra items to pay attention to specifically for the MA indicators. With the code you are currently using it may be more apparent what is happening.


                        I look forward to being of further assistance.
                        JesseNinjaTrader Customer Service

                        Comment


                          #13
                          Problem solved, MA is running. thx!

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by bortz, 11-06-2023, 08:04 AM
                          47 responses
                          1,607 views
                          0 likes
                          Last Post aligator  
                          Started by jaybedreamin, Today, 05:56 PM
                          0 responses
                          9 views
                          0 likes
                          Last Post jaybedreamin  
                          Started by DJ888, 04-16-2024, 06:09 PM
                          6 responses
                          19 views
                          0 likes
                          Last Post DJ888
                          by DJ888
                           
                          Started by Jon17, Today, 04:33 PM
                          0 responses
                          6 views
                          0 likes
                          Last Post Jon17
                          by Jon17
                           
                          Started by Javierw.ok, Today, 04:12 PM
                          0 responses
                          16 views
                          0 likes
                          Last Post Javierw.ok  
                          Working...
                          X