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 pvincent, 06-23-2022, 12:53 PM
    14 responses
    238 views
    0 likes
    Last Post Nyman
    by Nyman
     
    Started by TraderG23, 12-08-2023, 07:56 AM
    9 responses
    383 views
    1 like
    Last Post Gavini
    by Gavini
     
    Started by oviejo, Today, 12:28 AM
    0 responses
    1 view
    0 likes
    Last Post oviejo
    by oviejo
     
    Started by pechtri, 06-22-2023, 02:31 AM
    10 responses
    125 views
    0 likes
    Last Post Leeroy_Jenkins  
    Started by judysamnt7, 03-13-2023, 09:11 AM
    4 responses
    59 views
    0 likes
    Last Post DynamicTest  
    Working...
    X