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

need help in developing a strategy

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

    need help in developing a strategy

    Hello, I have been trying for several days to make a small strategy with the strategy generator and it is a complete failure can you help me? here's what you'd like to achieve. I specify that I am a beginner from beginner lol

    when it turns from red to green, it enters Long and enters short for opposite. When it switches direction, it will exit the existing position, if any

    thank's

    #2
    Hello 270027,

    Thank you for your post.

    To clarify, when what turns from red to green? The bars on the chart? A specific indicator? Could you provide screenshots of what you've already tried that isn't working for you?

    Thanks in advance; I look forward to assisting you further.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Kate View Post
      Hello 270027,

      Thank you for your post.

      To clarify, when what turns from red to green? The bars on the chart? A specific indicator? Could you provide screenshots of what you've already tried that isn't working for you?

      Thanks in advance; I look forward to assisting you further.
      yes candles that go from red to green. No indicator., I looked at the help on the site and despite the logic I can not find the right information that can help me build it

      Comment


        #4
        Hello 270027,

        Thank you for your reply.

        A green candle is simply one where the Close price is greater than the Open price and a red candle is one where the Open price is greater than the Close price. So to see if the candle previous was red and the current one is green, you'd want to check whether the Close with a bars ago of 1 was less than the Open price with a bars ago of 1, and also check whether the Close with a bars ago of 0 (the current close price) is greater than the Open with a bars ago of 0, and submit an entry.

        I've created a very simple example strategy that when the position is flat, it checks which direction the current and previous bars were going and if the prior bar was red and the current bar is green, it enters long, and if the opposite enters short. Then when that reverses, it exits either long or short depending on the direction of the position.

        Please let us know if we may be of further assistance to you.
        Attached Files
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Kate View Post
          Hello 270027,

          Thank you for your reply.

          A green candle is simply one where the Close price is greater than the Open price and a red candle is one where the Open price is greater than the Close price. So to see if the candle previous was red and the current one is green, you'd want to check whether the Close with a bars ago of 1 was less than the Open price with a bars ago of 1, and also check whether the Close with a bars ago of 0 (the current close price) is greater than the Open with a bars ago of 0, and submit an entry.

          I've created a very simple example strategy that when the position is flat, it checks which direction the current and previous bars were going and if the prior bar was red and the current bar is green, it enters long, and if the opposite enters short. Then when that reverses, it exits either long or short depending on the direction of the position.

          Please let us know if we may be of further assistance to you.
          hello and thank you for your responsiveness. I will try to put a tp and a sl . For the moment I put it in test in simulation mode and I also reverse so I compare the two graphs. I understood what you did and it's a lot

          Comment


            #6
            is this strategy valid for renko for example or is another way of doing it?

            Comment


              #7
              Hello 270027,

              Thank you for your note.

              Yes, this strategy would work on a Renko chart. I would note that strategies provided by our support team are for example purposes only and are meant to be jumping off places for you to design your own logic and are not intended for live trading.

              Please let us know if we may be of further assistance to you.
              Kate W.NinjaTrader Customer Service

              Comment


                #8
                hello, I managed to put a tp and sl worked but for the sl it is a little more difficult and I do not understand because it gives me error message: can I be given a corrective line, see attached file
                Attached Files
                Last edited by 270027; 11-19-2021, 04:08 AM.

                Comment


                  #9
                  Hello 270027,

                  Thank you for your reply.

                  Unfortunately you've exported the strategy as a compiled assembly, which means the source code is not accessible and I cannot review your logic in the Strategy Builder. Please try exporting the file again without checking the Export as a Compiled Assembly box, which will allow the source to be exported.

                  Thanks in advance; I look forward to assisting you further.
                  Kate W.NinjaTrader Customer Service

                  Comment


                    #10
                    voici
                    Merci
                    Attached Files

                    Comment


                      #11
                      Hello 270027,

                      Thank you for your reply.

                      You cannot use a negative number of ticks for SetStopLoss - using ticks will automatically set the stop loss the number of ticks specified from the entry price on the correct side of the market when an entry is made so you just need a positive number there. You also don't need separate stop losses for long and short orders unless you want to use different numbers of ticks.

                      So, you can just set up a single stop loss like this:

                      Click image for larger version

Name:	2021-11-19_11-12-54.png
Views:	48
Size:	28.1 KB
ID:	1179085

                      This will be triggered for both the long and short entries.

                      Please let us know if we may be of further assistance to you.
                      Kate W.NinjaTrader Customer Service

                      Comment


                        #12
                        hello, I was able to create the sl and the tp and also the variables: how do you make the variables appear in the settings menu.thank you

                        Comment


                          #13
                          Hello 270027,

                          Thank you for your reply.

                          Inputs on the Inputs and Variables screen are simply variables that are editable by the user in the settings. Variables would be internal to the strategy and not shown on the settings:

                          Click image for larger version

Name:	2021-11-22_07-09-55.png
Views:	35
Size:	61.9 KB
ID:	1179247

                          Please let us know if we may be of further assistance to you.
                          Kate W.NinjaTrader Customer Service

                          Comment


                            #14
                            Originally posted by NinjaTrader_Kate View Post
                            Hello 270027,

                            Thank you for your reply.

                            Inputs on the Inputs and Variables screen are simply variables that are editable by the user in the settings. Variables would be internal to the strategy and not shown on the settings:

                            Click image for larger version

Name:	2021-11-22_07-09-55.png
Views:	35
Size:	61.9 KB
ID:	1179247

                            Please let us know if we may be of further assistance to you.
                            Hello, I had difficulty formulating my question: what you are showing me in the image I understood it but I want these parameters to appear in the general menu of the strategy which allows me to modify values without going through the strategy generator thank you Ala

                            Comment


                              #15
                              Hello 270027,

                              Thank you for your reply.

                              Variables you create in the top section of the Inputs and Variables screen under the Inputs section would show editable values in the Strategy Properties. Inputs are simply variables that the user can input values for when the strategy is added to the chart.

                              Please let us know if we may be of further assistance to you.
                              Kate W.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by johnMoss, Today, 10:12 AM
                              1 response
                              18 views
                              0 likes
                              Last Post NinjaTrader_Kate  
                              Started by thaison316, 03-29-2021, 03:12 PM
                              4 responses
                              52 views
                              0 likes
                              Last Post NinjaTrader_Kate  
                              Started by WHICKED, Today, 09:51 AM
                              1 response
                              20 views
                              0 likes
                              Last Post NinjaTrader_Kate  
                              Started by simple_goodoboy, Today, 09:15 AM
                              1 response
                              21 views
                              0 likes
                              Last Post NinjaTrader_Kate  
                              Started by debleded, Today, 09:10 AM
                              1 response
                              25 views
                              0 likes
                              Last Post NinjaTrader_Kate  
                              Working...
                              X