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

Detecting mouse click on the chart once a drawing object is drawn

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

    Detecting mouse click on the chart once a drawing object is drawn

    Hello,

    I would like to be able to draw support/resistance shape object (Shift + F2), and once all the adjustments are made - once user clicks on an empty place on the chart - I want few things to happen:

    1. Strategy or indicator should detect that this drawing object just got finalized and read its upper and lower Y coordinates.
    2. Since this drawing object's upper and lower Ys are not rounded to the tick of the chart - it would be nice to either adjust this object to exact tick values on the chart, or as a workaround to get its upper/lower Ys and round them in the strategy/indicator (ideally would be to adjust the whole drawing object to chart's tick closest exact values.)
    3. As an alternative - maybe having some button on the chart trader - and when clicking it - it should finalize / lock this drawing object to correct closest tick values...
    4. I would like to be able to draw multiple shapes and be able to read upper/lower Ys from each of them. What is the best way to tag them? (maybe associate specific tag once that shape got finalized while reading/adjusting its Ys coordinates).

    Any help / samples would be great.

    Thanks a lot!
    Last edited by music_p13; 01-10-2023, 12:04 AM.

    #2
    Hello music_p13,

    Thanks for your post.

    Detecting mouse clicks requires the use of custom C# logic which would go beyond the level of support we would be able to provide since it is not NinjaScript-specific code.

    That said, below is a link to a site that may assist with this.
    A helper class to expand on the mouse events provided by the Control class.


    You could view this help guide page regarding looping through the drawing objects collection to find specific draw objects: https://ninjatrader.com/support/help...p+through+draw

    This script from the Ecosystem User App Share could be viewed to see how to add buttons on a chart: https://ninjatraderecosystem.com/use...bar-buttons-2/

    The reference sample linked below could be used to see how to add custom buttons to Chart Trader or modify existing Chart Trader buttons using C# WPF: https://ninjatrader.com/support/help...ui)-modifi.htm

    This forum thread will also be open for other community members to share their insights on unsupported code.

    Please let me know if I may assist further.​


    The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
    Brandon H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by kempotrader, Today, 08:56 AM
    0 responses
    7 views
    0 likes
    Last Post kempotrader  
    Started by kempotrader, Today, 08:54 AM
    0 responses
    4 views
    0 likes
    Last Post kempotrader  
    Started by mmenigma, Today, 08:54 AM
    0 responses
    2 views
    0 likes
    Last Post mmenigma  
    Started by halgo_boulder, Today, 08:44 AM
    0 responses
    2 views
    0 likes
    Last Post halgo_boulder  
    Started by drewski1980, Today, 08:24 AM
    0 responses
    4 views
    0 likes
    Last Post drewski1980  
    Working...
    X