• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy backtest Bollinger band

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

    Strategy backtest Bollinger band

    Hi,

    How can I setup the rules in NT8 with the following logic.

    If Price touches the bottom bollinger band, then anytime after it crosses the midline and when the price crosses the midline it must be higher than the open of session.

    Could you make a small video showing me how to do this?

    Thanks

    #2
    Hello Bundi404,

    Thank you for your note.

    To write what you’re looking to do, you would want to set a bool when the price touched the lower Bollinger band.

    An example of setting a bool would be,

    Code:
    private bool isTrue=false;
    
    if(Close[0]>Close[1])
    isTrue=true;
    Then in a different set of conditions, you would check if that bool was true, as well as your other criteria.

    For example,

    Code:
    if(isTrue==true && Close[0] >CurrentDayOHL().CurrentOpen[0])
    The following links are to the helpguide covering the methods you mentioned,

    https://ninjatrader.com/support/help...nger_bands.htm
    https://ninjatrader.com/support/help...nt_day_ohl.htm

    Please let us know if you need further assistance.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Hi Alan,

      How can I set this up with Nt8 strategy builder without having to write my own code? A basis step by step would be very helpful.

      thanks

      Comment


        #4
        Hello kyamato,

        I put together some screen shots which demonstrate how to create a variable, AboveVar, which is initially set to false.

        When the price crosses below a 14 period SMA, the bool mentioned above is set to true. Set 1.

        Then in a new set of conditions and actions “Set 2”, you’ll see the if statement checking if AboveVar is true as well as if price is above the CurrentDay Open.

        You could use this as a framework for what you’re looking to do.

        A step by step instructions for how to build your specific logic would be out of the scope of our support, but you should be able to use the information here to write what you’re looking to do. If you’d like, I can have someone reach out with a list of third parties that would be interested in building this for you.

        Please let us know if you need further assistance.
        Attached Files
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          Hi,

          Thanks for that. However where in this code does it make a requirment that the price must touch the lower band of BB first?

          Comment


            #6
            Hello kyamato,

            In the support department at NinjaTrader we do not create, debug, or modify code for our clients. This is so that we can maintain a high level of service for all of our clients.

            You would swap out the if statement CrossBelow and instead write your if statement for the touch of the lower BB. When this touch happens you would set the bool to true.

            You can also contact a professional NinjaScript Consultants who would be eager to create or modify this script at your request or assist you with your script. Please let me know if you would like our business development follow up with you with a list of professional NinjaScript Consultants who would be happy to create this script or any others at your request.

            Please let us know if you need further assistance.
            Alan P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by AMATX, Today, 01:43 PM
            0 responses
            2 views
            0 likes
            Last Post AMATX
            by AMATX
             
            Started by razeus, Today, 12:00 PM
            1 response
            13 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by kitwit, Today, 09:47 AM
            5 responses
            21 views
            0 likes
            Last Post NinjaTrader_PaulH  
            Started by guidoisot, Today, 11:17 AM
            1 response
            11 views
            0 likes
            Last Post NinjaTrader_PatrickG  
            Started by razeus, Today, 10:11 AM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_Jim  
            Working...
            X