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

Why aren´t these rays parallel?

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

    #16
    Thanks for you reply Ryan. To clarify the erratic behaviour please take a look at these pics. Pic 1 zoomes in with a blue circle marking the indicator ray, just under the peak. At Pic 2 I´ve zoomed out. Now the ray is ABOVE the peak and far out the blue marking circle!

    Pic 3 is to show the ray gets its MAX(Highs[0], lookback)[0] from the second peak. The ray placement from Pic 2 zoom remains. The blue cirkle marks to area zoomed in Pic 1 and 2.

    Do you still think this is a matter of the ray ancors? All same settings, only a zooming made?!

    Edit: I´ve used the code you returned, but /* excluded to mid and low rays. My question at this point isn´t the lines not beeing parallel at times.








    Last edited by FREEN; 07-28-2011, 08:16 AM.

    Comment


      #17
      FREEN, I tried to reproduce your issue seen here but was unfortunately unable to - when I draw a simple ray programmatically like attached zooming / changing the scale would not impact it's anchor points used for me. You can also doubleclick on the draw object and checks it's points used in the 'data' section. Would you see issues with this script as well? I was testing here for example on today's ES 09-11 1 Minute chart on the ETH sessions.

      Thanks,
      Attached Files
      BertrandNinjaTrader Customer Service

      Comment


        #18
        Originally posted by FREEN View Post
        Thanks for your reply koganam,

        Not sure I got your point. The ancorpoints derives from [y = kx + m] in wich all lines in a x/y diagram are parallel. As you say, the horizontal distances (the x value) will vary. But that won´t affect the gradient of the rays given the same k value.

        As stated in my comment #11 even one line behaves erratically when looking in different zooms and time frames. That makes me think the calculations done are right, but the chart drawing behaves strangely.

        Kindly, Fredrik
        Not quite correct. Take some graph paper and plot the 4 coordinates of the lines, and you will see why they cannot be parallel.

        I cannot seem to be able to create a table in this editor, so I have attached a picture showing the calculations.

        It would be nice if someone would show me how to create a table. My HTML did not seem to do it right.
        Attached Files
        Last edited by koganam; 07-28-2011, 11:17 AM.

        Comment


          #19
          Thanks Bertrand,

          Well, if I remove the if statement your "DrawRayTest.cs" plots. But you pretty much hardcoded the ancorpoints, so I don´t get you point here.

          I might give up on this one, but please look at this video. I´m simply zooming in/out with [alt-up/down arrows]. Still 30 min bars on TNA.



          As you say, [Start Y] ray properties changes at this zooming. See bellow:








          So, I guess my question boils down to: Why does the anchorpoints change when the screen is redrawn (ie: at zooming)?!
          Last edited by FREEN; 07-28-2011, 01:56 PM.

          Comment


            #20
            FREEN, I was not able to exactly reproduce this with your script - if you print the anchors used and calc'ed by your script > would you see the same change? If you use for example a line with the same anchors same issue for you?
            BertrandNinjaTrader Customer Service

            Comment


              #21
              Originally posted by NinjaTrader_Bertrand View Post
              FREEN, I was not able to exactly reproduce this with your script - if you print the anchors used and calc'ed by your script > would you see the same change? If you use for example a line with the same anchors same issue for you?
              Bertrand, this video and the bellow steps answeres your question. Didn´t try the DrawLine() yet however. Are the MAX() and HighestBar() methods buggy??? It seems they´re fed with different arrays at different zoom levels.

              In video indicator is green hashed ray:

              Step 1: Outzoomed - indicator loaded
              Step 2: Variable anchor points confirmed in Output window
              Step 3: Zoom in on second highest peak
              Step 4: Step zooming -> ray jumps (changes anchorpoints in ray properties)
              Step 5: Look in output window -> no changes (since indicator not reloaded)
              Step 6: Reload indicator when zoomed in -> anchorpoints changes and indicator finds zoomed high instead!!!
              Step 7: New anchorpoints confirmed in output window
              Step 8: Zoom out -> anchorpoints changes back

              Screen video on the above steps: http://www.workplanner.se/nt2.wmv

              Comment


                #22
                Freen, thanks for the update. We'll look into and get back to you, most likely on Monday.
                AustinNinjaTrader Customer Service

                Comment


                  #23
                  FREEN, at which point do you exactly apply your script to the 30 min chart you use?

                  Single series script would process up to the last seen bar on the chart, and only process further if you scroll ahead up to the last bar, which could influence then in turn finding of your anchor points used.
                  BertrandNinjaTrader Customer Service

                  Comment


                    #24
                    Originally posted by NinjaTrader_Bertrand View Post
                    FREEN, at which point do you exactly apply your script to the 30 min chart you use?
                    As seen in the video the indicator script is loaded first at outzoom, then reapplied at zoom in, the reapplied again when zoomed out.

                    Originally posted by NinjaTrader_Bertrand View Post
                    Single series script would process up to the last seen bar on the chart, and only process further if you scroll ahead up to the last bar, which could influence then in turn finding of your anchor points used.
                    Aren´t the script ran on the total bars loaded rather than on the bars in view?! I know there´s methods for adapting the indicator to the bars in view, but no such methods are used in my code. Hence I expect it to run on all bars loaded.

                    1. Is what you see in the video expected behaviour?
                    2. Are you able to reproduce?

                    Comment


                      #25
                      FREEN, I could unfortunately not debug your anchor point selection for you - I suggest you simplify your script to identify the point where it breaks for you - the bars loading for a single series indicator is like I mentioned : the bars are processed until the last visible data point only, as such scolling and zooming will likely change your lookback results as new data is used.
                      BertrandNinjaTrader Customer Service

                      Comment


                        #26
                        Originally posted by NinjaTrader_Bertrand View Post

                        ...the bars are processed until the last visible data point only, as such scolling and zooming will likely change your lookback results as new data is used.
                        Thanks for you patience Bertrand. That pretty much explains everything. I was convinced all bars were processed until last loaded datapoint.

                        Q: Is there a way to force NT to have all bars loaded processed rather than all bars up to current visible point?

                        Elsewise it´s pretty hard to make a reliable indicator working in retrospect rather than prospect, as most indicators do.

                        //Fredrik
                        Last edited by FREEN; 08-04-2011, 04:55 AM.

                        Comment


                          #27
                          What you can do is add another series to make this a MultiSeries script and then just return out of processing anything for this additional series. MultiSeries indicators would process all bars up to the last bar.
                          BertrandNinjaTrader Customer Service

                          Comment


                            #28
                            Originally posted by NinjaTrader_Bertrand View Post
                            What you can do is add another series to make this a MultiSeries script and then just return out of processing anything for this additional series. MultiSeries indicators would process all bars up to the last bar.
                            Nice trick. I did not know that one.

                            Comment


                              #29
                              Originally posted by NinjaTrader_Bertrand View Post
                              MultiSeries indicators would process all bars up to the last bar.
                              Great Bertrand, that´s what I needed. Vielen dank und shönes wochenende!

                              //FREEN

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by nandhumca, Today, 03:41 PM
                              0 responses
                              4 views
                              0 likes
                              Last Post nandhumca  
                              Started by The_Sec, Today, 03:37 PM
                              0 responses
                              3 views
                              0 likes
                              Last Post The_Sec
                              by The_Sec
                               
                              Started by GwFutures1988, Today, 02:48 PM
                              1 response
                              5 views
                              0 likes
                              Last Post NinjaTrader_Clayton  
                              Started by ScottWalsh, 04-16-2024, 04:29 PM
                              6 responses
                              33 views
                              0 likes
                              Last Post ScottWalsh  
                              Started by frankthearm, Today, 09:08 AM
                              10 responses
                              36 views
                              0 likes
                              Last Post frankthearm  
                              Working...
                              X