Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strange trades at the beginning of the session...

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

    Strange trades at the beginning of the session...

    I'm having problems with a script I wrote using Bollinger Bands. I have found that quite often, it looks like almost random trades are executed at the beginnig of the session that make no sense on the chart. However, after about 30-40 minutes, trades are executed with no problem for the rest of the session.

    I suspect it may be something to do with "min bars required" (it is currently set at the default 20) but I can't quite work out the significance of this as there is already sufficient data from the previous session, and the chart which I have up seems to display the Bollinger Bands correctly...

    So what would I need to do to have my script execute orders consitent with the chart I'm viweing at the beginning of the session?

    Your guidance would be very much appreciated.

    Regards

    John
    Last edited by John833; 08-08-2008, 03:02 AM.

    #2
    Hello,

    Thank you for your note.

    I suggest going to: Tools>Options>Strategies tab>NinjaScript tab and checking Wait until flat.

    Here is a link that will assist in understanding why:
    DenNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Ben View Post
      Hello,

      Thank you for your note.

      I suggest going to: Tools>Options>Strategies tab>NinjaScript tab and checking Wait until flat.

      Here is a link that will assist in understanding why:
      http://www.ninjatrader-support.com/v...ead.php?t=4033

      Thanks Ben, your answer doesn't apply to my case.

      The session starts, and I am flat, and anywhere between 5 to 15 minutes, a trade is executed which does not correspond to the strategy.... my point is that after 30 - 40 minutes, executions are traded as per the strategy.

      I am flat when I start and the strategy reconises that I am flat. (I already have the, if historical, return, code in the script)

      Do you have any other suggestions?

      Regards

      John
      Last edited by John833; 08-08-2008, 06:41 AM.

      Comment


        #4
        Hello,


        If you are sure the strategy (not your account) is flat, then it sounds like you may need to debug something in the logic.

        You may have this link on debugging already:
        DenNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Ben View Post
          Hello,


          If you are sure the strategy (not your account) is flat, then it sounds like you may need to debug something in the logic.

          You may have this link on debugging already:
          http://www.ninjatrader-support.com/v...ead.php?t=3418

          the strategy and account are flat, and the logic is correct.

          If I start the strategy 40 mins into each session, I don't have this problem.

          Does "min bars required" have any consequence? Please read my first message.
          Last edited by John833; 08-08-2008, 07:07 AM.

          Comment


            #6
            Min bars only will delay the calling of OnBarUpdate. If there are trades taken that you feel are not correct then you will need to debug why this is the case.

            Add some Print() statements within your conditional blocks where orders are submitted to see where these unexpected orders are being generated. Once you know this, you can trace out more information to see why the conditions for submitting these orders are true.
            RayNinjaTrader Customer Service

            Comment


              #7
              Thanks Ray,

              Unfortunately that's probably beyond my programming skills.

              One observation I can make is that, the trades that are being made in the first 30mins or so, appear to be executed as if the indicator is calculated by the script at a different value than the chart displayed, however the longer the script runs the trades gradually become more in line with the chart, until 30-40mins when they are in line.

              Could there be any user defined inputs that might affect the script?

              (BTW currently min bars is set at default 20, if that was changed to 1, what effect would it have? Appologies, I really don't understand this parameter...)

              John

              Comment


                #8
                Just to reiterate, the script runs perfectly after around 30-40mins to the end of the session...

                hoping there's a quick fix for this....

                Comment


                  #9
                  Hello,


                  Unfortunately you will need to debug this. There is not quick fix.

                  Yes, the indicators on the chart can be different that the indicator values used in the strategy if you have manually added the indicator to the chart.
                  DenNinjaTrader Customer Service

                  Comment


                    #10
                    Thanks Ben

                    Can you explain what the parameter 'min bars' does then, and what impact it would have if I changed it from 20 to say 1?

                    Regards

                    John
                    Last edited by John833; 08-08-2008, 09:05 AM.

                    Comment


                      #11
                      Hello,


                      Are you referring to the backtesting "Min. bars required" field? If so this link provides details on these fields:




                      Min. bars required:
                      Sets the minimum number of bars required before the backtest will start processing
                      DenNinjaTrader Customer Service

                      Comment


                        #12
                        no not backtesting...

                        the min bars required parameter when you put on a live strategy, what effect does that have if I change it from say 20 to 1?

                        Comment


                          #13
                          It's the number of bars that are skipped before OnBarUpdate() is called.
                          RayNinjaTrader Customer Service

                          Comment


                            #14
                            Thanks Ray,

                            So what effect would I see if I change the default parameter from 20 to 1?

                            Apologies, but I would very much appreciate if you could explain this, you might have noticed that I have asked the same question 4 times now...
                            Last edited by John833; 08-08-2008, 10:22 AM.

                            Comment


                              #15
                              Hello,


                              It is unknown whether this will have any meaningful effect in terms of the issue you have been inquiring about. You will need to debug to know for sure. That is why we did not address it.

                              However, generally the strategy will not attempt to do anything until it reaches the Min. bar or greater. If you change it to 1 the strategy logic will be called on bar 1, if you increase the value the strategy logic will be called on the bar you designate.

                              Effectively you are putting more historical bars behind the strategy before it starts by increasing the setting.
                              DenNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by GLFX005, Today, 03:23 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post GLFX005
                              by GLFX005
                               
                              Started by XXtrader, Yesterday, 11:30 PM
                              2 responses
                              11 views
                              0 likes
                              Last Post XXtrader  
                              Started by Waxavi, Today, 02:10 AM
                              0 responses
                              6 views
                              0 likes
                              Last Post Waxavi
                              by Waxavi
                               
                              Started by TradeForge, Today, 02:09 AM
                              0 responses
                              11 views
                              0 likes
                              Last Post TradeForge  
                              Started by Waxavi, Today, 02:00 AM
                              0 responses
                              2 views
                              0 likes
                              Last Post Waxavi
                              by Waxavi
                               
                              Working...
                              X