Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Converting Coordinates to NT8

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

    Converting Coordinates to NT8

    Dear Support,

    globalLine coordinates from an NT7 indicator for a user dawn line are:
    Code:
    						leftY 			= globalLine.EndY;
    						rightY			= globalLine.StartY;
    						leftBarsAgo		= globalLine.EndBarsAgo;
    						rightBarsAgo	        = globalLine.StartBarsAgo;
    converted to NT8
    Code:
    						leftY 			= globalLine.EndAnchor.Price;
    						rightY			= globalLine.StartAnchor.Price;
    						leftBarsAgo		= globalLine.EndAnchor.BarsAgo;
    						rightBarsAgo	        = globalLine.StartAnchor.BarsAgo;
    compiles but does not seem to plot. Are these definitions for left and right correct for NT8? Am I supposed to use SlotIndex instead (i.e.globalLine.EndAnchor.SlotIndex)?

    Thanks
    Last edited by aligator; 04-29-2018, 08:15 PM.

    #2
    Hello aligator,

    Thank you for your note.

    So I can best answer your question, would you please provide some context of what you are attempting to convert or where these code blocks are coming from? Perhaps the name of the indicator or section of the helpguide you are referencing?

    I look forward to your reply.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_AlanP View Post
      Hello aligator,

      Thank you for your note.

      So I can best answer your question, would you please provide some context of what you are attempting to convert or where these code blocks are coming from? Perhaps the name of the indicator or section of the helpguide you are referencing?

      I look forward to your reply.
      Thanks Alan,

      This is an indicator conversion of Y and X (start and end) coordinates for a user draw line (globalLine) in NT7 to NT8.

      In the post #1- Is the second script block the proper code in NT8 for the start and end of a line or I need to use SlotIndex instead of BarsAgo for the X coordinate or is it something else?

      (ref: DrawObjects - Looping through the collection to find specific draw objects)

      Many thanks.

      Comment


        #4
        Hello alligator,

        If you add prints to the script for what you’re attempting to set leftY to, are you seeing an output?

        Do you have a sample script which demonstrates what you’re trying to do?

        I look forward to your reply.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_AlanP View Post
          Hello alligator,

          If you add prints to the script for what you’re attempting to set leftY to, are you seeing an output?

          Do you have a sample script which demonstrates what you’re trying to do?

          I look forward to your reply.
          Thnaks Alan,

          Here is the converted file. It works fine now, but on and off. I have commented out areas that I have converted to NT8. See lines 115 to 144 in regards to proper conversion of a user drawn line coordinates as shown in post #1.

          I am planning to post and share this conversion when I have cleaned it up and possibly added a couple of features including features for market analyzer.

          Many thanks.
          Attached Files

          Comment


            #6
            Hello aligator,

            I apply the indicator to a chart, draw a Line on the chart, the line changes colors and an alert sound is played when the price crosses the line.

            In your first post you mention it doesn't plot, is it supposed to plot? What is the issue I'm looking for exactly here, the indicator appears to work fine.

            I look forward to your reply.
            Alan P.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_AlanP View Post
              Hello aligator,

              I apply the indicator to a chart, draw a Line on the chart, the line changes colors and an alert sound is played when the price crosses the line.

              In your first post you mention it doesn't plot, is it supposed to plot? What is the issue I'm looking for exactly here, the indicator appears to work fine.

              I look forward to your reply.
              Thanks Alan,

              No plot, what I meant was no Alert. Initially I converted horizontal coordinate to Start/EndAnchor.BarsAgo then I changed it to Start/EndAnchor.SlotIndex and it seems to work now, but not all the time for all line types.

              But, I am not sure if the coordinates conversion is correct or not since the indicator does not seem to work all the time for all four types of line. Did you draw Line, Ray, Extended Line, and Horizontal Line and alert worked for all of them? In my case, the line changes color to red but no alerts are generated.

              Thanks.
              Last edited by aligator; 05-02-2018, 11:47 AM.

              Comment


                #8
                Hello alligator,

                I used a ray.

                That the indicator works correctly at least one time hints that the coordinates are correct, as do prints when I add them to the script. How the indicator handles additional drawing lines, resetting of the alarm, where the start and end anchor are in relation to each other could be the issue.

                Does the indicator stop working when you add additional lines to the chart?

                If you only apply one chart, does the indicator always work as expected?

                I look forward to your reply.
                Alan P.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by NinjaTrader_AlanP View Post
                  Hello alligator,

                  I used a ray.

                  That the indicator works correctly at least one time hints that the coordinates are correct, as do prints when I add them to the script. How the indicator handles additional drawing lines, resetting of the alarm, where the start and end anchor are in relation to each other could be the issue.

                  Does the indicator stop working when you add additional lines to the chart?

                  If you only apply one chart, does the indicator always work as expected?

                  I look forward to your reply.
                  Thanks Alan,

                  I only use one chart (1m) and one user drawn line (any type) with the start in the past and end in future, and rearm resets on new bar.

                  Receiving no alarms when crossing now and get the No alert message. I did get some alarms before after crossing but not always.

                  Thanks.

                  Comment


                    #10
                    Hello aligator,

                    I would suggest adding print statements to check whether and when your conditions are becoming true. I’ve provided a link to a youtube video which covers an example of using prints to understand behavior: https://www.youtube.com/watch?v=K8v_...tu.be&t=48m45s

                    I’ve provided a link covering debugging which you may find helpful.
                    Debugging: http://ninjatrader.com/support/forum...ead.php?t=3418

                    Please let us know if you need further assistance.
                    Alan P.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by geddyisodin, Today, 05:20 AM
                    2 responses
                    15 views
                    0 likes
                    Last Post geddyisodin  
                    Started by hazylizard, Today, 08:38 AM
                    0 responses
                    4 views
                    0 likes
                    Last Post hazylizard  
                    Started by Max238, Today, 01:28 AM
                    5 responses
                    42 views
                    0 likes
                    Last Post Max238
                    by Max238
                     
                    Started by giulyko00, Yesterday, 12:03 PM
                    3 responses
                    12 views
                    0 likes
                    Last Post NinjaTrader_BrandonH  
                    Started by habeebft, Today, 07:27 AM
                    1 response
                    14 views
                    0 likes
                    Last Post NinjaTrader_ChristopherS  
                    Working...
                    X