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

Screen / Filter my list of stocks

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

    Screen / Filter my list of stocks

    I've developed an Indicator which successfully marks on the chart when I might want to enter a trade.

    Code looks like;

    if ((((C2 && C3 && C4) || C5)) && C1 && C6 && C7 && C8 && C9)
    {
    DrawDot(CurrentBar+"Joe", true, 0, ma20 + 2 * stdDevValue +25*TickSize, Color.Red);
    }

    Where C1 - C9 are previously defined conditions. If I can put a dot on the chart, I should also be able to use this "if / else" to keep or eliminate a ticker being listed, say, in the Market Analyser window, which BTW does run my Indicator against my list of stocks, but of course doesnt produce what I'm looking for.

    I need a code snippet to do this, rather than a "For information on the Market Analyzer please visit the following link" or "You will find Reference Samples online as well as some Tips and Tricks for both indicators and strategies" type response. It must be pretty simple, however I'm going round 'n round on finding specific Indicator code that would do this for me.

    Thank-you very much,

    Joe

    #2
    Hello,

    I wanted to clarify what the question is here.

    Are you asking how to make an indicator filter rows in the Market Analyzer?
    If this is not the case can you please clarify your question as to what you are trying to accomplish?

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

    Comment


      #3
      Originally posted by jjasniew View Post
      I've developed an Indicator which successfully marks on the chart when I might want to enter a trade.

      Code looks like;

      if ((((C2 && C3 && C4) || C5)) && C1 && C6 && C7 && C8 && C9)
      {
      DrawDot(CurrentBar+"Joe", true, 0, ma20 + 2 * stdDevValue +25*TickSize, Color.Red);
      }

      Where C1 - C9 are previously defined conditions. If I can put a dot on the chart, I should also be able to use this "if / else" to keep or eliminate a ticker being listed, say, in the Market Analyser window, which BTW does run my Indicator against my list of stocks, but of course doesnt produce what I'm looking for.

      I need a code snippet to do this, rather than a "For information on the Market Analyzer please visit the following link" or "You will find Reference Samples online as well as some Tips and Tricks for both indicators and strategies" type response. It must be pretty simple, however I'm going round 'n round on finding specific Indicator code that would do this for me.

      Thank-you very much,

      Joe
      That is the purpose of the Row Filter in the Market Analyzer.

      The NT Help has video on it: http://www.ninjatrader.com/support/h..._and_filte.htm
      Attached Files
      Last edited by koganam; 12-30-2014, 02:48 PM.

      Comment


        #4
        Thanks, Osikani, Jesse!

        To clarify, I'm asking for the "action statement" in NinjaScript code that would later gate the Market Analyzer's filter capability. I understand that this gate operator could be <, >, = - etc - but I'm not getting what the "private" element is that I would put in my code so the filter can do its logic.

        Would it be (Pseudo code)?

        if ((((C2 && C3 && C4) || C5)) && C1 && C6 && C7 && C8 && C9)
        {
        DrawDot(CurrentBar+"Joe", true, 0, ma20 + 2 * stdDevValue +25*TickSize, Color.Red);
        MyMarketAnalyserFilterTrigger ==1;
        }
        else
        {
        MyMarketAnalyserFilterTrigger ==0;
        }

        Then setup the Market Analyzer logic to operate on "MyMarketAnalyserFilterTrigger" as shown in the video?

        Sorry for such a "how do you thread the nut onto the bolt" question, but I'm quite unfamiliar with C programming and have been quite pleased with how far I've got so far on my indicator - I just dont yet know how to get anything out of it besides the red dot on the chart, when my conditions are met!

        Best Regards,

        Joe

        Comment


          #5
          Hello,

          I just wanted to recap to make sure I am on the same page here I believe I understand what you are after.

          You want this to work as an Indicator and a MA column correct? so you are asking how to differentiate the plots so that 1 is for the MA column for your filters and 1 is for the chart with an actual value.

          Am I on the right track here? I am sorry for the additional posts I just want to make sure I understand you correctly before I provide information so I provide the correct information.

          If this is what you are after I can provide a code sample on basic logic for use with the MA to get you started. If I am way off please let me know so we can get back on track here.

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

          Comment


            #6
            Hi Jesse,

            Yes, I want to see a column of stock tickers and a column of my Indicator's output, which is either a 1 or a 0, depending on "if ((((C2 && C3 && C4) || C5)) && C1 && C6 && C7 && C8 && C9)" condition is met. Right now, I dont know how to get that result out of the Indicator, in a form the MA can see and use. I can only put a red dot on a plot...

            Once that is in hand, then I can program MA to only show the stock tickers where my Indicator output = 1. Then I get a nice sorted column of tickers meeting my Indicators logic.

            When I add my indicator to a column, I notice only my plot names are available as input to the filter conditions, i.e. the "public DataSeries" I defined in "#region Properties". I did put

            if ((((C2 && C3 && C4) || C5)) && C1 && C6 && C7 && C8 && C9)
            {
            DrawDot(CurrentBar+"Jin", true, 0, ma20 + 2 * stdDevValue +25*TickSize, Color.Red);
            MyMarketAnalyserFilterTrigger = 1;
            }
            else
            {
            MyMarketAnalyserFilterTrigger = 0;
            }

            ...and it compiled, but the "private int" MyMarketAnalyserFilterTrigger doesnt seem to be available for use by the MA. So I see my hint is to define something new in "#region Properties" so it shows up in the MA and then ".Set" in the above logic to my 1 /0 values?

            Thanks again,

            Joe

            Comment


              #7
              Looks like I got it.

              Jesse, thanks for your assistance! I did the following in my script:

              1. Defined "MYMAFT" under "#region Properties", similarly to the other plotted data, only increased the "Values" index by 1 to account for the additional variable.
              2. Accounted for it's value when "if (CurrentBar < 100)" condition...
              3. .Set the MYMAFT variable to 1 or 0 according to my logic condition.

              Now, MYMAFT shows up in MA as a selectable variable. It shows in the column as 1 or zero, depending on my analysis result. I also set up a filter condition which did not run on the fly, but came into effect after the analysis was complete, upon enabling row filter on right click on the MA window.

              Here's the code particulars, in case it helps someone else with the same problem as me.

              if (CurrentBar < 100)
              {
              MYMAFT.Set(0);
              }
              else
              {
              ,
              ,
              ,
              if ((((C2 && C3 && C4) || C5)) && C1 && C6 && C7 && C8 && C9)
              {
              DrawDot(CurrentBar+"Jin", true, 0, ma20 + 2 * stdDevValue +25*TickSize, Color.Red);
              MYMAFT.Set(1);
              }
              else
              {
              MYMAFT.Set(0);
              }
              ,
              ,
              ,
              #region Properties

              /// <summary>
              /// Gets the trigger value.
              /// </summary>
              [Browsable(false)]
              [XmlIgnore()]
              public DataSeries MYMAFT
              {
              get { return Values[5]; }
              }

              Comment


                #8
                Hello,

                It looks like you got it over the night that is correct.

                If you have any other questions related to the please let me know.
                JesseNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by adeelshahzad, Today, 03:54 AM
                4 responses
                22 views
                0 likes
                Last Post adeelshahzad  
                Started by merzo, 06-25-2023, 02:19 AM
                10 responses
                823 views
                1 like
                Last Post NinjaTrader_ChristopherJ  
                Started by frankthearm, Today, 09:08 AM
                5 responses
                15 views
                0 likes
                Last Post NinjaTrader_Clayton  
                Started by jeronymite, 04-12-2024, 04:26 PM
                3 responses
                43 views
                0 likes
                Last Post jeronymite  
                Started by yertle, Today, 08:38 AM
                5 responses
                16 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Working...
                X