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

possible to draw a Line from drawing Tools but with Draw.Line and not with SharpDX

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

    possible to draw a Line from drawing Tools but with Draw.Line and not with SharpDX

    Hi,

    I'm with my drawing tool......

    I want to draw some lines, but with Draw.Line, like in an indicator.
    Why?
    Because:
    - I don't need to create the points with SharpDX vectors
    - I can create as many lines as needed with iterations:
    Draw.Line(this,"ln1"+i.ToString(), false,....... // where "i" is increasing
    I don't know how many lines I will need to create

    I try to use the Draw.Line sentence like in an indicator,
    Draw.Line(this, "ln1"+i.ToString(), false, PivotTime[1], PivotPr[1], PivotTime[2], PivotPr[2], Brushes.DarkGreen,DashStyleHelper.Solid, 1);
    but I get some errors:
    - I get an error in the "this"
    - I get an error in the DateTime parameters, as Ninja tries to get there an integer


    Is it possible to use Draw.Line in this manner?

    Thanks!


    #2
    you can refer link below :


    Comment


      #3
      Thanks cincai,

      This is what I tried with
      Draw.Line(this, "ln1"+i.ToString(), false, PivotTime[1], PivotPr[1], PivotTime[2], PivotPr[2], Brushes.DarkGreen,DashStyleHelper.Solid, 1);
      but I get some errors:
      - I get an error in the "this"
      - I get an error in the DateTime parameters, as Ninja tries to get there an integer

      Later, I tried it with "RenderTarget.DrawLine" and I got it!
      I could create the points and vectors as arrays, so that I had enough of them.

      But maybe there is still a way of using "Draw.Line" in a drawing tool.....

      Comment


        #4
        how you initialize PivotTime[1] ??

        At the same time, can you screenshot the error ?

        Comment


          #5
          Hello artson,

          Thank you for your post.

          I see you stated in post #3 that you were able to accomplish your goal using RenderTarget.DrawLine.

          Draw methods such as Draw.Line should not be called from a Drawing Tool. Only SharpDX methods should be used in your drawing tool such as RenderTarget.DrawLine. Please see the documentation linked below for more information about RenderTarget.DrawLine and SharpDX.

          RenderTarget.DrawLine - https://ninjatrader.com/support/help...t_drawline.htm

          SharpDX - https://ninjatrader.com/support/help..._reference.htm

          Also, please note that Drawing Tools cannot be hosting scripts and we would not use barsAgo indexing in a drawing tool.

          Let us know if you have further questions.
          Brandon H.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by judysamnt7, 03-13-2023, 09:11 AM
          4 responses
          59 views
          0 likes
          Last Post DynamicTest  
          Started by ScottWalsh, Today, 06:52 PM
          4 responses
          36 views
          0 likes
          Last Post ScottWalsh  
          Started by olisav57, Today, 07:39 PM
          0 responses
          7 views
          0 likes
          Last Post olisav57  
          Started by trilliantrader, Today, 03:01 PM
          2 responses
          22 views
          0 likes
          Last Post helpwanted  
          Started by cre8able, Today, 07:24 PM
          0 responses
          10 views
          0 likes
          Last Post cre8able  
          Working...
          X