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

Indicator awareness of manual drawn lines

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

    Indicator awareness of manual drawn lines

    Is there a way in NT7 for an Indicator to know of a hand drawn ray, horizontal, or vertical line?

    And, to get at least two coordinates on that line?

    thanks

    #2
    Hello,

    Thank you for your forum post.

    This is possible please see the below guide on how to do this:



    You will want to use the sample code at the bottom to loop through all objects on the chart and then there is a parameter there you can check as well for if its userdrawn.

    Let me know if I can be of further assistance.

    Comment


      #3
      Hi Brett. Is there any facility for doing this in 6.5?

      Comment


        #4
        Hi,

        Don't believe this is available, however you might want to take a look here and see if you can find something about it:


        Use the arrows in the upper right corner to scroll through the documentation.
        Vince B.NinjaTrader Customer Service

        Comment


          #5
          Thanks Vincent

          Comment


            #6
            How does the drawObject work? Will it allow you to access indicator values on a chart you're currently displaying? For example if I've drawn an SMA(20) on a 6J 03-11 chart which has the label SMA_20, is it possible to start programmatically grabbing values from that specific chart?

            Comment


              #7
              JayJoshi, can you please be more specific? If you take a look at the code at the bottom of the page linked to by Brett in post #2, you will see how to loop through the draw objects on the chart. You can then grab the values of whatever draw object you wish. So in short, yes, it is possible to access indicator/draw object values on a chart the indicator is on.
              AustinNinjaTrader Customer Service

              Comment


                #8
                Thanks Austin.

                I threw up a chart (File --> New --> Chart) and stuck two SMA's on there and ran the simulated feed. Then I created a simple strategy with the wizard and used the 'foreach' loop sample to unlock the draw objects. I also put a print statement in the foreach loop to make sure the loop was being reached but nothing was written to the Output Window when i ran the strategy for the same symbol.

                I think I'm missing a step somewhere that links the chart itself that I built to the actual strategy code. Is there an end-to-end tutorial on how to link a chart to a strategy?

                Comment


                  #9
                  JayJoshi, I should have been more specific. Indicator plots are not draw objects. To get those values, you will have to reference them directly:
                  currentSMA = SMA(14)[0];

                  Draw objects are items such as dots, diamonds, squares, lines, etc.

                  Once you apply a strategy to a chart, you must make sure it is enabled. Then they are "linked" and the strategy is running on the chart data.
                  AustinNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by cocoescala, 10-12-2018, 11:02 PM
                  6 responses
                  939 views
                  0 likes
                  Last Post Jquiroz1975  
                  Started by gbourque, Today, 06:39 AM
                  1 response
                  4 views
                  0 likes
                  Last Post NinjaTrader_Erick  
                  Started by cmtjoancolmenero, Yesterday, 03:58 PM
                  1 response
                  17 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Started by benmarkal, Yesterday, 12:52 PM
                  3 responses
                  23 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Started by helpwanted, Today, 03:06 AM
                  1 response
                  20 views
                  0 likes
                  Last Post sarafuenonly123  
                  Working...
                  X