Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Is this how you check the time is between 9:30 and 4 pm?

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

    Is this how you check the time is between 9:30 and 4 pm?

    Check this code.
    if (ToTime(Time[0]) >= 93000 && ToTime(Time[0]) <= 1600000)


    If we can agree that is properly checking the code for times between 9:30am and 4 pm, we can continue with the next part.

    #2
    If we agree there, then this should have executed on something today
    if (s1b==false
    && BarsSinceExit() != 0
    && (GetCurrentAsk()) * (1 + -0.0025) <= (Bollinger(Low, 1.5, 10).Lower[0]) * (1 + -0.055)
    && LinReg(Close,
    10)[0] >= (Bollinger(Low, 1.5, 10).Lower[0]) * (1 + -0.055)
    && StdError(Close,
    3).Middle[0] >= 0)
    {
    EnterLongLimit(DefaultQuantity, (Bollinger(Low,
    1.5, 10).Lower[0]) * (1 + -0.055), "S1");

    if (Position.MarketPosition != MarketPosition.Flat){s1b=true;}

    }

    Comment


      #3
      Now, about this message I got in the output window:
      10/10/2008 10:46:04 AM CancelAllOrders: BarsInProgress=0

      What does that mean?

      Comment


        #4
        No, 1600000 is not 4pm. 160000 is.

        Like I've mentioned in your other threads beauw, you cannot assume that massive block of code in post #2 would have executed on any of the instruments you are running your strategy on. You have to print values one by one, break down each step of your condition and until all of them are true at the exact same time then you can proceed. Please use the techniques I mentioned in this tip to print values and debug: http://www.ninjatrader-support.com/v...ead.php?t=3418

        You are also assuming it "should have" on "something". Unless you have a multi-instrument strategy your code will not execute on "something". It will only run against the single instrument the strategy is on.

        Unless in your TraceOrders output you get "Order cancelled" or "Ignored" then it is clear that your if-statement was never evaluated to true. If its not evaluated to true it means you will never send out an order. There is no two way about it. When true it will send out the order. When false it will not.

        The trace in your third post is should be what happens when you stop your strategy. It is expected behavior and has no influence on the way you program your strategy.
        Last edited by NinjaTrader_JoshP; 10-10-2008, 04:55 PM.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          It's on 100 NAZ100 symbols. These conditions were true today. 1 of 2 things is wrong. BarSinceExit!=0 is not ever true, OR, the time condition is not true, OR, the getcurrentask doesn't function properly when there are 100 symbols being checked. I can conclude if NT can't handle 100 symbols that the throughput cannot be handled by NT.

          Comment


            #6
            beauw,

            If you have not used Add() 100 times in the Initialize() method and created a multi-instrument strategy with 100 BarsInProgress contexts then you are not running against 100 instruments. From the code you posted I believe you are not doing this. Please see this article: http://www.ninjatrader-support.com/H...struments.html

            Unless you are saying you are running 100 instances of the strategy, each one with a different instrument from the NAZ100.

            If the later is the case then, again, you need to use Print() functions to evaluate your if-statements. I've been saying to print out the values of your BarsSinceExit(), print out a confirmation print inside your Time[] filter, print out the values of your GetCurrentAsk() and to debug it from there. Until you do this along with printing out values for all your other conditions you will never know if your conditions are true. We do not have the bandwidth to debug for you beauw. If you are unwilling to spend the time debugging please contact one of the 3rd party NinjaScript Consultants here: http://www.ninjatrader.com/webnew/pa...injaScript.htm

            I assure you NinjaTrader can handle processing 100 instruments. Many of our users do it on a daily basis and are able to trade at that volume.
            Last edited by NinjaTrader_JoshP; 10-10-2008, 06:54 PM.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              I don't think that helps. Are you telling me if I just go to NEW STRATEGY in the strategies tab and start 100 different charts at once that it won't do this? Are you saying this takes intialization first?

              Comment


                #8
                With all due respect, what we are saying is that you will need to debug your code and strip it down to see what is happening or not happening. We can't be of anymore help at this point in the process.
                RayNinjaTrader Customer Service

                Comment


                  #9
                  I know how to debug code. I removed the time reference from the script, as well as the barsinceexit!=0, and ran it as a backtest. The prices are exactly identical to what I get in Wealth Lab Pro, which is where the script came from.

                  It's not a debugging issue. It's a question of whether I am using BarsSinceExit!=0 as a valid call. My understanding is that in the case where there has not been an entry, I get -1, I will get 0 if the entry happened today, and I will get something else for values greater than that.

                  The backtest on these conditions work fine. What's not working is the GetCurrentAsk()*1-0.0025 <=bollingerband(10,1.5)*(1-0.055) and the BarsSinceExit!=0. Explain why not. I know if I run this on 100 different charts that it will work. It is running in real time with onbarupdate activated on every tick. Explain. If it works in the backtest, is there something I should know in real time with it? I removed the submit with order confirmation on checkbox in the options dialogue window.

                  Comment


                    #10
                    Sure its a debugging issue. You are asking why something may or may not work. The only way to find out if something does not trigger when you expect is to debug it to see what is happening.

                    What I can tell you is that GetCurrentAskI() in backtest will return the close price of the bar, in real-time it returns the current ask price. Maybe this has some bearing on your results?
                    RayNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by pmachiraju, 11-01-2023, 04:46 AM
                    8 responses
                    149 views
                    0 likes
                    Last Post rehmans
                    by rehmans
                     
                    Started by mattbsea, Today, 05:44 PM
                    0 responses
                    5 views
                    0 likes
                    Last Post mattbsea  
                    Started by RideMe, 04-07-2024, 04:54 PM
                    6 responses
                    33 views
                    0 likes
                    Last Post RideMe
                    by RideMe
                     
                    Started by tkaboris, Today, 05:13 PM
                    0 responses
                    5 views
                    0 likes
                    Last Post tkaboris  
                    Started by GussJ, 03-04-2020, 03:11 PM
                    16 responses
                    3,283 views
                    0 likes
                    Last Post Leafcutter  
                    Working...
                    X