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

More detail onmousedown please

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

    More detail onmousedown please

    It's a little beyond my current C# skills. I'm having trouble with anything requiring overriding a method, such as onmousedown. I tried pasting the example code from here into my strategy class, but it says 'no suitable method found to override.' I get confused with abstract, override, etc.

    #2
    Hello Chippy,

    Thank you for the post.

    It looks like the link you provided is to the drawing tools list. There is an override for a drawing object for mouse down, was this the page you had seen? https://ninjatrader.com/support/help...nmousedown.htm

    If so that would not be able to be used in a strategy, if you take a look at the left side of the help guide that will help to determine which type something is for. In this case its under the drawing tool section.

    A strategy does not natively have a mouse down event. You could get the mouse events from the ChartControl however that requires some error handling, you can see a sample of that here: https://ninjatrader.com/support/foru...687#post742687


    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi and thank you. Yes, that was indeed my intended link. The alternate link you provided for ChartControl I don't think will work for what I'm trying to do. There are a few different ways to possibly implement this, but I can't seem to find one that will work.

      I would like to be able to place a line to mark as trend/support/resistance on a chart that can be accessed programmatically. I would be happy with drawing the lines from the GUI if there was a way to access the drawn objects collection. The onmousedown was just intended as an event capture that would run code for analyzing the drawn line.

      Another way to do this would be if there was a way to dynamically input the anchor coordinates via the keyboard? Is this possible? If I could enter the coordinates, I already know how to draw the lines programmatically.

      I hope that made sense?

      Comment


        #4
        Also, I can't get the link you provided to work either... I get the same error... method not suitable. I just cut and pasted the code above my strategy.cs namespace, but removed the using statements as they're already applied to the strategy.cs file I'm working with. No joy.

        Comment


          #5
          Hello Chippy,

          You can use the existing drawing tools for that purpose, there is a sample of accessing tools by name or looping over the collection of tools here: https://ninjatrader.com/support/help...sub=drawobject

          JesseNinjaTrader Customer Service

          Comment


            #6
            Thanks Jesse. I got the drawn objects to print to the output window from the live chart. I haven't done much testing on live charts, just in the analyzer and had forgotten to tick the "enable" box on the strategy setup.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by DJ888, 04-16-2024, 06:09 PM
            6 responses
            18 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by Jon17, Today, 04:33 PM
            0 responses
            1 view
            0 likes
            Last Post Jon17
            by Jon17
             
            Started by Javierw.ok, Today, 04:12 PM
            0 responses
            6 views
            0 likes
            Last Post Javierw.ok  
            Started by timmbbo, Today, 08:59 AM
            2 responses
            10 views
            0 likes
            Last Post bltdavid  
            Started by alifarahani, Today, 09:40 AM
            6 responses
            41 views
            0 likes
            Last Post alifarahani  
            Working...
            X