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

Second Entry

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

    Second Entry

    Hi!
    pls see attached screenshot.

    after the first entry and exit, a second entry appears.
    why is this happening? and how can i avoid it before the condition is fullfilled next time?

    one of the entry conditions is: Close [0] cross above Swing [0] (using swing high and a set value)
    the exit is based on: Close [0] is smaller than swing [0] (using low and set value)

    thank you


    #2
    Hello Tradexxx,

    Thanks for your post.

    If a strategy is taking additional orders then this would mean the logic is allowing the order methods to be reached again. We suggest adding prints so you can see:

    1) If a print next to your order method is appearing twice (indicates your logic is allowing this method to be reached again)
    2) If the print above is seen, add prints outside of your conditions to see what the values are that are evaluating your conditions so you can better understand why the logic is becoming true, so you can better understand how you should change it.

    A common practice to ensure your logic is only fired once would be to use a bool that you set to true when the conditions become true for you to allow an action. You would then to set that bool to false once that action is taken. The action then will not be taken again until the bool is set back to true. Boolean variables can be added in the Inputs and Variables section of the Strategy Builder.

    Debugging Tips - https://ninjatrader.com/support/help...script_cod.htm

    Debugging in the Strategy Builder - https://www.screencast.com/t/8uvjfM8h

    Please let us know if we can be of further assistance.
    JimNinjaTrader Customer Service

    Comment


      #3
      Hi!
      Pls see attached screenshot,
      condition a = low crossbelow swing low
      condition b = EMA 1<EMA2

      Output window shows the correct level for swing low
      first circle: as condition b isn't fullfilled no entry appears = ok
      than (second circle) condition 2 is fullfilled

      but:
      the entry appears 5 candles later --> why?
      and:
      i just want condition a to be true for the first candle after the cross appeard
      (i have set condition a to "1" bars ago for low and sing low)
      what am i doing wrong?

      thank you!

      Comment


        #4
        Hello Tradexxx,

        We see a Sell Short order occur at a certain point. If you are calling EnterShort() in your strategy, this would mean that your logic has allowed this method to be reached which would submit your order.

        It will be necessary to reproduce this and use debugging prints to determine why this had occurred. Visual cues can be helpful, but should not be relied on since what is processing in the strategy logic will be what determines how the strategy will fire orders.

        I suggest setting this up so you can reproduce this in the Playback Connection, and I would suggest adding prints outside of the conditions that fire EnterShort() and print out what you are using to evaluate your conditions so you can observe why that order method was reached.

        Playback Connection - https://ninjatrader.com/support/help...connection.htm

        If you have questions about setting up prints so you can observe what the logic is doing, please include a screenshot of the prints you have set up and the output you are receiving.

        I look forward to being of any further assistance.
        JimNinjaTrader Customer Service

        Comment


          #5
          Hi Jim,

          thank you for the information.
          I followed your former info and used a bool condition.
          the swing low was set correctly to "swing low true" when the low crossed the swing low
          followed by a set to "swing low canceled".
          ... so far, so fine...

          but later on the "swing low true" appears again (red arrow), even the condition wasn't fullfilled (from my point of view)
          is there a way to tell the system my point of view??
          or is the "swing low canceled" condition wrong (screenshot attached)

          thank you very much!​​​​​

          Comment


            #6
            Hello Tradexxx,

            The information provided does not tell us why the order fired. You will need to add prints in a new Condition/Action set without any conditions controlling those prints, and you will want to print out the values that are used to evaluate the condition which fires the order method.

            There is not a way to tell the system to think in a different way. Creating the strategy will require understanding the logic written and why it is allowing certain actions to occur.

            Please attach a screenshot of the Condition/Action Set where you call your order method, and please also attach a screenshot of your prints set up in a separate Condition/Action Set that print out what you use in the order method's condition. Finally, please also include the output window of these prints. This will tell you why that order method was allowed to be reached, and why it fired.

            I look forward to being of further assistance.
            JimNinjaTrader Customer Service

            Comment


              #7
              Hi Jim,

              thank you for the information.
              i have overworked it again.
              Attached you'll find the screenshots and also the strategy.
              (as i try to learn and understand how this is working)

              Wrap Up:
              As long as i run the cross below condition, the entries are like expected.
              When i add the second condition (EMA) the entries appear even the swing low condition (from set 1) is set to false.
              the intention is: both conditions ( set1 + set3) have to be fullfilled at the same time.

              my understanding of the output window is: the first condition is set to false - but nevertheless a entry is triggered, or am i wrong?
              furthermore i'm not sure how to display the entry in output window in the right way

              i'm running this on range value10 bars.
              the situation decribed above can be found at 07/04/2019.
              (printing the low values for low [0] and swing low [0] is showing the correct prices.

              thank you


              Click image for larger version  Name:	s1.jpg Views:	1 Size:	67.3 KB ID:	1063583Click image for larger version  Name:	s2.jpg Views:	1 Size:	67.8 KB ID:	1063584Click image for larger version  Name:	s3.jpg Views:	1 Size:	89.4 KB ID:	1063585
              Last edited by Tradexxx; 07-10-2019, 06:31 AM.

              Comment


                #8
                Hello Tradexxx,

                As the entry condition is controlled by your SwingLow bool which must be true, and that EMA(18) must be less or equal to EMA(42), we know that these conditions have allowed your order entry logic to be reached and submit that order.

                Both of the following has occurred in addition to EMA(18) being less than or equal to EMA(42).

                Condition Set 1 became true and set your bool to true.
                Condition Set 2 did not become true and your bool was not set back to false.

                I suggest looking into Condition Sets 1 and 2 so you can ensure that these condition sets only become true when you expect them to be true.

                To study Condition Set 1 further, you will need to add prints for Low[0], Low[1], Swing(5).SwingLow[0], and Swing(5).SwingLow[1]. This print will need to be in a separate condition set without any condition logic protecting it so the print will appear for every bar and tell you why that condition becomes true.

                To study Condition Set 2 further, you will need to print out the components used to evaluate that condition in a similar fashion as the above to see: what the value of Low[0] is, and what the value of Swing(5).SwingLow[1] is. This would tell you why this condition has not become true when you were expecting it to be true.

                The bottom line here is that whatever was controlling Condition Set 3 became true, so you will need to analyze your logic to understand why that condition became true.

                If you have any additional NinjaTrader related inquiries, please do not hesitate to open a new ticket.
                JimNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by pibrew, Today, 06:37 AM
                0 responses
                4 views
                0 likes
                Last Post pibrew
                by pibrew
                 
                Started by rbeckmann05, Yesterday, 06:48 PM
                1 response
                14 views
                0 likes
                Last Post bltdavid  
                Started by llanqui, Today, 03:53 AM
                0 responses
                6 views
                0 likes
                Last Post llanqui
                by llanqui
                 
                Started by burtoninlondon, Today, 12:38 AM
                0 responses
                12 views
                0 likes
                Last Post burtoninlondon  
                Started by AaronKoRn, Yesterday, 09:49 PM
                0 responses
                16 views
                0 likes
                Last Post AaronKoRn  
                Working...
                X