Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Pass Selection of Bars to Indicator By Drawing on a Chart

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

    Pass Selection of Bars to Indicator By Drawing on a Chart

    I wasn't sure how to best describe what I am looking to do, so I have attached a picture. Is it possible to pass a selection of bars to an indicator by drawing on the chart? For example, lets assume I want to add up all the volume, Highest High and Lowest Low prices for just a region of bars that I would pick by drawing the region of the chart, as shown in the picture I have attached.

    The indicator would accept the bars within the rectangle drawn and do the calculations only for those bars.

    I wasn't sure where to start my search for doing this...
    Attached Files
    Jim-Boulder
    NinjaTrader Ecosystem Vendor - Elephant Tracks

    #2
    Hello Jim-Boulder,

    Thanks for opening the thread!

    This would be possible to do, however it would involve some custom programming involving pure C#.

    To provide some direction, you could use your own mouse event handlers to detect where you are clicking on the Chart's ChartPanel, and then you could use the ChartControl and ChartScale methods to convert pixel coordinates from the mouse to bar slots and prices.

    As you would be clicking and dragging to create a rectangle which would need to be updated faster than OnBarUpdate() to give solid visual feedback, I would advise to use custom SharpDX rendering in OnRender() to create the rectangle.

    I've included links to our publicly available information on the topics discussed, and to an example indicator conversion that creates its own mouse event handlers.

    ChartrControl.GetSlotIndexByX() - https://ninjatrader.com/support/help...otindexbyx.htm

    ChartScale.GetValueByY()- https://ninjatrader.com/support/help...etvaluebyy.htm

    OnRender() - https://ninjatrader.com/support/help...s/onrender.htm

    SharpDX Rendering - https://ninjatrader.com/support/help..._rendering.htm

    Advanced Risk Reward indicator (See OnstateChange() for subscribing/unsubscribing and the Mouse region for additional example code) - https://ninjatrader.com/support/foru...atid=7&lpage=1

    If there is anything else I can do to assist, please let me know.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    580 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    335 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    102 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    554 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    552 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X