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

Double Bottom Strategy

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

    Double Bottom Strategy

    Hello everyone,
    unfortunately, I can't create a working strategy with detecting a double bottom at the Low of the Session and make an entry at the second bottom (please see the attached screenshot).

    You can see my conditions also in the attached files, at the first condition I say, he has to detect an entry and save this to a variable.
    When this entry happens in a little different way again, he should read out this variable with other indicators and make his entry.

    But he already fails at the first condition and doesn't for example draw a line at this point. He makes trades, but not with my correct conditions.

    How do I program such a double bottom correct?

    Thank you very much for your help,
    Andreas
    Attached Files

    #2
    Hello Andreas,

    What are the specific rules, written out first, you are trying to implement.

    What consists of a 'double bottom'? (Answering this will help to form that into logic we can put in a script)
    Is this when the current (Close) price falls below the Bollinger lower plot, rise above the Bollinger lower plot, and then falls below the Bollinger lower plot a second time?

    When you mention: "Low of the Session" are you meaning each time the current (Close) price is less than the lowest close price previously reached?
    (for this a variable would be saved holding the most recent lowest close. If the close is less than this variable it's a new low of the day)
    Last edited by NinjaTrader_ChelseaB; 05-31-2021, 11:33 AM.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello Chelsea,
      thanks for your fast reply.
      "Is this when the current (Close) price falls below the Bollinger lower plot, rise above the Bollinger lower plot, and then falls below the Bollinger lower plot a second time?"
      - The first swing low pushed beyond the Bollinger bands. And after that, the market made a lower low, but could not push beyond the Bollinger Bands - forming a W-Bottom for a Long

      "When you mention: "Low of the Session" are you meaning each time the current (Close) price is less than the lowest close price previously reached?
      (for this a variable would be saved holding the most recent lowest close. If the close is less than this variable it's a new low of the day?"
      - Yes, that's right and a good idea.

      Thank you very much!
      Andreas

      Comment


        #4
        Hello Andreas,

        When you mention "The first swing low" are you referring to the Swing() indicator?
        https://ninjatrader.com/support/help.../nt8/swing.htm

        Or are you referring to when the Close price is less than the bollinger lower plot?

        When you mention "pushed beyond the Bollinger bands" what specifically do you mean?
        Do you mean the Close is less than the bollinger lower or the close is greater than the bollinger upper?

        "the market made a lower low, but could not push beyond the Bollinger Bands"

        The current Close is less than the previously recorded low variable and the Close is above the bollinger lower plot?
        Last edited by NinjaTrader_ChelseaB; 05-31-2021, 11:28 AM.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Oh sorry, no, it only describes the first move of the price, I'm not referring to an indicator, you described it correctly: "Or are you referring to when the Close price is less than the bollinger lower plot?"

          I made another attachment to clarify that for you.
          Attached Files

          Comment


            #6
            Hello Andreas,

            Create a double variable to hold the most recent lowest close (i'll name currentLow).

            In a condition set use 'If Any' at the top left.
            Add a condition Misc > CurrentBar on the left, equals in the center, Misc -> numeric value on the right set to 0
            Add another condition > First bar of session on the left, equals in the center, Misc -> True on the right.
            When true, set currentLow to Price > Close.

            Create a bool variable (i'll name firstActionTriggered in this text but you can name whatever you want) to know when the first action has occurred.

            In first trigger condition set require this firstActionTriggered variable to be false.
            Add a condition with Price > Close on the left, less than in the center (or crossbelow), and Indicator -> Bollinger on the right with the Value plot drop down set to Lower.
            When true set the firstActionTriggered variable to true to know the first action has taken place.

            In the second trigger condition set require the firstActionTriggered variable to the true.
            Add a condition with Price > Close on the left, less than in the center, User variables -> currentLow on the right.
            Add a condition with Price > Close on the left, greater than in the center, Indicators -> Bollinger on the right with the Value plot drop down set to Lower.
            When true, submit the order.
            Also set firstActionTriggered to false to allow for a new entry.

            In another condition set use 'if all'. (Actually this doesn't matter as it will only have one condition, but this set needs to come after where this value is checked to be sure we have the previous value).
            Add a condition Price > Close on the left, less than in the center, User variables -> currentLow on the right.
            When true, set currentLow to Price -> Close.


            An example of using bools to require a sequence of condition sets to be true.
            https://ninjatrader.com/support/foru...72#post1131172
            Last edited by NinjaTrader_ChelseaB; 05-31-2021, 01:03 PM.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Wow, thank you for the effort! I will try this, have a good evening!
              Andreas

              Comment


                #8
                Sorry for annoying you, perhaps I didn't set the Long Order in the correct set, do I have to do 4 different sets? Please see my attached screenshots, thank you!
                Attached Files

                Comment


                  #9
                  Hello Andreas,

                  I had to make a correction. In set one, the CurrentLow should be set to Price > Close as the action, not 0.

                  Also, in set 4, when the order is submitted, the FirstActionTriggered bool should be set back to false to allow for a new entry.


                  Debugging would be the next step to ensure everything is as you expect.


                  First, try adding a dot to condition set 2 and use CurrentBar in the tag name.
                  Are you seeing the dots appear when the close is less than the bollinger lower?
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    Sorry Chelsea, now it works and he makes (not bad) trades, but he does not make the trades at the double bottom entry points and he is not drawing the dot or something else

                    Comment


                      #11
                      Hello andi5385,

                      May I confirm that CurrentBar is used in the tag name for the drawing object?

                      At what price (y value) are you drawing the dot?
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        Hello Chelsea,
                        to clarify that, I attached the screenshot from the set to you.

                        By the way, I "simply" want to build a retest strategy, so the Bollinger Bands and High and Lows of the later session are good entry points for this, I think. Or do you prefer another tactic? I think the construct you told me you works well.

                        Thank you!
                        Andreas
                        Attached Files
                        Last edited by andi5385; 06-01-2021, 10:48 AM.

                        Comment


                          #13
                          Hello Andreas,

                          What is Time in this condition set?

                          Is this condition evaluating as true?

                          If this is removed, does the dot draw on the first occurrence where the close is less than the bollinger lower plot?

                          May we have a screenshot of the chart showing the first occurrence?
                          Chelsea B.NinjaTrader Customer Service

                          Comment


                            #14
                            Hello Chelsea,
                            thanks for the fast response. It's a TimeFilter in it, but this was only a test (only execute when 16-22 o'clock). I will remove it again.
                            I don't know if the condition is evaluating as true, sorry...what do you mean exactly?
                            No, there isn't a dot visible and I simply attach the strategy in this thread, perhapts I missed a main thing in this case (For example, I always use "Order Fill resolution" to "High" and 1 Minute for the best backtest).

                            I really appreciate your help, thank you!
                            Andreas

                            Attached Files

                            Comment


                              #15
                              Hello Andreas,

                              I'm seeing the reset of FirstActionTriggered back to false is in set 4 and not in set 3 when the order is being submitted.

                              But testing what you have, I am able to see a dot being drawn. And I see many dots in the Drawing Objects window.


                              Try adding another dot with a different color in the second trigger condition set where the enterlong is called and the firstActionTriggered bool is set to false.
                              Attached Files
                              Chelsea B.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Brevo, Today, 01:45 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post Brevo
                              by Brevo
                               
                              Started by aussugardefender, Today, 01:07 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post aussugardefender  
                              Started by pvincent, 06-23-2022, 12:53 PM
                              14 responses
                              239 views
                              0 likes
                              Last Post Nyman
                              by Nyman
                               
                              Started by TraderG23, 12-08-2023, 07:56 AM
                              9 responses
                              384 views
                              1 like
                              Last Post Gavini
                              by Gavini
                               
                              Started by oviejo, Today, 12:28 AM
                              0 responses
                              6 views
                              0 likes
                              Last Post oviejo
                              by oviejo
                               
                              Working...
                              X