Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

That's the second time it happens

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

    That's the second time it happens

    I don't understand. I think that my code is ok.
    I have a MultiTimeFrame code. I'll post to show how it works...
    and also the chart to show that the code don't fit to what happens.

    Well as you can see, on the backtest, at 18:42 it buys when MACD on RealTime15min is MACD < Avg (from the code its a condition to buy that MACD > Avg).

    How can it be possible??
    Attached Files

    #2
    You are likely not evaluating the correct bar. In a backtest you get a signal bar. This bar is not tradeable because it is already closed and as such your order is placed on the open of the next bar. This is important to note.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      So the bar used is 18:39?

      Comment


        #4
        I could not tell from the screenshots because they are too small. I suggest you just use Print() so there is no ambiguity in evaluating your values.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          I'm using print but I have to fit the size to uploadable

          Comment


            #6
            There is no other way. You need to debug it and that is done with print functions. You will see that the condition is generally true the bar before you see the actual trade. You will also see the actual trade goes in at market open of the next bar.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              How can I use the Print()? What should be the code? I'm newbie with the scripts..

              Comment


                #8
                Please see this tip: http://www.ninjatrader-support2.com/...ead.php?t=3418
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Well, i think I fixed that but I'm seeing that the Condition 3 and 4 of the code.. never work.. can anybody explain me why?

                  Comment


                    #10
                    cozar,

                    You need to test the conditions then. You want to first ensure that your conditions are even evaluated to true. Check the values of everything you are trying to check before the if-statement. Then also place a print inside the if-statement to confirm the code actually reaches that point.
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      HOw can I do that? Check the values of everything you are trying to check before the if-statement???

                      Comment


                        #12
                        Can you explain please?

                        Comment


                          #13
                          Yes cozar. You need to debug it. How else would you know which part of your condition is not working?
                          Josh P.NinjaTrader Customer Service

                          Comment


                            #14
                            But How can I debug it?

                            Comment


                              #15
                              OK, I see the tip below

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by lightsun47, Today, 03:51 PM
                              0 responses
                              5 views
                              0 likes
                              Last Post lightsun47  
                              Started by 00nevest, Today, 02:27 PM
                              1 response
                              9 views
                              0 likes
                              Last Post 00nevest  
                              Started by futtrader, 04-21-2024, 01:50 AM
                              4 responses
                              45 views
                              0 likes
                              Last Post futtrader  
                              Started by Option Whisperer, Today, 09:55 AM
                              1 response
                              14 views
                              0 likes
                              Last Post bltdavid  
                              Started by port119, Today, 02:43 PM
                              0 responses
                              9 views
                              0 likes
                              Last Post port119
                              by port119
                               
                              Working...
                              X