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

Indicator of Indicator of Supplementary Bars

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

    Indicator of Indicator of Supplementary Bars

    Hello,

    I would like to select data series and then to apply it to supplementary bars, so that I could calculate an indicator with this new data series.

    Please see attached screenshot.

    How it could be done?

    Thanks,

    Valentin
    Attached Files

    #2
    Hello Valyo,

    Thank you for your post.

    You need to add the code either into the indicator or add the second series to the chart.

    To add the serie sin code please visit the following link for information: http://www.ninjatrader.com/support/h...nstruments.htm

    And tkae a look at the example under Tools > Edit NinjaScript > Strategy > SampleMultiTimeFrame.

    Comment


      #3
      Thank you, Patrick.

      This is a partially developed indicator. For the moment OnBarUpdate with BarsInProgress = 1 uses

      Code:
      currentValue = 	Indicator(BarsArray[1], ... )
      I would like to select AnotherIndicator (or Close, High, etc) through UI. Then I would like to use:

      Code:
      currentValue = 	Indicator(AnotherIndicator(BarsArray[1], ... ), ... )
      or, for example if High is selected:

      Code:
      currentValue = 	Indicator(Highs[1], ... )
      .

      So my questions are

      If I use standard UI, how could I get AnotherIndicator, which is applied to primary bars, and to apply it to supplementary bars?

      If custom input is required, how can I set it?

      Thanks,

      Comment


        #4
        Hello Valentin,

        That would not be possible. You would have to add the series to the chart via the Data Series menu before you can select it as the Input Series for an indicator.

        Comment


          #5
          Thank you, Patrick.

          However when I add supplementary bars to the chart, primary bars are displayed with gaps (because supplementary bars are more). I attach a screenshot.

          Is there a way to set the chart, so that primary bars are displayed without gaps, as if there are no supplementary bars added to the chart?
          Attached Files

          Comment


            #6
            Hello Valentin,

            This would not be possible as the chart's scale is based on time and will cause this effect when a tick series is applied with a time based series.

            Comment


              #7
              Patrick, I have another issue with this indicator. I try to add input with enum type. When I try to compile the indicator, I get this error message:

              The type or namespace name '<name>' could not be found (are you missing a using directive or an assembly reference?)
              The enum type is defined right after Variables region like this:

              public enum DateTimeUnits
              {
              Minutes,
              Seconds,
              }
              and the error appears in Properties region at following lines

              [Description("Time unit for line length")]
              [GridCategory("Stacked Line Parameters")]
              [Gui.Design.DisplayNameAttribute("Time Unit")]
              public DateTimeUnits LineTimeUnit
              {
              get { return lineTimeUnit; }
              set { lineTimeUnit = value; }
              }
              I have defined private variable

              private DateTimeUnits lineTimeUnit;
              What could be the reason for this error message?

              Thanks,

              Comment


                #8
                I could't find the reason and I thought that maybe I have reached maximum inputs for indicator. Currently indicator has 29 inputs, including 'Data' and 'Visual' grid categories. Is it possibe this to cause error messages when I try to add inputs?

                Comment


                  #9
                  Hello Valentin,

                  Thank you for your response.

                  I see no issues with the code your provided. I would recommend comparing against the enum sample at the following link: http://www.ninjatrader.com/support/f...ead.php?t=3420

                  The additional inputs should not cause this error. Can you provide the error code?

                  Comment


                    #10
                    The error code is CS0246.

                    Comment


                      #11
                      Hello Valetin,

                      Thank you for your response.

                      Can you provide the .cs file that you are working with? It will be located under (My) Documents\NinjaTrader 7\bin\Custom\Indicator or Strategy on your PC.

                      You can send it to platformsupport[at]ninjatrader[dot]com with a reference to this thread if you prefer: "http://www.ninjatrader.com/support/forum/showthread.php?t=72648"

                      Comment


                        #12
                        Thank you, Patrick. I sent the .cs file to platformsupport[at]ninjatrader[dot]com.

                        Comment


                          #13
                          Hello Valentin,

                          As discussed via e-mail please make sure to create the public enum outside of the indicator namespace.

                          Comment


                            #14
                            Thank you, it works.

                            Comment


                              #15
                              Is it possible to 'force' drawing on current (uncomplete) bar?

                              Currently the indicator works with 'long' primary bars and 'short' supplementary bars. So there are multiple supplementary bars corresponding to one primary bar.

                              The indicator performs calculations and draw a line on each supplementary bar. So there are multiple stacked lines on each primary bar.

                              It works OK with CalculateOnBarClose = true. But when I set CalculateOnBarClose = false, it doesn't draw any lines. I have to reload historical data to see recent lines. I attach screenshots.

                              I would like to see stacked line on the current uncomplete bar. Is it possible?
                              Attached Files

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by WHICKED, Today, 12:45 PM
                              2 responses
                              18 views
                              0 likes
                              Last Post WHICKED
                              by WHICKED
                               
                              Started by GussJ, 03-04-2020, 03:11 PM
                              15 responses
                              3,276 views
                              0 likes
                              Last Post xiinteractive  
                              Started by Tim-c, Today, 02:10 PM
                              1 response
                              8 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by Taddypole, Today, 02:47 PM
                              0 responses
                              3 views
                              0 likes
                              Last Post Taddypole  
                              Started by chbruno, 04-24-2024, 04:10 PM
                              4 responses
                              51 views
                              0 likes
                              Last Post chbruno
                              by chbruno
                               
                              Working...
                              X