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

Use of SharpDX to Draw Line

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

    Use of SharpDX to Draw Line

    Dear Support,

    Here is an example situatuion: I can draw a line based on certain conditions using the default Draw.Line() to either show the last drawn line or all historical lies drawn by simply adding "+CurrentBar" to string tag as show below
    Code:
    Draw.Line(NinjaScriptBase owner, string tag, ....) to show only the last line drawn
    Draw.Line(NinjaScriptBase owner, string tag + CurrentBar, ....) to show all historical lines drawn
    Here is the question: I want to use SharpDX rendering of the lines for resource efficiency. However, I want to have an option to render only the last line rendered or all the historical lines rendered. Is that possible in SharpDX? If so, how such an option is coded in SharpDX to allow switching between rendering all historical lins or only the last redered line? An example would be appreciated.

    Many thanks.

    Tags: SharDX, Draw.Line

    #2
    Hello aligator,

    The OnRender override would just render the commands you pass in that override, there is no concept of all or some objects, its what you specifically code to render that shows up.

    If you wanted to have a single object you would have a single line of code in OnRender to render a single line, if you wanted multiple lines you would repeat that for each line. You would have to make conditions if you wanted to render differently based on user input.

    You would have to come up with a way to store the prices where the line start and end up be and then reference those prices from OnRender to be used for rendering the lines. You can see the ZigZag indicator for an example of storing data in a plot and later reusing that from OnRender to custom render the data.




    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by bortz, 11-06-2023, 08:04 AM
    47 responses
    1,611 views
    0 likes
    Last Post aligator  
    Started by jaybedreamin, Today, 05:56 PM
    0 responses
    9 views
    0 likes
    Last Post jaybedreamin  
    Started by DJ888, 04-16-2024, 06:09 PM
    6 responses
    19 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by Jon17, Today, 04:33 PM
    0 responses
    6 views
    0 likes
    Last Post Jon17
    by Jon17
     
    Started by Javierw.ok, Today, 04:12 PM
    0 responses
    22 views
    0 likes
    Last Post Javierw.ok  
    Working...
    X