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

How to move HorizontalLine with codes?

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

    How to move HorizontalLine with codes?

    All questions refer to NT8 v8.0.5.2

    Q1) I can create a HL in codes:
    private HorizontalLine myHL;
    myHL = Draw.HorizontalLine(this, "HL88", true, Close[0]-10, Brushes.Green, DashStyleHelper.Solid, 2);

    How to then move the HL with codes to a different Y value, say, Close[0]-20?

    Q2) Codes with "myHL.IsLocked" compile ok but when I type "myHL." in NinjaScript Editor, the intellsense shows a dropdown list but without "IsLocked" in the list. Why is this so?

    I'm new to NinjaScript, & having a hard time getting around. Pls help, thanks.

    #2
    Hello Tiang,

    Thanks for opening the thread.

    You can update the position of a drawing object by making a new call to that drawing object. You will also want to pay attention to the tag of the drawing object. If you specify different coordinates and the same tag, the drawing object with that tag will get updated to those coordinates.

    Please see the excerpt from the help guide below:

    tag

    A user defined unique id used to reference the draw object.

    For example, if you pass in a value of "myTag", each time this tag is used, the same draw object is modified. If unique tags are used each time, a new draw object will be created each time.


    I have asked the development team why IsLocked() does not list in Intelliprompt. This method is valid to access within code, and there is no forced internal code that prevents this from listing. The development team's prognosis is that it is a limitation of the software used to build the NinjaScript Editor.

    If you would like, I could submit a ticket to track this limitation.

    Please let me know if I may be of further assistance.
    JimNinjaTrader Customer Service

    Comment


      #3
      Thanks Jim for your help, & pls "submit ticket to track this limitation". Any effort to improve the Intelliprompt & Help documentation is appreciated. Allow me to share why this is important.

      After much digging around the NT Forum, I found a way to get the y-value of HL:
      yValue = myHL.Anchors.First().Price;
      which I won't find out from NT8 help documentation.
      There are many other Properties & Methods that Intelliprompt doesn't show. And when the NT8 help documentation doesn't help either, it makes learning/using Ninjascript so much more difficult. I look forward to NT8 improvements. Thanks.

      Comment


        #4
        Hello Tiang,

        As the improvements to IntelliPrompt come from software not developed by our development team, this issue will be tracked by them internally.

        We can create a ticket on our end to track the interest in improving the help guide. Could you point out any particular sections that are unclear or can be improved? Please be as specific as possible in how we can best improve them.

        I look forward to being of further assistance.
        JimNinjaTrader Customer Service

        Comment


          #5
          Hi Jim,
          If it's more difficult to improve the Intelliprompt due to it's under 3rd party's control, not NT's, then the effort could be better directed to the NT8 Help doc. The important point is that complete info on Ninjascript be available, at at least one place. So what is NT's guiding principle on providing this info...The specific is just 1 eg to understand the principle behind. For specific, let's continue to use the HorizontalLine (HL) as eg. It's easy to guess what a user of HL would like, eg: how to read HL y-value, say, after it's been moved manually; if it's moved manually, is there an event that the coder can hook to; etc. As I mentioned previously, after digging through many NT Forum threads, I found out I can get the y-value by : yValue = myHL.Anchors.First().Price;
          The NT8 Help doc shows:
          ----------------------------------------------------------
          Definition
          Represents an interface that exposes information regarding a Horizontal Line IDrawingTool.

          Methods and Properties
          StartAnchor
          An IDrawingTool's ChartAnchor representing the starting point of the drawing object
          EndAnchor
          An IDrawingTool's ChartAnchor representing the end point of the drawing object
          Stroke
          A Stroke object used to draw the object

          Example
          ns

          // Instantiate a HorizontalLine object
          HorizontalLine myLine = Draw.HorizontalLine(this, "tag1", 1000, Brushes.Black);

          // Set a new Stroke for the object
          myLine.Stroke = new Stroke(Brushes.Green, DashStyleHelper.Dash, 5);
          ---------------------------------------------------------------------------------------------------------
          From the Help doc above, I won't guess I need myHL.Anchors.First().Price to get the y-value. Even if I search for Anchors.First().Price in NT8 Help, it says "no result found". It'ld be great if NT can provide the documentation similiar like what Microsoft did on the .NET Class Library help doc, which provide complete info on a class definition, which include all properties, methods, inheritance tree, code usage eg, etc. in one location.
          Under NT current situation, I've to trough the NT Forum threads to hopefully find the answer. Regarding NT Forum, it's unclear sometimes whether what I'm reading apply to NT7, NT8, or both. I'm not saying the Forum is bad; in fact it's good, otherwise I won't be able to get your help right now. I just wish I could get complete ninjascript info preferably in 1 place, then I don't have to post in Forum for at least the simple stuffs, which also take much of your time.

          Thanks for help, Jim.

          Comment


            #6
            Hello Tiang,

            I have submitted a feature request to improve sections of the help guide. Namely to cover any members available including relevant C# methods and properties within NinjaScript items. I gave the example of Anchors to be listed with the members of a C# collection.

            This feature request is being tracked with the ticket ID SFT-2185. You can reference this ticket ID in the Release Notes for the version of NinjaTrader 8 in which the help guide improvements have been implemented.

            Release Notes can be viewed here: http://ninjatrader.com/support/helpG...ease_notes.htm

            Thanks for providing input to improve NinjaTrader.
            JimNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

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