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

What Could We Try Adding To This Code To Allow This

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

    What Could We Try Adding To This Code To Allow This

    Hi folks,

    What could we try adding to this code so that there is a selectable option in the indicator for when the line is green (movingup) and when the line is red (movingdown)?

    This way we could use it, for example, as part of a strategy or filter is the reason.

    Right now, I do not see an option to tell if it is going up or down in the options.



    See attached.
    Attached Files

    #2
    Hello birdog,

    "so that there is a selectable option in the indicator for when the line is green (movingup)"

    I'm not clear on what you are asking.

    Are you asking for selecting the color to be used for moving up?

    Are you asking for an option for enabling disabling an alert when the line is green?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      NinjaTrader_ChelseaB Thanks for asking here. Here is what the indicator looks like https://www.screencast.com/t/in3YNn3X (it is green when going up and red when going down). When adding it to a strategy there is no dropdown option to detect if it is green for going up or red if going down. See https://www.screencast.com/t/nEvOPvBP I am hoping to be able to get it to show a dropdown for so I can have it be used in a strategy. Like, if WSMA is green (i.e. going up) then .... etc. Or, if WSMS is red (i.e. going down) then... etc. Does that help? Again, thanks so much in advance! Greg

      Comment


        #4
        Hello birdog,

        I still am not quite sure what you are asking..

        there is no dropdown option to detect if it is green
        A drop-down lets you select a value. How would this be used to detect something?

        Are you saying you want to set a value, and then check the value in a condition in the code, and then in that condition action block check to see if the indicator is rising or falling.

        Like, a checkbox for turning on and off some logic block in the code of OnBarUpdate()?

        A drop-down does not detect things, so I am not understanding what you are trying to do.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          NinjaTrader_ChelseaB On this, "Are you saying you want to set a value, and then check the value in a condition in the code, and then in that condition action block check to see if the indicator is rising or falling." Yea...exactly...so I might use it as a condition in the strategy builder.

          Comment


            #6
            You could add a Bool Series, set to true when moving up or false when moving down. Or an Int Series, 1 == up, -1 = down, 0 = flat. Make sure they are exposed for a strategy to see.
            eDanny
            NinjaTrader Ecosystem Vendor - Integrity Traders

            Comment


              #7
              eDanny Thanks for the input. Do you mean adding a Int Series in the indicator or the Strategy Builder? Can you shoot me an example indicator or Strategy Builder settings on the attached? Or, just screenshots of settings would be fine to try. However, is easiest for you. See attached.
              Attached Files

              Comment


                #8
                NinjaTrader_ChelseaB If you could see my other comments after you last one and my comms with eDanny, perhaps, if you would, chime in a bit more too perhaps?

                Comment


                  #9
                  Hello birdog,

                  You can add a public bool NinjaScript property and then require the bool to be true in the condition.

                  [NinjaScriptProperty]
                  public bool EnableCodeBlock
                  { get; set; }

                  if (EnableCodeBlock == true)
                  {
                  if (Close[0] > Open[0])
                  {
                  // this code runs if EnableCodeBlock is enabled by the user and the other conditions also evaluate as true
                  }
                  }

                  You could also use an public enum for a drop-down and require the property to be equal to specific value.

                  Below is a link to an example.
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    NinjaTrader_ChelseaB Great...So, I can try adding this to the indicator code directly and then in the Strategy Builder, the options should be there to select? Or, are you meaning in the Strategy itself? If in the Strategy itself, would you mind to post screenshots of what I should input in a strategy in the Strategy Builder to allow the options to be used? Thanks a bunch! Greg

                    Comment


                      #11
                      Hello birdog,

                      You can code in an indicator directly. You can also use the Indicator wizard from the NinjaScript Editor to add public inputs (properties).

                      In the Strategy Builder this would be added in the Inputs and Variables page.

                      Please watch the 'Automate Your Trading with NinjaTrader's Strategy Builder' training video which shows adding inputs on the Inputs and Variables page.
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        NinjaTrader_ChelseaB Hmm...can not seem to get it to compile with those two dropdown options. Could you add it as a example to this indicator attached?
                        Attached Files

                        Comment


                          #13
                          Hello birdog,

                          Unfortunately, due to our support policy I am not able to make modifications to a script at your request.

                          In the support department at NinjaTrader it is against our policy to create, debug, or modify, code or logic for our clients. Further, we do not provide C# programming education services or one on one educational support in our NinjaScript Support department. This is so that we can maintain a high level of service for all of our clients as well as our associates.

                          That said, through email or on the forum we are happy to answer any questions you may have about NinjaScript if you decide to code this yourself. We are also happy to assist with finding resources in our help guide as well as simple examples, and we are happy to assist with guiding you through the debugging process to assist you with understanding unexpected behavior.

                          You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like a list of affiliate consultants who would be happy to create this script or any others at your request or provide one on one educational services.​


                          If you have an error message you would like assistance with, provide the full error message and line of code causing the error and we are happy to assist.

                          That said, I have already provided a link to a reference sample in the help guide with an example drop-down enum input.

                          I am attaching here an example of a bool input added with the Strategy Builder.
                          Attached Files
                          Chelsea B.NinjaTrader Customer Service

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by BarzTrading, Today, 07:25 AM
                          2 responses
                          13 views
                          1 like
                          Last Post BarzTrading  
                          Started by devatechnologies, 04-14-2024, 02:58 PM
                          3 responses
                          19 views
                          0 likes
                          Last Post NinjaTrader_BrandonH  
                          Started by tkaboris, Today, 08:01 AM
                          0 responses
                          3 views
                          0 likes
                          Last Post tkaboris  
                          Started by EB Worx, 04-04-2023, 02:34 AM
                          7 responses
                          162 views
                          0 likes
                          Last Post VFI26
                          by VFI26
                           
                          Started by Mizzouman1, Today, 07:35 AM
                          1 response
                          9 views
                          0 likes
                          Last Post NinjaTrader_Gaby  
                          Working...
                          X