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

ConstantLines Indicator Ninja8

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

    ConstantLines Indicator Ninja8

    I've just discovered this indicator. I am not sure if it is new or I have simply missed it but I have similar indicator of my own that I created for Ninja7. Trouble is I have not been able successfully convert it to Ninja8. Since the ConstantLines indicator is similar in that it draws horizontal lines on a chart, I am thinking about starting with that as a base. A couple of questions;

    1. Can I copy and paste to start, changing the name of the ConstantLines Indicator? If not, how do I start a fresh and new indicator? (I suppose there is some tutorial out there but I have yet to locate it)

    2. My indicator has 7 lines and the ConstantLines Indicator only has 4 lines. Can I add the other 3 lines?

    3. The location of the lines is placed by opening the ConstantLines Indicator and entering the numerical value for placement. My indicator places lines daily based on a mathematical formula which changes daily. Can I change the ConstantLines Indicator to using formulas instead of requiring daily input?

    Thanks in advance for your assistance.

    Best regards,

    Dolfan
    Last edited by Dolfan; 05-07-2018, 12:02 PM. Reason: misspelled

    #2
    Hello Dolfan,
    Thanks for your post.

    All of this is certainly possible.

    1. Can I copy and paste to start, changing the name of the ConstantLines Indicator? If not, how do I start a fresh and new indicator? (I suppose there is some tutorial out there but I have yet to locate it)
    You can start a new indicator by clicking the "+" tab at the bottom of the NinjaScript Editor window. Additionally, you could right-click inside the 'Constant Lines' script and click "Save-As" to use that indicator as the basis for another custom project.
    2. My indicator has 7 lines and the ConstantLines Indicator only has 4 lines. Can I add the other 3 lines?
    Yes you can do this. Are you having trouble getting the other 3 lines to draw on your chart?
    3. The location of the lines is placed by opening the ConstantLines Indicator and entering the numerical value for placement. My indicator places lines daily based on a mathematical formula which changes daily. Can I change the ConstantLines Indicator to using formulas instead of requiring daily input?
    Yes you can do this. You would change the y value you are using for your line from an input variable to your formula.
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      Josh, please review this pic. https://www.screencast.com/t/YxBnGGXuno9N

      I have added lines above as I (ass)umed I should, then compiled thinking it would complete the indicator. I do not see the lines listed in the 'region properties' area below. Must I also edit that area? Is there a particular region where I should or should not edit?

      Dolfan

      Comment


        #4
        Yes, you will need to add a public property for each of those values listed in the error column. (ie. Line5Value, Line6Value, Line7Value)

        I suggest creating a new indicator with those inputs and then copying pasting the property for each input into your own script. Assuming those values are the y-value of the line you would need a public property similar to the following for each line in order to compile.

        Code:
        [NinjaScriptProperty]
        [Range(0, double.MaxValue)]
        [Display(Name="Line5Value", Order=1, GroupName="Parameters")]
        public double Line5Value
        { get; set; }
        Last edited by NinjaTrader_JoshG; 05-08-2018, 07:20 AM.
        Josh G.NinjaTrader Customer Service

        Comment


          #5
          Josh, another pic. https://www.screencast.com/t/bESmp4b9BbDy

          I have only 1 error left, on 3 lines. I have duplicated all of the syntax and changed the designations to match lines 5, 6 & 7. I have done this throughout the file and yet, C0177 indicates the data source is missing. What am I missing?

          I realize that I may have a complete rewrite when I want to change to a mathematical formula as the data source and I am fine with that. Since I have yet to successfully complete an indicator in N8, I want to get what I think is something simple done first. I am fine with inputting the data daily on the chart at this time. Am I clear on what I am asking? When you are not sure of what you are looking for, the question may not be clear :-}

          Dolfan

          Comment


            #6
            I am not certain what you are asking. However, you can resolve the error from your screenshot by replacing the "NinjaTrader.Custom.Resource.ConstantLines4" with a simple string name for that plot (like "ConstantLines4") instead. You would want to make that fix to all three lines (59,60,61).

            Help Guide - AddPlot()
            Josh G.NinjaTrader Customer Service

            Comment


              #7
              Not understanding at all why I would have to replace "NinjaTrader.Custom.Resource.ConstantLines4" because that is the code already in the ConstantLines Indicator.

              Rather than get bogged further in this discussion, let's go back to square one.

              I simply want the ConstantLines Indicator to display 7 lines instead of 4. I will input the data on the chart as is currently done with the indicator. How do I accomplish this?

              Dolfan

              Comment


                #8
                Sorry, got a number wrong. Use "ConstantLines5", ConstantLines6", ConstantLines7" instead
                Josh G.NinjaTrader Customer Service

                Comment


                  #9
                  Going to send an email to platform support, attn: Josh, with all of the syntax.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by geddyisodin, Today, 05:20 AM
                  3 responses
                  20 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Started by lorem, Today, 09:18 AM
                  1 response
                  4 views
                  0 likes
                  Last Post lorem
                  by lorem
                   
                  Started by bmartz, Today, 09:30 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post bmartz
                  by bmartz
                   
                  Started by GussJ, 03-04-2020, 03:11 PM
                  14 responses
                  3,245 views
                  0 likes
                  Last Post GussJ
                  by GussJ
                   
                  Started by ArkansasClint, Today, 09:28 AM
                  0 responses
                  0 views
                  0 likes
                  Last Post ArkansasClint  
                  Working...
                  X