Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bar after bar strategy

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

    Bar after bar strategy

    Hi, I am New to this forum. I have been working through the NT Help but with little success. Watched the weekly Auto Trading webinars - but they only ever show the SMA crossover.
    My first task is to set up a strategy to get a bell to ring when I have a reversal and then get 2 range bars to complete in the same direction. Can anyone give me a pointer where to start

    #2
    Hello,

    Thanks for the forum post and welcome to the NinjaTrader support forums.

    Unfortunately I am unable to code this exactly for you hopwever I can answer any specific questions you have.

    Where are you at so far and I can help one step at a time if needed.

    How are you defining your reversal?

    Comment


      #3
      Hi Brett
      On a range(5) chart price is dropping (Red Bar) then turns when 2nd green bar completes a bell rings.
      I presume I use OnBarUpdate & Calculate on Bar Close, but I do not have any idea wgere to start after Tools New ninjaScript - Strategy?

      Comment


        #4
        Hello,

        What is the definition of a red bar? It is a close that is lower or equal to its open.

        Therefor you will want to setup your condition to check to see if the close is less then the open price.

        Finally you would want to check to see if the bar behind that was also a down bar. You do this by using the same statement added it instead of for the current bar set the BarsAgo property to 1. Once both these conditions are added it will be checking for 2 down bars.

        -Brett

        Comment


          #5
          Thanks Brett
          I will go and work with that information. Hopefully I will manage to work it out. ( i'm told it is all logical- but maybe that is where I fall down)

          Comment


            #6
            Hello,

            Yes you do have to be somewhat logical in your though process for strategy programming as that is how computers calculate data.

            Please let me know if you have any questions.

            -Brett

            Comment


              #7
              I have set up the following strategy on Range bars (see attached screen shot) - Set1 Green bar forms followed by Red bar. When New bar opens ( which has to be lower than 1st red bar) ring a bell. Set2 Reverse of this.
              However, some of the time the bell only rings on the formation of the 3rd Bar and sometimes it works the way that (i think) that I have set it up. What is causing my problem?
              I can't see where the attachment is gone - hopefully it is attached. If not I will do it again

              Comment


                #8
                Brett,
                I can't see where my attachment dissapeared.
                Set 1
                Close(2)>=Open(2)
                Close(1) < Open(1)
                Close(1) > Open(0)
                Do the following - Play Sound
                Set 2 Exact reverse of above.

                Comment


                  #9
                  Hello,

                  This condition should only trigger on the third bar that this is true on. That is what you reported it is doing, therefor what do you expect?

                  Again it will only run is ALL the following is true.

                  -Brett

                  Comment


                    #10
                    Brett Thank you for your help, but I am still in trouble.
                    Green bar forms followed by Red bar. When New(3rd) bar opens ( which has to be lower than 1st red bar) ring a bell and visa versa for the reverse. So when I have a string of consecutive red and green bars form the bell rings for each new bar - which is correct the way that I have set it up.
                    However, if I have a string of red bars followed by a green bar the bell should ring on the formation of the next bar, but it only rings on the formation of the following bar if the 2nd bar is also green (so on the formation of the 4th bar)

                    Comment


                      #11
                      Sorry, I dont exactly follow your description.

                      However you must think about it from a code perspective. Code will always do what you ask to do, and if you are getting a result you did not expect you would need to try to figure out why the code is giving you that.

                      You may find this information helpful in that regaurd:



                      If still unable to get started it my be that you need a NinjaScript consultant to you with you to help you code this.

                      You can contact one of our NinjaScript consultants to assist you with coding this or you can use our NinjaScript guide and forums to code this indicator yourself if you are a programmer.


                      NinjaScript Consultants:

                      Comment


                        #12
                        OK I will put in extra lines of code to be more definate. Thanks again for the help

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by michi08, 10-05-2018, 09:31 AM
                        2 responses
                        737 views
                        0 likes
                        Last Post Denver_Wayne  
                        Started by sightcareclickhere, Today, 01:55 PM
                        0 responses
                        1 view
                        0 likes
                        Last Post sightcareclickhere  
                        Started by Mindset, 05-06-2023, 09:03 PM
                        9 responses
                        258 views
                        0 likes
                        Last Post ender_wiggum  
                        Started by Mizzouman1, Today, 07:35 AM
                        4 responses
                        18 views
                        0 likes
                        Last Post Mizzouman1  
                        Started by philmg, Today, 01:17 PM
                        1 response
                        8 views
                        0 likes
                        Last Post NinjaTrader_ChristopherJ  
                        Working...
                        X