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

2 data series

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

    2 data series

    Hello i have a chart where either i want to have 2 data series showing one in panel 1 and then other in panel 2
    OR have both show in panel 1 - with 1 overlayed on the other

    Each data series is custom data series and not time based like Range charts.

    An indicator does the plotting and OnRender for the bars with other features.

    Each data series will appear slightly differently with different colors in order to distinguish the bars.

    What i want to know is how to best use the overlay of the 2 series. As when i click on the panel 1 to connect some custom drawing handled in the indicator for
    panel 1 - the x y coordinates which define the start bar and end bar seem to get lost and the drawing starts on another bar say 9 bars to the right of the first click of where drawing starts.
    Is it going to be not possible to do drawings when having 2 series on chart either in same panel or separate panel.
    Also the start times and aligning the bars - im not sure if is correct - as both are not time based ie do not have a defined end time or close.

    To add to this when i check with the middle wheel click to see the high low close of the bar the mouse is over - it doesnt know what is being clicked on. Is the scaling compromised when you do this and add 2 series to a chart like this or perhaps i am missing something in how i do this

    Any insight appreciated
    Last edited by soulfx; 06-29-2020, 03:54 PM.

    #2
    Hello soulfx,

    Are you trying to draw objects from mouse clicks in an indicator?

    Are you just trying to draw drawing objects on a chart that has two data series in the panel?
    Drawing objects will be attached to the scale of the 'Attached to' series.

    Are both data series using the same Scale Justification? Are these set to Overlay or right?

    When chart objects have the scale justification set to overlay, these will not use any price scale and will only autoscale.

    Below is a link to a video that demonstrates how the Scale Justification works.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello,

      Are you trying to draw objects from mouse clicks in an indicator?
      YES
      _P2.X = ChartingExtensions.ConvertToHorizontalPixels(e.Get Position(ChartControl as IInputElement).X, ChartControl.PresentationSource);
      _P2.Y = ChartingExtensions.ConvertToVerticalPixels(e.GetPo sition(ChartControl as IInputElement).Y, ChartControl.PresentationSource);

      the problem i see in overlaying 2 charts in the one panel that are custom drawn - and so horizontal scaling will be off ? with non-time based bars ?

      both data series are using the same RIGHT justification

      probably the closest you could test on your end would be a 10 range chart of say ES and overlay a 15-18 Range chart of ES on top in the same series.
      The difference here is these are native bars in ninja whereas i am drawing the bars from my custom indicator.

      thanks for the video and that all is what i understand on scale justification and attaching indicators to the correct series in the indicator.

      the other thing to try is try overlaying a 10Range ES and overlay a ES PNF chart in the same panel and see how they align.
      that is closer to what i am trying to achieve here

      thanks


      Comment


        #4
        Hello soulfx,

        Below is a link to an example of capturing mouse clicks and using these for custom rendering.


        Also, below is a link to an example of a scroll-able rendering.


        You could choose to find the closest bar with chartControl.GetTimeByX() if you wanted to find the bar closes to a mouse click, and then use this time to get an x as the chart is scrolled.


        Any rendering would be attached to that indicator. Any y value retrieved with chartScale.GetYByValue() would be associated with the indicator and it's scale.


        Any x value retrieved with chartControl.GetXByBarIndex() would be associated with the indicator's input series .


        An indicator that has custom rendering

        The x and y of the chart itself will remain static. It will all depend on how you are coverting times and prices to these static x and y locations.

        Below is a link to a video that demonstrates.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          thanks for reply.
          Thanks for reference to another example of capturing mouse clicks. but what i have in place and i just showed snippet works fine and no issues.
          I just mentioned as when 2 data series are loaded onto a chart in same panel - it perhaps requires more work ; maybe this is what you are referring to a different way to manage the clicks.

          in any event i just tried ES 8 range and ES 18 range in panel 1. If you use the middle mouse click to get the bar values - you should see they do not correspond to the bar being selected ?
          Which of the two is considered the primary series - the first in the list in the data series panel ?

          These are non time based and why i was asking as this is what i mentioned in prior note. There is a reason for this and ultimately the 2nd series may well be displayed in a lower panel.
          The key being the X (time) alignment of these different (non time based) periods.

          This looks like it could a mess to track and not possible or feasible what i am trying to achieve here - this is the basis then i can do more analysis on the different bar periods (range in this case) and then apply it to my custom bars to find levels.

          Does this make sense? Are you able to replicate with ninja range bars above what i am seeing ?
          thanks

          Comment


            #6
            Hello soulfx,

            I'm not sure what you are referring to.

            In the video I've demonstrated that drawing from a mouse click works with multiple series and having a scrollable render works with multiple series.

            Can you let me know the time in the video I've linked where you are having questions?
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hello, i dont understand how you are not following what i am asking here.
              Since the first post i have been talking about NON TIME BASED bars eg range as an example and in my last post i requested you check an ES 8 range overlayed with an ES 18 range
              i watched your video again and again you are using 1 minute series which of course will align - i did not mention 1 minute and i see there is no issue and i understand scaling left and right that is all pretty basic stuff.

              What is not clear about what i am asking ? ie using range bars as described in panel 1 and overlaying and then trying to access the OHLC details by clicking on each series.

              Lets look at this first then i can look at the drawing part. You have added an indicator which captures mouse clicks and draws.
              I have an indicator which draws the custom bars and provides means to do custom drawing based on the non time based period. But for now lets put that to the side and just
              look at overlaying 2 range bar series with different range values.
              I want to see what you are seeing and where expected to see the bars draw and overlay.
              Also i mention in post #3 about overlaying a range series of bars over a ninja PNF series as an example too.

              It seems you are bypassing these questions and giving me links to what i already know and understand on getting x and y values for rendering - that was not my question
              thank you

              Comment


                #8
                Hello soulfx,

                I've made the same video using range bars.


                With any bar type used, the rendered objects are still associated to the price scale they are applied to. These could be time based or not time based.

                I'm not seeing that anything "off". Or to be specific, I am not seeing that the values from chartScale.GetYByValue() are incorrect for the price provided.

                It sounds like you are having trouble getting x and y coordinates from the bar series for an rendering that you want to be scroll-able. Is this not the case?

                I'm not following because I feel you have not specifically stated the simplified exact issue you are having.
                As an example, I am providing you with specific methods and a video to show the expected behavior. This is so you can clearly grasp the information I am providing you.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Hello, thanks for the video. can you also now click on or two of each of the range bars series ie the 4 range then the 9 range when both are in the same panel.
                  And see if you are getting the correct OHLC prices for the selected bars from each distinct series? XA**

                  When i have one series on the chart when my custom indicator draws the custom bars and then i click the bar i get the correct OHLC

                  So in the same way with the simple range bars when 2 are overlayed as you show in your latest video. It seems the mouse loses track of where the bar should be in terms of X (time)?

                  If i overlay another series on my custom bars - then obviously the spacing is affected as expected due to the differences in open and close times.

                  This will then take me to the next step in that - the Y value is not at issue but the X ... and i may need to accomodate this if i want to overlay in terms of drawing since the drawing
                  renders based on bar index and where it thinks the bar is when the mouse is over it. this can be seen with 2 range bars in that - it loses focus on where the bar is

                  See what you see when you check OHLC in the XA** paragraph above.

                  EDIT to this post - i now see there are two sets of OHLC data when you click the middle mouse
                  One is for the smaller range and the other for the larger range

                  So if i want to be able to draw with the adjusted spacing i need to use the chartControl.GetTimeByX() if you wanted to find the bar closes to a mouse click - in my code - and modify that part if i want to do this.

                  but we are getting closer to what i am enquiring about here that you would need to see visually on the chart

                  thanks

                  EDIT 2 - <ChartControl>.GetSlotIndexByTime(DateTime time)

                  It may be i need to use one of the slot functions given i end up with equidistant bar spacing in this situation ?

                  So when i mouse click to find the bar index or slot and bar details from which to draw from as i am connecting one bar to another in the series
                  Last edited by soulfx; 07-01-2020, 04:14 PM.

                  Comment


                    #10
                    Hello soulfx,

                    The two test indicators ClickDrawExample_NT8, and RenderScrollableObjectExample_NT8 do not print to the output window and do not show values on the chart when a bar is clicked on. Instead these render an object either where clicked or on the last few bars.
                    Are you wanting me to open the Data box and show the values in the data box?
                    Are you wanting me to test MouseXYtoBarTimePriceExample_NT8?

                    What are you wanting me to see when I click on the bar?

                    The pricing will come from the series associated with the indicator. If there are two series, which ever is the input series for the indicator will be giving time and price values from.
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      hello chelsea,

                      yes for the 2 range bar series example overlayed onto one panel - i wanted you to check to see the data box values. it lists both one on top of the other.
                      i just wanted to verify it looked ok to you.

                      In reviewing this and wanting to overlay one bar series over another - both non time based to find some patterns ; it would seem that it makes more sense and is somewhat clearer for me to display this in a separate panel below. Thus i can see more clearly when each bar closes and the time range.

                      I wasnt trying to be cryptic in my questions but perhaps in holding back some aspects as i dont want to share too much in the public forum ; it had you wondering what i am wanting to know.

                      The mouse clicks on the rendered bars as i said in my last post i understand i need to handle differently in my code to get the bar closest to the mouse at the time of selection on the chart.
                      If you could confirm on the data box values that would help and as i review the code and try some different approaches to this i can email directly platform support the specifics of this
                      thanks

                      Comment


                        #12
                        Hello soulfx,

                        Thank you for clarifying you would like me to open the Data Box from a chart and compare the time stamp of the series.

                        Below is a link to a video.


                        I am not seeing any bars that have time stamps past the next bar for either series. These are all sequential.

                        Chelsea B.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by jclose, Today, 09:37 PM
                        0 responses
                        4 views
                        0 likes
                        Last Post jclose
                        by jclose
                         
                        Started by WeyldFalcon, 08-07-2020, 06:13 AM
                        10 responses
                        1,413 views
                        0 likes
                        Last Post Traderontheroad  
                        Started by firefoxforum12, Today, 08:53 PM
                        0 responses
                        9 views
                        0 likes
                        Last Post firefoxforum12  
                        Started by stafe, Today, 08:34 PM
                        0 responses
                        10 views
                        0 likes
                        Last Post stafe
                        by stafe
                         
                        Started by sastrades, 01-31-2024, 10:19 PM
                        11 responses
                        169 views
                        0 likes
                        Last Post NinjaTrader_Manfred  
                        Working...
                        X