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

detect intersection of diagonal line by current prices

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

    detect intersection of diagonal line by current prices

    Some NinjaScript indicator vendors offer a way to detect when prices cross or intersect a user specified diagonal line as the price bars are being formed, for example

    Can you give any hints on how this detection is done?
    Note that the above mentioned indicator also allows the line to be moved to a new location on the screen thus detecting a possibly new intersection.
    Thanks.

    #2
    Moving the line and detecting is out of my league, but if you new two points on the line, you could calculate the slope and track the value of the as a variable with each bar. I'm sure there is a more elegant way though.

    Comment


      #3
      The line is placed arbitrarily by the user so no points are known in advance. that is the crux of the problem. You really do have to detect where the line is. But thanks for trying.

      Comment


        #4
        You can detect this manual drawn lines with the DrawObjectsCollection available in NinjaScript -

        BertrandNinjaTrader Customer Service

        Comment


          #5
          detecting drawn object in interactive indicator

          Bertrand:
          Thanks for the hint. It was enough to work my way through the object collection docs and figure out how to interactively detect new objects.

          The trick seems to be to watch for a change in objectCount in OnBarUpdate(). If the count goes up, a new object has appeared somewhere.

          This is, additionally,the the closest thing to being able to interact with a running strategy/indicator to provide a.say. new price parameter value without going through a reload. One would draw a line on the screen and in the indicator/strategy check for objectCount change and then the value of EndY in the new Iline object and use that as the new parameter value. Not perfect for communicating new integers instead of prices but it's a start

          Or is there an easier way?

          Comment


            #6
            Hi roland_nt,

            I created a script that does much of what you're looking for. You're welcome to download and check out full source code here:
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              detecting drawn object in interactive indicator

              Ryan:
              Wow. Above and beyond the call of duty. Thanks ever so much for this quite thorough and useful skeleton.
              Last edited by roland_nt; 11-09-2011, 10:30 PM. Reason: add title

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by algospoke, Yesterday, 06:40 PM
              2 responses
              18 views
              0 likes
              Last Post algospoke  
              Started by ghoul, Today, 06:02 PM
              3 responses
              14 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Started by jeronymite, 04-12-2024, 04:26 PM
              3 responses
              44 views
              0 likes
              Last Post jeronymite  
              Started by Barry Milan, Yesterday, 10:35 PM
              7 responses
              20 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Started by AttiM, 02-14-2024, 05:20 PM
              10 responses
              180 views
              0 likes
              Last Post jeronymite  
              Working...
              X