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

Strategy Builder

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

    #31
    Hello wisdomspoon,

    Thank you for your reply.

    Could you supply the current strategy so we may assess why it may be entering again on the same bar as an exit with those conditions applied? I'm guessing they aren't applied properly (for example, specifying an exit name would only block entry within one bar if the last exit was made by that specific exit. If it was something else, for example, you specified a name of a Stop Loss, and the exit is a profit target, a trade could still be taken on the same bar.

    When you say more than once but less than x number of times, that would be controlled by Entries Per Direction, and Entry Handling. If your entry handling is set to all entries, you can enter up to the entries per direction number of times in one direction at a time before returning to a flat state. If your entry handling is set to unique entries, you can enter up to the Entries Per Direction specified for each uniquely named entry (unique Signal Names). Whether or not this would require separate condition groups would depend on whether you want the additional entries to be based on different conditions or not.

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

    Comment


      #32
      Hi Kate,

      Thanks for the reply. I am attaching example and how I have the strat set up. https://www.dropbox.com/s/lkjrwo8be1...04-12.mkv?dl=0

      There is a Set 2 I'm keeping conditions in but just for the video.... there are no actions there, just conditions so there are no other exits besides the profit target. Did I set something up incorrectly?

      Thanks,

      Comment


        #33
        Hello wisdomspoon,

        Thank you for your reply.

        Yes, you've specified a signal name for the exit in Bars Since Exit. It's looking for an exit called "Rev". Your entry is called that, not your exit. Remove the signal name from the Bars Since Exit conditions, and you should see it not take a new trade in the same bar.

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

        Comment


          #34
          That worked! Thanks so much for all your help!

          Comment


            #35
            Click image for larger version

Name:	Error Message.png
Views:	179
Size:	107.4 KB
ID:	1192720 I tried to compile an EA on my trading computer and I get the following error messages, please see attached. This same strategy I had no problem compiling on my laptop. Basically it is listing every indicator on the platform and saying it doesn't recognize them even though I am not using them in the EA. Can someone please advise how to fix this? Thank you!

            Comment


              #36
              Hello gregorious13,

              Thank you for your note.

              This looks like an issue with your references. If you right click on the NinjaScript Editor and select References, can you supply a screenshot showing what's listed there? You may need to expand the References window a bit to be able to see the complete reference for each one in the list.

              Thanks in advance; I look forward to assisting you further.

              Kate W.NinjaTrader Customer Service

              Comment


                #37
                Please find attached the references screen.
                Attached Files

                Comment


                  #38
                  Hello gregorious13,

                  Thank you for your reply.

                  Your references look correct. I suspect you may have duplicate files in your NinjaTrader user folder that may be causing the issue. I think it would be fastest to fix if we do a remote support session so I can take a look and see if I can identify the issue. For that, we'll need you to write into us directly via email so we can get that set up.

                  Please send an email to scriptingsupport [at] ninjatrader [dot] com with 3180361 ATTN Kate W. in the subject line and a link to this thread in the body of the email. Also, please include:
                  • A phone number where you can be reached
                  • A time window where I can call you (please include a time zone). Our regular support hours are 8:30am to 6pm US Eastern, Monday through Friday
                  Thanks in advance; I look forward to assisting you further.
                  Kate W.NinjaTrader Customer Service

                  Comment


                    #39
                    Ok, I hope this is simple. I am trying to figure out the line of code in strategy builder if I want to enter a trade so may pips away from a moving average. For instance, if I want to take a sell when price is +50 pips above the EMA and a buy when price is -50 pips below the EMA, how would I code this? Thank you.

                    Comment


                      #40
                      Hello gregorious13,

                      Thank you for your reply.

                      Basically you'd want to compare the current close price to the EMA plus or minus 50 pips, for which you'd use the offset field in the indicator:

                      Click image for larger version

Name:	2022-04-26_11-49-58.png
Views:	82
Size:	76.0 KB
ID:	1198930

                      Click image for larger version

Name:	2022-04-26_11-51-59.png
Views:	88
Size:	75.8 KB
ID:	1198931

                      I'm attaching a simple example that illustrates, but you might want to try a different number of pips away from the EMA to trigger an order - I didn't see any orders taken on several instruments simply because the price never got that far from the EMA.

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

                      Comment


                        #41
                        Oh my, I think I am getting close on my strategy!!! I am not sure if I can do this in strategy builder, but I will throw it out there. I am working on a stop loss and I want two options. I want an X number of ticks stop loss OR exit if price reaches the signal candle open (0), whichever one triggers first. Can you advise how I would do this in strategy builder? Thank you for all your help111

                        Comment


                          #42
                          Hello gregorious13,

                          Thank you for your reply.

                          What you can do is to save the open price of the bar to a variable when an entry is triggered. Once you've got that, you can check if you're long or short, and depending on which way you're checking, check that the current close price is either less than or greater than that price. If it is, you can submit an appropriate Exit Long or Exit Short order to exit the position. You can then set up a Stop Loss on the stops and targets screen using a user input number of ticks.

                          I'm attaching a revised version of the previous example that illustrates.

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

                          Comment


                            #43
                            Hi Kate,

                            I am having some difficulty understanding the logic in the example you posted above. Can you advise on the three sets? Thank you.

                            Comment


                              #44
                              Hello gregorious13,

                              Thank you for your reply.

                              There should be 4 sets in the conditions and actions in the revised version. If you're not seeing 4, please try reimporting the example.

                              In sets 1 and 2, we simply check whether the current price is 50 ticks above or below the current EMA value. If so, we enter long or short depending on whether it's above or below. We also save the open price of the bar the entry is submitted on to a variable.

                              In sets 3 and 4, we check the direction of the current position (long or short), and we check whether the current price is less than or equal to the saved open price for a long or greater than the saved open price for a short. If this occurs, we submit an exit order for the position.

                              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 AaronKoRn, Today, 09:49 PM
                              0 responses
                              7 views
                              0 likes
                              Last Post AaronKoRn  
                              Started by carnitron, Today, 08:42 PM
                              0 responses
                              9 views
                              0 likes
                              Last Post carnitron  
                              Started by strategist007, Today, 07:51 PM
                              0 responses
                              10 views
                              0 likes
                              Last Post strategist007  
                              Started by StockTrader88, 03-06-2021, 08:58 AM
                              44 responses
                              3,980 views
                              3 likes
                              Last Post jhudas88  
                              Started by rbeckmann05, Today, 06:48 PM
                              0 responses
                              9 views
                              0 likes
                              Last Post rbeckmann05  
                              Working...
                              X