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 draw horizontal line on Indicator?

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

    How to draw horizontal line on Indicator?

    Hello,

    I am using this:
    Code:
    AddLine(Brushes.DarkGray, 10, NinjaTrader.Custom.Resource.NinjaScriptIndicatorZeroLine);

    But the line drawn is always at y=0?

    I am calling the method inside OnStateChange with state = SetDefaults.

    Many Thanks, Caesar.

    #2
    Hello Skechers,

    When you say y=0 do you mean a price of 0? Have you removed and re apply the script since you added this code?
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hello Jesse,

      Yes, the line is always drawn on price = 0.

      Many Thanks, Caesar.

      Comment


        #4
        Hello Skechers,

        Have you tried making a new empty indicator to confirm that there is nothing else in that script that may be affecting the result?

        You can also try copying the help guide sample, I see that working on my end.



        JesseNinjaTrader Customer Service

        Comment


          #5
          Hello,

          It turns out that when I use a variable the is provided in the UI that variable's value is 0 in the State.SetDefaults state.

          How do I retrieve the variable value then?

          I was able to draw using Draw.HorizontalLine from StateDataLoaded.

          Many Thanks, Caesar.
          Last edited by Skechers; 10-18-2022, 02:11 PM.

          Comment


            #6
            Hello Skechers,

            Yes in SetDefaults you cant use a UI variable, if you take a look at the second sample in the help guide it shows how to use a variable from State.Configure.
            JesseNinjaTrader Customer Service

            Comment


              #7
              Ah, I see that now. Many Thanks, Caesar.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Option Whisperer, Today, 09:55 AM
              1 response
              11 views
              0 likes
              Last Post bltdavid  
              Started by port119, Today, 02:43 PM
              0 responses
              1 view
              0 likes
              Last Post port119
              by port119
               
              Started by Philippe56140, Today, 02:35 PM
              0 responses
              3 views
              0 likes
              Last Post Philippe56140  
              Started by 00nevest, Today, 02:27 PM
              0 responses
              2 views
              0 likes
              Last Post 00nevest  
              Started by Jonafare, 12-06-2012, 03:48 PM
              5 responses
              3,986 views
              0 likes
              Last Post rene69851  
              Working...
              X