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

Market Analyzer Column Filter with Igtdsequential Indicator

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

    Market Analyzer Column Filter with Igtdsequential Indicator

    Hello,

    I'd like to use the market analyzer to scan for various conditions that can occur with the Igtdsequential indicator https://ninjatraderecosystem.com/use...gtdsequential/

    For example, I'd like to be able to filter out for when instruments in the list have a sequential 13 (on daily timeframe) occur within the past 10 days.

    Is this possible? Would I need to modify the existing indicator script? If so, I'd really appreciate a nudge in the right direction on how to do this.

    Cheers,
    Splex

    #2
    Hello Splex,

    Thanks for your post.

    This indicator draws text and dots on the chart but does not use conventional Plots which would allow you to build Market Analyzer Column filters, use in the Strategy Builder and for Alerts. The script would need to be modified to add plots and assign values to those plots so it can be plugged into other parts of the platform.

    Our open source indicators can be referenced for examples and you can also reference our documentation on AddPlot for adding plots and assigning values to those plots.

    AddPlot() - https://ninjatrader.com/support/help...s/?addplot.htm

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

    Comment


      #3
      Thanks Jim. So could I add a plot to the indicator that will return a value of "1" when a sequential 13 is present, then use that plot to show in the market analyzer?

      Comment


        #4
        Hello Splex,

        Yes, assigning your plot a value of when when a condition occurs would be a valid way to make that signal usable in the Market Analyzer.

        Please let me know if I can be of further assistance.
        JimNinjaTrader Customer Service

        Comment


          #5
          Thanks Jim. My Ninjascript and coding abilities, in general, are limited so I would really appreciate a nudge in the right direction. I am trying to use the plots from this indicator https://ninjatraderecosystem.com/use...d/nr7-and-nr4/ to plot for when conditions are met in the Igtdsequential Indicator. Essentially I am looking to accomplish adding 3 plots which will each return a 0, -1, or +1:
          1. PerfectSetupSignal --> Data series we will set to 0 if no Perfect Setup 9, -1 if Sell Setup, +1 if Buy Setup.
          2. CountdownSignal --> Data series we will set to 0 if no Countdown Sequential 13, -1 if Sell Countdown (at any point in previous 11 bars), +1 if Buy Setup (at any point in previous 11 bars).
          3. ComboSignal --> Data series we will set to 0 if no Combo Sequential 13, -1 if Sell Combo (at any point in previous 11 bars), +1 if Buy Combo (at any point in previous 11 bars).

          So far, I have added the following to a copy of the Igtdsequential indicator:

          public class IGTDSequential : Indicator
          private Series<int> PerfectSetupSignal;
          private Series<int> CountdownSignal;
          private Series<int> ComboSignal;

          protected override void OnStateChange()
          {
          if (State == State.SetDefaults)
          {
          PerfectSetupSignalx= true;
          CountdownSignalx = true;
          ComboSignalx= true;

          AddPlot(Brushes.Green,"Perfect Setup Signal");
          AddPlot(Brushes.Red,"Countdown Signal");
          AddPlot(Brushes.Magenta,"Combo Signal");
          }
          else if (State == State.Configure)
          {
          PerfectSetupSignal = new Series<int>(this); //Data series we will set to 0 if no Perfect Setup 9, -1 if Sell Setup, +1 if Buy Setup.
          CountdownSignal = new Series<int>(this); //Data series we will set to 0 if no Countdown Sequential 13, -1 if Sell Countdown, +1 if Buy Setup.
          ComboSignal = new Series<int>(this); //Data series we will set to 0 if no Combo Sequential 13, -1 if Sell Combo, +1 if Buy Combo.
          }
          }
          protected override void OnBarUpdate()
          {
          bool isPerfectSetupSignalx= false;
          bool isCountdownSignalx= false;
          bool isComboSignalx= false;

          int PerfectSetupSignalx=0;
          int CountdownSignalx=0;
          int ComboSignalx=0;
          }

          From here I want to add an if statement to trigger on the conditions. For example, a function that says if the "Perfect setup sell" (down or up arrow plotted from IGTDsequential) is currently active, then isPerfectSetupSignalx = true. And:

          if(isPerfectSetupSignalx == true)
          {
          PerfectSetupSignalx[0]=1;
          }

          The problem I am facing is I don't know what condition to pull from the IGTDsequential indicator that actually says to plot the arrows on the chart. If you search the line below, it looks like this might be it:
          if (tdsh.SearchForPerfectSignal) tdsh = PerfectSignalTest(tdsh);

          But not sure how I can reference that and/or if the above code I've added is in the right places to reference the above. Thoughts?

          Thanks for all your help.

          Comment


            #6
            [QUOTE=Splex;n1062064]Thanks Jim. My Ninjascript and coding abilities, in general, are limited so I would really appreciate a nudge in the right direction. I am trying to use the plots from this indicator https://ninjatraderecosystem.com/use...d/nr7-and-nr4/ to plot for when conditions are met in the Igtdsequential Indicator. Essentially I am looking to accomplish adding 3 plots which will each return a 0, -1, or +1:
            1. PerfectSetupSignal --> Data series we will set to 0 if no Perfect Setup 9, -1 if Sell Setup, +1 if Buy Setup.
            2. CountdownSignal --> Data series we will set to 0 if no Countdown Sequential 13, -1 if Sell Countdown (at any point in previous 11 bars), +1 if Buy Setup (at any point in previous 11 bars).
            3. ComboSignal --> Data series we will set to 0 if no Combo Sequential 13, -1 if Sell Combo (at any point in previous 11 bars), +1 if Buy Combo (at any point in previous 11 bars).

            So far, I have added the following to a copy of the Igtdsequential indicator:

            public class IGTDSequential : Indicator
            Code:
            private Series<int> PerfectSetupSignal;
            private Series<int> CountdownSignal;
            private Series<int> ComboSignal;
            protected override void OnStateChange()
            Code:
            {
            if (State == State.SetDefaults)
            {
            PerfectSetupSignalx= true;
            CountdownSignalx = true;
            ComboSignalx= true;
            
            AddPlot(Brushes.Green,"Perfect Setup Signal");
            AddPlot(Brushes.Red,"Countdown Signal");
            AddPlot(Brushes.Magenta,"Combo Signal");
            }
            else if (State == State.Configure)
            Code:
            {
            PerfectSetupSignal = new Series<int>(this); //Data series we will set to 0 if no Perfect Setup 9, -1 if Sell Setup, +1 if Buy Setup.
            CountdownSignal = new Series<int>(this); //Data series we will set to 0 if no Countdown Sequential 13, -1 if Sell Countdown, +1 if Buy Setup.
            ComboSignal = new Series<int>(this); //Data series we will set to 0 if no Combo Sequential 13, -1 if Sell Combo, +1 if Buy Combo.
            }
            }
            protected override void OnBarUpdate()
            Code:
            {
            bool isPerfectSetupSignalx= false;
            bool isCountdownSignalx= false;
            bool isComboSignalx= false;
            
            int PerfectSetupSignalx=0;
            int CountdownSignalx=0;
            int ComboSignalx=0;
            }
            From here I want to add an if statement to trigger on the conditions. For example, a function that says if the "Perfect setup sell" (down or up arrow plotted from IGTDsequential) is currently active, then isPerfectSetupSignalx = true. And:

            Code:
            if(isPerfectSetupSignalx == true)
            {
            PerfectSetupSignalx[0]=1;
            }
            The problem I am facing is I don't know what condition to pull from the IGTDsequential indicator that actually says to plot the arrows on the chart. If you search the line below, it looks like this might be it:
            Code:
            if (tdsh.SearchForPerfectSignal) tdsh = PerfectSignalTest(tdsh);
            But not sure how I can reference that and/or if the above code I've added is in the right places to reference the above. Thoughts?

            Thanks for all your help.

            Comment


              #7
              Hello Splex,

              While I converted this script to NinjaTrader 8, I did not write it originally, and I am not an expert on its logic. I can say that if you are looking for how it draws on a chart, to look for the specific Draw methods.

              Looking for Draw.ArrowUp and Draw.ArrowDown, we see logic which controls when these drawings should be placed. If you are looking to have a signal readable in the Market Analyzer after an arrow is drawn, you could assign your plot value here, or set a bool that then sets the plot value at the end of OnBarUpdate.

              As for making sure the plot is in the right place, this would just be logical when it is set. Creating a simple indicator that plots the Close value can help to get the syntax down for plotting. If you have not done so, I would suggest this as well.

              If you have specific questions about the indicator's logic, the original developer may be willing to offer their insight. ivatan1962's profile page can be found here - https://ninjatrader.com/support/foru...787-ivatan1962

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

              Comment


                #8
                Thank you Jim!

                I have made some great progress with your help . I found the conditions in the indicator that I want to create the plot signals for. I have also added a Brushbar for each scenario to help me. The Brushbars appear to be working perfectly, coloring the bars under the following conditions:
                -Perfect Setup Sell (Red Arrow Down) = Brushes.Red
                -Perfect Setup Buy (Green Arrow Up) = Brushes.Green
                -Sequential Countdown (Red 13s) = Brushes.Blue
                -Combo (Magenta 13s) = Brushes.Magenta

                However, my plots are not working as well:
                -The setup 9s appear to plot correctly on about half of the conditions, and the rest the plot does not even show up.
                -The Sequential countdown and combos appear to plot a 1 for every condition but also plots a 1 arbitrarily when it shouldn't.

                I'm assuming it has something to do with the container that I have the code in I've played around with it but I don't fully understand. You can easily find these by ctrl+F "PerfectSetupSignal", "CountdownSignal", and "ComboSignal".

                I have uploaded my script. If you are able to give me another hint I would really appreciate it!

                Cheers,
                Attached Files

                Comment


                  #9
                  Hello Splex,

                  The attachment is in DLL format and not in readable source code format.

                  I really cannot be of much additional help for modifying this indicator. My best advice would be to see where the objects are drawn and use that part of the code to control how you set your plot.

                  How the plots get a value would depend on the logic, so you may have to take debugging steps to see why the indicator is plotting a 1 when you don't expect it to. You would want to see where a value of 1 is being set and then add prints to see why those conditions are becoming true. This could help to better understand how the indicator works and how you can fit your modifications in.

                  Debugging Tips - https://ninjatrader.com/support/help...script_cod.htm

                  There are likely many more factors at play and this would be all the speculation I can give. I would suggest reaching out to the original developer for more specifics on how the indicator can be modified to add plots if you are having further difficulties.

                  If you have any additional NinjaTrader related inquiries, please do not hesitate to open a new thread.
                  JimNinjaTrader Customer Service

                  Comment


                    #10
                    Originally posted by Splex View Post
                    Thank you Jim!

                    I have made some great progress with your help . I found the conditions in the indicator that I want to create the plot signals for. I have also added a Brushbar for each scenario to help me. The Brushbars appear to be working perfectly, coloring the bars under the following conditions:
                    -Perfect Setup Sell (Red Arrow Down) = Brushes.Red
                    -Perfect Setup Buy (Green Arrow Up) = Brushes.Green
                    -Sequential Countdown (Red 13s) = Brushes.Blue
                    -Combo (Magenta 13s) = Brushes.Magenta

                    However, my plots are not working as well:
                    -The setup 9s appear to plot correctly on about half of the conditions, and the rest the plot does not even show up.
                    -The Sequential countdown and combos appear to plot a 1 for every condition but also plots a 1 arbitrarily when it shouldn't.

                    I'm assuming it has something to do with the container that I have the code in I've played around with it but I don't fully understand. You can easily find these by ctrl+F "PerfectSetupSignal", "CountdownSignal", and "ComboSignal".

                    I have uploaded my script. If you are able to give me another hint I would really appreciate it!

                    Cheers,
                    Hi Splex , would you be willing to share the finished version of this? i'm about to do the same and don't want reinvent the wheel!

                    regards,
                    Conall

                    Comment


                      #11
                      Hi Splex, Ive got the Perfect 9 setups working.

                      Which parts of the code did you use to determine the Countdown signal and combo signal?

                      Last edited by Conall; 07-01-2019, 08:10 AM.

                      Comment


                        #12
                        Originally posted by Conall View Post
                        Hi Splex, Ive got the Perfect 9 setups working.

                        Which parts of the code did you use to determine the Countdown signal and combo signal?
                        Hi Conall,

                        Glad you had some success, I have uploaded the script as far is a could get it - see post above from June 28.

                        I found the countdown signal and combo signal code by first looking at the indicator properties ont eh chart, looking for "BG color bar 13" in the code. That lead me to the variable "SequentialBackgroundColorBar13" where I found this line in the "#region sequential countdown" container:

                        "tdsh = TDSequentialDrawText(tdsh, SequentialBackgroundColorBar13, SequentialFontColorBar13, SequentialFontSizeBar13);"

                        Under that line, I added "BarBrush = Brushes.Blue;" and it colors the bars of all 13s blue. I have not been able to get the 1,0,-1 plots to work for use the market analyzer.

                        Would you be able to share you version to collaborate furhter?

                        Thanks,
                        Splex.

                        Comment


                          #13
                          Originally posted by Splex View Post

                          Hi Conall,

                          Glad you had some success, I have uploaded the script as far is a could get it - see post above from June 28.

                          I found the countdown signal and combo signal code by first looking at the indicator properties ont eh chart, looking for "BG color bar 13" in the code. That lead me to the variable "SequentialBackgroundColorBar13" where I found this line in the "#region sequential countdown" container:

                          "tdsh = TDSequentialDrawText(tdsh, SequentialBackgroundColorBar13, SequentialFontColorBar13, SequentialFontSizeBar13);"

                          Under that line, I added "BarBrush = Brushes.Blue;" and it colors the bars of all 13s blue. I have not been able to get the 1,0,-1 plots to work for use the market analyzer.

                          Would you be able to share you version to collaborate furhter?

                          Thanks,
                          Splex.
                          Here is the CS file. BTW, when you go the add the indicator to your chart, it's under a folder called "Matt_Indicators"
                          Attached Files

                          Comment


                            #14
                            Ive just realised the sequential signal isn't working properly. Will keep working on that one later. Ive commented it out for now.

                            Perfect Setup is working
                            Combo is working.

                            I'l finish the rest later this week.
                            Last edited by Conall; 07-01-2019, 10:05 AM. Reason: attached a copy of the strategy

                            Comment


                              #15
                              attached strategy
                              Attached Files

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by jaybedreamin, Today, 05:56 PM
                              0 responses
                              3 views
                              0 likes
                              Last Post jaybedreamin  
                              Started by DJ888, 04-16-2024, 06:09 PM
                              6 responses
                              18 views
                              0 likes
                              Last Post DJ888
                              by DJ888
                               
                              Started by Jon17, Today, 04:33 PM
                              0 responses
                              1 view
                              0 likes
                              Last Post Jon17
                              by Jon17
                               
                              Started by Javierw.ok, Today, 04:12 PM
                              0 responses
                              6 views
                              0 likes
                              Last Post Javierw.ok  
                              Started by timmbbo, Today, 08:59 AM
                              2 responses
                              10 views
                              0 likes
                              Last Post bltdavid  
                              Working...
                              X