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

Help with NT Strategy builder

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

    Help with NT Strategy builder

    Hello,
    If I create a strategy for example, one that places a trade when on MA is above of the other, the problem is that, once it reaches the target, is continues to place orders as long as the MA is above. Is it there a way, in the strategy builder to limit this to a certain number of trades? I do not want a cross over, would be one MA on top of another. Thanks!

    #2
    Hi mestril, thanks for your note.

    You can use the MarketPosition object under the Strategy folder and only perform the action when flat.

    e.g.: https://clauber.tinytake.com/tt/Mzk0NjMwNV8xMjEwOTQ2Nw
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChrisL View Post
      Hi mestril, thanks for your note.

      You can use the MarketPosition object under the Strategy folder and only perform the action when flat.

      e.g.: https://clauber.tinytake.com/tt/Mzk0NjMwNV8xMjEwOTQ2Nw
      This does not work, unless I am not doing it right.

      Comment


        #4
        Hi mestril, thanks for your reply.

        If your EntriesPerDirection is set to 1 then you should not get any further entries if you are already long. I can test your script if you export it and post it (Tools>Export>NinjaScript)
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_ChrisL View Post
          Hi mestril, thanks for your reply.

          If your EntriesPerDirection is set to 1 then you should not get any further entries if you are already long. I can test your script if you export it and post it (Tools>Export>NinjaScript)
          How do I get to the EntriesPerDirection option in strategy builder. I do not see it in the Conditions.

          Comment


            #6
            Hi mestril,

            Sorry, that is a setting from the strategy menu. You will see it when you open up the strategy on your chart/control center.
            Chris L.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_ChrisL View Post
              Hi mestril,

              Sorry, that is a setting from the strategy menu. You will see it when you open up the strategy on your chart/control center.
              It is set to 1, but still places more than one. I will post the script.

              Comment


                #8
                Originally posted by mestril View Post

                It is set to 1, but still places more than one. I will post the script.
                Here is the script. Let me know.
                Thanks

                Attached Files

                Comment


                  #9
                  Hi mestril, thanks for posting that. I'm not getting the same problem, the script submits only 1 order at a time. Please confirm you have the strategy set up in the same way I do:

                  Chris L.NinjaTrader Customer Service

                  Comment


                    #10
                    Originally posted by NinjaTrader_ChrisL View Post
                    Hi mestril, thanks for posting that. I'm not getting the same problem, the script submits only 1 order at a time. Please confirm you have the strategy set up in the same way I do:

                    https://clauber.tinytake.com/tt/Mzk0NjczMl8xMjExMDU4MQ
                    Hello,
                    I do have it the same way, however I think we are not talking about the same issue. The strategy places one order at a time, yes, however, once that position is closed, and a new candle opens, it will place another one and then another. I want the strategy to place just one order per signal and not every time a candle opens. Does that make sense? Thanks a lot!
                    Attached Files

                    Comment


                      #11
                      Hi mestril, thank you I understand now.

                      The builder has a bars since entry and bars since exit in the Misc folder. You can limit when the next trade takes place using these properties.
                      Chris L.NinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by NinjaTrader_ChrisL View Post
                        Hi mestril, thank you I understand now.

                        The builder has a bars since entry and bars since exit in the Misc folder. You can limit when the next trade takes place using these properties.
                        How does this help?
                        I need one trade per signal, now, it is placing a trade once is closed, and placing another one, resulting on several trades per signal. My question is, is it there anything I can do to make this happen? just one trade per signal!
                        Thanks

                        Comment


                          #13
                          Hello mestril,

                          Thanks for your reply.

                          You could create a single bool variable that you use to control the trades to one per direction. For example in your entry conditions for a long set you would check to see if the bool is true and in the short entry you would check to see if it is false. In the action of the long set, besides placing the order you would change the bool to false which means no more long trade. Once false, if your other short entry conditions occurs the short order would be placed and you would then set the bool to true.

                          Written out it would look something like (I called the bool FlipFlop):

                          if (your long conditions are true and FlipFlop equals True)
                          {
                          place long order here
                          set FlipFlop equal to False // prevent further longs until a short has been taken
                          }

                          if (your short conditions are true and FlipFlop equals False)
                          {
                          place short order here
                          set FlipFlop equal to True // prevent further shorts until a long has been taken
                          }
                          Paul H.NinjaTrader Customer Service

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by frankthearm, Yesterday, 09:08 AM
                          13 responses
                          45 views
                          0 likes
                          Last Post frankthearm  
                          Started by PaulMohn, Today, 12:36 PM
                          2 responses
                          16 views
                          0 likes
                          Last Post PaulMohn  
                          Started by Conceptzx, 10-11-2022, 06:38 AM
                          2 responses
                          53 views
                          0 likes
                          Last Post PhillT
                          by PhillT
                           
                          Started by Kaledus, Today, 01:29 PM
                          1 response
                          4 views
                          0 likes
                          Last Post NinjaTrader_Jesse  
                          Started by yertle, Yesterday, 08:38 AM
                          8 responses
                          37 views
                          0 likes
                          Last Post ryjoga
                          by ryjoga
                           
                          Working...
                          X