Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT, why didn't this execute?

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

    NT, why didn't this execute?

    I'm going to post for this question for the last time. Please look at the SB file, which is the real time version, and the SuperBandsBacktest file. The backtest differs only in that it calculates EOD and places orders the next day on static data. To make it run in real time, the values except for the Open[0] which is today's open is analyzed from [1] bar ago.

    Open the backtest version on LAMR today on a daily chart. You'll see that it bought today. The conditions were true, and the real time version did not execute. You guys should be able to compare the versions and give me an answer. The real time version runs "INTRABAR" or calculate onbarupdate. That's the only difference.

    To make it run in real time, we check if the ask is within 0.25% of the buy limit price. When it is, an order is submitted. I know the time functions are correct, so it's something else.

    What I do is open 100 separate strategies for this program to run on. It has never bought anything since I've run it. There should have been buys today.

    I will quit if you can't help me, and it'll just be a waste of my time to try with your platform. I've used basically every platform except yours, and I'm finding this may be one of the most unhelpful forums I've ever used.
    Last edited by beauw; 10-18-2008, 08:52 PM.

    #2
    beauw,

    Your two strategies are completely different. Please review your code between the two versions again. The conditions for entries are not even the same. Of course they will behave differently.

    From your TraceOrders output it is very evident as to why you are not making any trades. Your conditions are NEVER evaluated to true. You need to debug and find out what part of your condition is not evaluated to true. We have been trying to communicate to you to print out each step of your condition and debug it from the very beginning. You have been unwilling to take these debugging steps. We cannot assist you further until you debug your code.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Josh, I'm being very frank with you, if you thought about what I was saying, you would say they "ARE" the same script. The difference? One is based on EOD data, the backtest, so that the values today "ARE" the values to use tomorrow. The "REAL TIME" Version, is going to use yesterdays values, only but the open tick for today's bar is the difference. Because one is being calculated "TODAY", the other is calculated YESTERDAY and that's the backtest. The "REAL TIME" is today using YESTERDAY's values. They are the same.

      Comment


        #4
        beauw,

        Let's take a look at Condition 1.

        From your backtest version:
        Code:
        if (
                        BarsSinceExit() != 0
                        && LinReg(Close, 10)[0] >= (Bollinger(Low, 1.5, 10).Lower[0]) * (1 + -0.055)
                        && StdError(Close, 3).Middle[0] >= 0)
                    {
        From your real-time version:
        Code:
        if (s1b==false
                        && Open[0]>=(Bollinger(Low, 1.5, 10).Lower[1]) * (1 + -0.055)
                        && (GetCurrentAsk()) * (1 + -0.0025) <= (Bollinger(Low, 1.5, 10).Lower[1]) * (1 + -0.055)
                        && LinReg(Close, 10)[1] >= (Bollinger(Low, 1.5, 10).Lower[1]) * (1 + -0.055)
                        && StdError(Close, 3).Middle[1] >= 0)
                    {
        Even if you took your compensation to bring values back to yesterday's values into consideration, just look at the difference in the code. Your backtest version did not check GetCurrentAsk(). It also did not check anything against Open. Where is the check for s1b in the backtest version? With all due respect, your codes are completely different.
        Last edited by NinjaTrader_JoshP; 10-15-2008, 05:04 PM.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Didn't check the open?

          && Open[0]>=(Bollinger(Low, 1.5, 10).Lower[1]) * (1 + -0.055)
          That's the line, which, finding out from someone who pmd me, isn't possible because the bar doesn't exist. The rest of the values are for an EOD static dataset. The real time version is presumably on bar 0, and checks yesterdays values with [1], while it is running on every tick.

          Comment


            #6
            beauw,

            I understand how to use NinjaTrader, NinjaScript, and data feeds just fine.

            I do not know how to help you. You are coming to me comparing apples and oranges and essentially saying why aren't the apples colored orange? The oranges are orange. Why aren't the apples also orange? I am trying to convey to you that the conditions are NOT the same. You keep insisting they are.

            You use GetCurrentAsk() as a condition in real-time. Nothing wrong with that. What is wrong is that you do not use it in backtesting. You cannot just negate this condition. When you have this additional condition in real-time and not in your backtest version your evaluatory conditions are instantly different. All logical equivalence is thrown out the door.

            The open check. Where is it in your backtest version? You just copied and pasted me in your real-time code while saying, "Here, this is where the check is". Sure you checked it in real-time, but where was it in your backtest version? beauw, your versions are 100% different. How can you expect the versions to even behave remotely similar when all of your logic is completely different. We aren't even talking about accessing prior day values in correspondence with yesterday yet.

            Also, the person who PMed you was probably referring to the [1] index you used. In a NinjaScript Strategy the default is to wait for 20 bars before making any calculations. This negates the need for checks on how many bars are on the chart. You have the bar just fine.
            Last edited by NinjaTrader_JoshP; 10-16-2008, 06:17 PM.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Josh View Post
              beauw,

              I understand how to use NinjaTrader, NinjaScript, and data feeds just fine.

              I do not know how to help you. You are coming to me comparing apples and oranges and essentially saying why aren't the apples colored orange? The oranges are orange. Why aren't the apples also orange? I am trying to convey to you that the conditions are NOT the same. You keep insisting they are.

              You use GetCurrentAsk() as a condition in real-time. Nothing wrong with that. What is wrong is that you do not use it in backtesting. You cannot just negate this condition. When you have this additional condition in real-time and not in your backtest version your evaluatory conditions are instantly different. All logical equivalence is thrown out the door.

              The open check. Where is it in your backtest version? You just copied and pasted me in your real-time code while saying, "Here, this is where the check is". Sure you checked it in real-time, but where was it in your backtest version? beauw, your versions are 100% different. How can you expect the versions to even behave remotely similar when all of your logic is completely different. We aren't even talking about accessing prior day values in correspondence with yesterday yet.

              Also, the person who PMed you was probably referring to the [1] index you used. In a NinjaScript Strategy the default is to wait for 20 bars before making any calculations. This negates the need for checks on how many bars are on the chart. You have the bar just fine.

              No, you don't know what you're talking about. They are logically equivalent. One is based on today, hence why the barsback is[0], the other is based on yesterday, [1] in real time. Logically they are equivalent and one runs in real time. Seriously, find me somebody else that understands the difference.

              You haven't grasped the fundamental difference between the two, yet.

              Comment


                #8
                Since you refuse to understand I'll give the classic example.

                The classic example was "buy 8% below yesterday's close, sell on the open the next day.

                The backtest looked like this

                buyatlimit(when?:tomorrow,at what price(closetoday*0.92))
                sellatmarket(when:tomorrow the day after you bought it)


                You might understand it better as

                My backtest:

                exitlong("","")
                enterlongatlimit(close[0]*0.92,"");//this would send an order for each stock I was watching.

                To make it work in real time:
                if firsttickofbar
                exitlong("")

                if ask is within 0.25% of close[1]*0.92 enterlongatlimit(close[1]*0.92);

                The reason it is close[1] is because the backtest would send the order for the "next" day based on [0]. In real time we "ARE" intending to use close[1] to send the order "TODAY" and not the next day. Does that help?


                If you were watching 100 stocks you'd submit 100 orders today for tomorrow's trading day using the backtest version. (In my case I'd be sending 1000 orders on each of the 100 stocks). Submitting 1000 orders today for tomorrow isn't feasible, and that was the backtest.

                To make it work, you run it in real time and "wait till the orders are close." The reason they're the same is that tomorrows order at the end of the day is based on the current bar's closing price, but when we run in real time, todays bar is actually based on yesterday's closing price.

                I hope I've taught you something, so quit arguing with me that they are different. Literally if you want to just look at them they're different, but the price limits are going to be the same as the backtest.
                Last edited by beauw; 10-16-2008, 07:55 PM.

                Comment


                  #9
                  With all due respect, we can not provide you any further help on this issue. You have two different versions of code. To determine why your real-time version (post #4) is not triggering, you will have to debug this by printing out each value that makes up your condition to determine why its not triggering.
                  RayNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by frslvr, 04-11-2024, 07:26 AM
                  7 responses
                  109 views
                  1 like
                  Last Post caryc123  
                  Started by rocketman7, Today, 09:41 AM
                  3 responses
                  8 views
                  0 likes
                  Last Post NinjaTrader_Jesse  
                  Started by traderqz, Today, 09:44 AM
                  2 responses
                  5 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Started by stafe, 04-15-2024, 08:34 PM
                  8 responses
                  41 views
                  0 likes
                  Last Post stafe
                  by stafe
                   
                  Started by rocketman7, Today, 02:12 AM
                  7 responses
                  31 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Working...
                  X