Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

EventArgs question.

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

    EventArgs question.

    HI,
    Using the following line of code to handle a mouse click event:
    void ChartControl_MouseClick(object sender, MouseEventArgs e).
    What I am able to extract from "e" now is X & Y coordinates relative to pixels.
    What I want however is X, Bar Index[] & Y, value in price.
    How can I , or is it even possible to change what properties are contained in "e"?
    Or perhaps how could I change that line of code to make the properties I want, to be available?
    Or is there a pile of other complex code to write to obtain what I want?

    Cheers,
    Ken.

    #2
    Hi Kenny, this would be truly the mouse coordinates you get here returned from this C# method.

    Via additional custom code you could then in turn find out the associated x/y price values -

    http://www.ninjatrader.com/support/f...ad.php?t=52070
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thanks Bertrand.

      Thanks Bertrand, I`ll have a play with that and see if I can achieve my objective.

      Comment


        #4
        (e.X), to the BarIndex[]

        HI,
        I was able to use the suggested example to get the price from Y, using "GetPriceFromY", but have not been able to work out how to get the bars from X. I have tried "GetBarFromX" and "BarFromX", both do not exist in the current context. I have tried many other ways but have had no success.

        I want to some how convert the mouse down coordinate, (e.X), to the BarIndex[].

        Any help appreciated.
        Thanks,
        Ken.
        Last edited by KennyK; 09-09-2014, 04:15 PM. Reason: Add clarification

        Comment


          #5
          Hi Kenny, one approach for this item was discussed here with code snippets - http://www.ninjatrader.com/support/f...ad.php?t=49094
          BertrandNinjaTrader Customer Service

          Comment


            #6
            Still need help getting the bar index

            Originally posted by NinjaTrader_Bertrand View Post
            Hi Kenny, one approach for this item was discussed here with code snippets - http://www.ninjatrader.com/support/f...ad.php?t=49094
            I have studied and tried using parts of this code to get the bar index number from the mouse event, but have not succeeded thus far.

            Would I need to use all of this code?
            Or just a small part of it?

            If it`s just a bit of it that`s required, I wonder if you could perhaps show me what that bit is?

            Thanks,
            Ken.

            Comment


              #7
              Originally posted by KennyK View Post
              I have studied and tried using parts of this code to get the bar index number from the mouse event, but have not succeeded thus far.

              Would I need to use all of this code?
              Or just a small part of it?

              If it`s just a bit of it that`s required, I wonder if you could perhaps show me what that bit is?

              Thanks,
              Ken.
              What is the pseudocode, or sequence of calculations, that you have tried to use? Have you written down the logic of the arithmetic method that you would use to calculate what you want?

              Comment


                #8
                Originally posted by koganam View Post
                What is the pseudocode, or sequence of calculations, that you have tried to use? Have you written down the logic of the arithmetic method that you would use to calculate what you want?
                I have tried using various bits of code from "ChartHelper", and "DS DataBox" as well as trying to guess using intellisense. It`s hard without know all the proprietary Ninja methods etc. In NT8 I expect this to be more open. How ever there is a lot more code to add to the project after I can work out how to get the bar index number from the mouse event, but I am taking it one step at a time. Once I can get both the price and the bar index number from the mouse event, I can then continue. The bar index number and price are both needed first, to use for calculations that involve both time and price. I also plan to use the mouse clicks to at the same time provide the anchors for drawing lines and or Gann fans, fib extensions and retracements.
                Hope you can help.
                Ken.

                Comment


                  #9
                  Originally posted by KennyK View Post
                  I have tried using various bits of code from "ChartHelper", and "DS DataBox" as well as trying to guess using intellisense. It`s hard without know all the proprietary Ninja methods etc. In NT8 I expect this to be more open. How ever there is a lot more code to add to the project after I can work out how to get the bar index number from the mouse event, but I am taking it one step at a time. Once I can get both the price and the bar index number from the mouse event, I can then continue. The bar index number and price are both needed first, to use for calculations that involve both time and price. I also plan to use the mouse clicks to at the same time provide the anchors for drawing lines and or Gann fans, fib extensions and retracements.
                  Hope you can help.
                  Ken.
                  Maybe we are talking at cross-purposes. It is not a matter of trying code: it is a matter of crafting a solution to what is now an arithmetic problem. You have certain data that you can query, and some that you can capture. Have you made an attempt to work out the arithmetic of a solution? The original code was written to solve a specific problem, which happens to be somewhat related to what you want to do. That does not mean that you can just lift parts of the code, and expect a resolution.

                  You say that you have tried many things, but so far, I asked you how you tried to solve the problem, and all you tell me is that you tried to use some code.

                  I have read the referenced code. While a method to calculate the x-values can be derived from how the y-values were calculated, there is no code in there that you can lift to get the x-values. That code would have to be written. There is also the issue that bar indexes are related in quanta of pixels, whereas y-values are directly related to pixel positions. What rules are to be followed in assigning the bar index if the x-value is between bars?

                  If you want someone to work out the solution to the problem and provide you with code, it might be a better proposition to pay someone to do it.

                  Just my $0.02.
                  Last edited by koganam; 09-12-2014, 08:50 AM. Reason: Corrected punctuation.

                  Comment


                    #10
                    Originally posted by koganam View Post
                    Maybe we are talking at cross-purposes. It is not a matter of trying code: it is a matter of crafting a solution to what is now an arithmetic problem. You have certain data that you can query, and some that you can capture. Have you made an attempt to work out the arithmetic of a solution. The original code was written to solve a specific problem, which happens to be somewhat related to what you want to do. That does not mean that you can just lift parts of the code, and expect a resolution.

                    You say that you have tried many things, but so far, I asked you how you tried to solve the problem, and all you tell me is that you tried to use some code.

                    I have read the referenced code. While a method to calculate the x-values can be derived from how the y-values were calculated, there is no code in there that you can lift to get the x-values. That code would have to be written. There is also the issue that bar indexes are related in quanta of pixels, whereas y-values are directly related to pixel positions. What rules are to be followed tin assigning the bar index if the x-value is between bars?

                    If you want someone to work out the solution to the problem and provide you with code, it might be a better proposition to pay someone to do it.

                    Just my $0.02.
                    Thanks,
                    My problem is I am relatively new to C# coding and am having trouble relating it to Ninja. I only have a limited understanding and from what you said, working out how to get the X values may be beyond me at present. I really would prefer to learn though than than to pay for it to be done for me. I have done a couple of book based C# courses creating a couple of dozen windows applications as part of the process and have created a couple of basic indicators successfully. But I want to learn more about how to apply what I have learned to Ninja as well as learn more about Ninja Script, because there is a lot that I don`t know and isn`t readily available. I have searched high and low for courses, books and training to help me achieve this goal, but have come up empty. I have inquired locally for a C# tutor to teach me one on one on an hourly basis, but I can`t find any. The local colleges don`t teach C#. I don`t know what else I can do?
                    Ken.

                    Comment


                      #11
                      Originally posted by KennyK View Post
                      Thanks,
                      My problem is I am relatively new to C# coding and am having trouble relating it to Ninja. I only have a limited understanding and from what you said, working out how to get the X values may be beyond me at present. I really would prefer to learn though than than to pay for it to be done for me. I have done a couple of book based C# courses creating a couple of dozen windows applications as part of the process and have created a couple of basic indicators successfully. But I want to learn more about how to apply what I have learned to Ninja as well as learn more about Ninja Script, because there is a lot that I don`t know and isn`t readily available. I have searched high and low for courses, books and training to help me achieve this goal, but have come up empty. I have inquired locally for a C# tutor to teach me one on one on an hourly basis, but I can`t find any. The local colleges don`t teach C#. I don`t know what else I can do?
                      Ken.
                      Well, the issue is really not what programming language we are using: it is how to solve the problem. The code is just the means to have a reusable general solution to that problem.

                      If you want help to code, NinjaTrader has Educational Partners and Consultants, whose business it is to help you navigate NinjaScript, and/or to craft specific code that you can examine. You just have to be sure that whomever you meet with (even virtually), can resolve the arithmetic of coordinate geometry; which is what the problem involves.

                      Here are some reference links:

                      http://www.ninjatrader.com/Ecosystem.php
                      http://www.ninjatrader.com/Education.php

                      I am a bit surprised that you cannot find a local tutor, but that just means that you may have to make do with an online one.

                      All the best.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by t.kelly4149, Today, 05:36 PM
                      1 response
                      5 views
                      0 likes
                      Last Post bltdavid  
                      Started by SilverSurfer1, Today, 06:29 PM
                      0 responses
                      16 views
                      0 likes
                      Last Post SilverSurfer1  
                      Started by trader3000a, Today, 01:06 PM
                      1 response
                      9 views
                      0 likes
                      Last Post NinjaTrader_ShawnB  
                      Started by marcus2300, Today, 11:45 AM
                      3 responses
                      31 views
                      0 likes
                      Last Post marcus2300  
                      Started by pel11, Today, 11:06 AM
                      0 responses
                      13 views
                      0 likes
                      Last Post pel11
                      by pel11
                       
                      Working...
                      X