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

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.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by philmg, Today, 01:17 PM
    1 response
    4 views
    0 likes
    Last Post NinjaTrader_ChristopherJ  
    Started by cre8able, Today, 01:01 PM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by manitshah915, Today, 12:59 PM
    1 response
    3 views
    0 likes
    Last Post NinjaTrader_Erick  
    Started by ursavent, Today, 12:54 PM
    1 response
    4 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by Mizzouman1, Today, 07:35 AM
    3 responses
    17 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Working...
    X