Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SampleMACrossover live data vs. historical data

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

    SampleMACrossover live data vs. historical data

    Hello,

    I'm a beginner so be gentle.

    I'm having a problem with the SampleMACrossover strategy that comes with the software. When I backtest this strategy it works fine. It takes a position and closes the previous position everytime the moving average lines cross. When I try this strategy with live data it doesn't seem to work the same. It closes the previous position and doesn't open a new position (it waits until the MA lines cross again to take a new position). Do I have a setting wrong? I'd like to be able to understand the problem before I code my own algorithm.

    thanks

    #2
    Hello,

    When you apply a new strategy, what are your order handling settings?

    Can you provide a screen shot of the chart with the executions and MA's on it?
    DenNinjaTrader Customer Service

    Comment


      #3
      Hi Ben,

      Here are the setting. The executions seem to be happening correctly, however I'm not taking positions (as previously explained).
      Attached Files

      Comment


        #4
        Hello,

        The screen shot is very small so I can hardly make out what is going on, however the executions look right on: previous order closes and a new order in the opposite direction every time the MA's cross.
        DenNinjaTrader Customer Service

        Comment


          #5
          Sorry, screenshot is too small to see anything. Is this by chance the YM on TWS/IB? If so, then there is a bug which will be addressing with next release (~2 weeks) from now.

          Comment


            #6
            Hi Ben,

            Here's a better look at the settings.

            Again the executions look fine. However positions are not being taken everytime the MAs cross. If I'm long/short it'll close that position and then wait until the MA cross again to take a new position. Looking at the executions, a position should be closed everytime the lines cross and a new one should be taken. Correct?
            Attached Files

            Comment


              #7
              As a matter of fact it is the YM on IB. So if I run the code on the S&P emini it should work correctly? I guess I'll fine out tomorrow morning.

              Cheers

              Comment


                #8
                Or try it on an equity like MSFT or AAPL.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  I ran the SampleMAcrossover stragety against the MSFT and I received the same results. If i check the MAIN executions tab it seems to be perfect. However when I check the executions and trades tabs under the Account Performance tab it shows that positions are not being taken consistently.

                  Comment


                    #10
                    Please post some screenshots of where you think there are discrepancies. The Account Performance tab just reports whatever has happened. If it is seen in executions it is there. You may be applying filters to your account tab. Please don't use filters like account or date.
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      If you compare the chart to the trades tab you'll see that a LONG position was taken @ 27.41 and closed at 27.47. A short position didn't get taken @ 27.47. Why is that?
                      Attached Files

                      Comment


                        #12
                        Hello,

                        After a second look at this, it seems there could be two things causing confusion for you here:

                        -The MA cross strategy is an always in strategy. NT also tries to pair trades in the trades tab. Because the reporting is started mid signal NT pairs the close of the pre-existing signal with the close of the next signal and the next long signal with the sell short signal. That is why you see this odd pairing.

                        -Also the trades tab only shows trades. An execution that is still open as a position, like what is shown in your screen shot, would be shown in your executions tab.
                        DenNinjaTrader Customer Service

                        Comment


                          #13
                          That doesn't explain things as I see it.

                          Please correct me if I'm wrong. The SampleMACrossover it supposed to do the following:

                          1. When the fast SMA crosses over the slow SMA a LONG position is taken.
                          2. This position remains open until the slow SMA crosses over the fast SMA.
                          3. At this point the position is closed ans a new SHORT position is taken. This position will not close until the fast SMA crosses over the slow SMA.

                          The result should be a list of trades that alternate between LONG and SHORT (or vice versa) as shown be back testing the strategy. As you can see be the list of trades only LONG position are being taken. Thus a trade is being skipped. By watching the Position Tab I can confirm that a position is being taken every other crossover.

                          How do you explain that?
                          Attached Files

                          Comment


                            #14
                            Hello,

                            Please generate a report that starts on the same day that you started the strategy (or earlier) and you will see what you want to see.

                            Starting your report while a trade is open, is causing Closes to be paired with Closes and Buys the be paired with Sells. Please look at the Entry and Exit columns in your screen shot and compare them with a report that is generated before your strategy has an open position.
                            DenNinjaTrader Customer Service

                            Comment


                              #15
                              That doesn't answer my question at all. I realize the ENTRY NAME and EXIT NAME aren't correct. The trades however are. I went long at $27.41 and exited that position at $27.47. I went long again at $27.53 and exited at $27.49. I'm missing a SHORT trade in between. I ran a back test for todays day using the same strategy. The trades are SHORT, LONG, SHORT, LONG etc... With the live data the trades are LONG, LONG, LONG etc...

                              Try as I might there isn't SHORT trade to be found in the live data.
                              Attached Files

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Jon17, Today, 04:33 PM
                              0 responses
                              1 view
                              0 likes
                              Last Post Jon17
                              by Jon17
                               
                              Started by Javierw.ok, Today, 04:12 PM
                              0 responses
                              4 views
                              0 likes
                              Last Post Javierw.ok  
                              Started by timmbbo, Today, 08:59 AM
                              2 responses
                              10 views
                              0 likes
                              Last Post bltdavid  
                              Started by alifarahani, Today, 09:40 AM
                              6 responses
                              40 views
                              0 likes
                              Last Post alifarahani  
                              Started by Waxavi, Today, 02:10 AM
                              1 response
                              19 views
                              0 likes
                              Last Post NinjaTrader_LuisH  
                              Working...
                              X