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 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 kyamato,

    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.
    Last edited by NinjaTrader_DrewO; 01-15-2020, 10:10 AM.
    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 DJ888, 04-16-2024, 06:09 PM
            6 responses
            18 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by Jon17, Today, 04:33 PM
            0 responses
            1 view
            0 likes
            Last Post Jon17
            by Jon17
             
            Started by Javierw.ok, Today, 04:12 PM
            0 responses
            6 views
            0 likes
            Last Post Javierw.ok  
            Started by timmbbo, Today, 08:59 AM
            2 responses
            10 views
            0 likes
            Last Post bltdavid  
            Started by alifarahani, Today, 09:40 AM
            6 responses
            41 views
            0 likes
            Last Post alifarahani  
            Working...
            X