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 jxs_xrj, 01-12-2020, 09:49 AM
              6 responses
              3,290 views
              1 like
              Last Post jgualdronc  
              Started by Touch-Ups, Today, 10:36 AM
              0 responses
              8 views
              0 likes
              Last Post Touch-Ups  
              Started by geddyisodin, 04-25-2024, 05:20 AM
              11 responses
              61 views
              0 likes
              Last Post halgo_boulder  
              Started by Option Whisperer, Today, 09:55 AM
              0 responses
              8 views
              0 likes
              Last Post Option Whisperer  
              Started by halgo_boulder, 04-20-2024, 08:44 AM
              2 responses
              24 views
              0 likes
              Last Post halgo_boulder  
              Working...
              X