Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy not working as it should (ninjatrader powered by zenfire)

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

    Strategy not working as it should (ninjatrader powered by zenfire)

    Hi, i actually developed a strategy and put it into my simulation account for a test while the market is going on.. what i saw untill now abashes me.
    The strategy runs trades that is not supposed to and if i run a backtest of those days works perfectly. It takes position under a SMA even if in the code it's clearly specified to work just over it. It should work just after some variable are setted but it takes a trade anyway.. It seems to me, that since all the variables are depending on a SMA it does not calculate it correctly. I didnt runned the strategy on the chart but in the control center panel specifically to see how it was working. Could you please give me a reason about why this is happening? The data feeder is zenfire.

    Thanks in advance

    Alex

    #2
    Hi Alex,

    For this you'll want to Print() all values used for your order conditions to verify they're what you expect. Add TraceOrders = true; to your Initialize() method and view output for strategy orders in Tools > Output Window. Help for using these debugging tools is available here:


    If you want to align a visual SMA with what you use for your entries, you can add the indiciator in Initialize(). You can then run the strategy directly from the chart.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Hi Ryan,
      I already debugged the system. The point is:
      If i open a chart and plot on it my SMA i get it on 7114,9, if i print it on the output window after have runned it from a strategy (same loaded days as the chart i opened) i get it on 7109,20. This seems to occur just with slow SMA > 600.
      In the code there is just 1 entry way and is:

      if (
      Open[0] < SMA(EntrySMA)[0]
      && Close[0] < SMA(EntrySMA)[0]
      ..........
      ........ecc.
      )

      {
      EnterLong(intstopvar, "");
      ......
      ......ecc.
      }

      Now, at 7122,5 it entered long.. why? The price is above the SMA and this should never happen. In the backtest of today this trade is not taken but many oders that the system is not doing.. why there is this inconvenient? any ideas?

      Thanks,

      Alex
      Originally posted by NinjaTrader_RyanM View Post
      Hi Alex,

      For this you'll want to Print() all values used for your order conditions to verify they're what you expect. Add TraceOrders = true; to your Initialize() method and view output for strategy orders in Tools > Output Window. Help for using these debugging tools is available here:


      If you want to align a visual SMA with what you use for your entries, you can add the indiciator in Initialize(). You can then run the strategy directly from the chart.
      Last edited by alext; 06-07-2011, 09:23 AM.

      Comment


        #4
        In your example you're not comparing apples to apples. The strategy you run on control center uses a distinct data set and settings compared to what you use on the chart. You can use Print() statements within your code to check everything, or you can run your strategy directly on the chart, with the same indicator checked for entry conditions added for easier visual confirmation.

        Break it down like this:
        if (Open[0] < SMA(EntrySMA)[0] && Close[0] < SMA(EntrySMA)[0])
        {
        Print("Open: " + Open[0] + " SMA: " + SMA(EntrySMA)[0]);
        Print("Close: " + Close[0] + " SMA: " + SMA(EntrySMA)[0]);
        }

        Your condition checks these values and prints the output. You should expect that each time you print this out, Open and Close are less than the SMA value. Looking at a separate chart that does not have the script applied is not the same test.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          I am actually running it waiting for an entry.. but are you telling me that running a strategy from a chart or from the control center with the same data series and days to load gives differents results? If yes.. from where is ninjatrader taking the data for the control center strategy runner?

          Thanks,

          Alex

          Comment


            #6
            You can line up all the settings and get a similar data set with the control center compared to chart. It depends what you're looking to do. If you're debugging strategy behavior from the control center, you need Print() statements within the code to check your values.

            If you want to line up the data sets: check interval, days to load, session template, indicator settings, etc. To accurately compare the data sets of control center compared to chart, you'll also need Print() statements to check values.

            Although if your goal is to match what you see on a chart with the script, then easiest is just apply the script to a chart.
            Last edited by NinjaTrader_RyanM1; 06-07-2011, 12:58 PM.
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              I bet that the problem is that the run it with COBC = false.

              p.s.
              I may be wrong, but I estimate that this is the problem with more than 80% accuracy. I wish I had a strategy with those odds.

              Comment


                #8
                I am going to guess session template issues.

                I could never get code output to match the chart because of it.

                Comment


                  #9
                  No, calculate bar on close = true, by the way i am actually running a copy of the strategy on a chart and is working fine. The other one in the control center is running on fesx and dax, is the same strategy with:

                  {
                  EnterLong(intstopvar, "");
                  Print("Open: " + Open[0] + " SMA: " + SMA(EntrySMA)[0]);
                  Print("Close: " + Close[0] + " SMA: " + SMA(EntrySMA)[0]);
                  .....
                  }

                  in the enter rule. While in each eurostoxx trade i get printed the values in the output window this is not happening for the dax.. so i really cant check what is wrong. I would really find a way to run the strategy from the control center and have the same operation done as the one runned from a chart since the data feeder is the same one. Actually the difference is minimal, but yesterday it was making a huge difference. Am i asking a lot? Why ninjatrader does not work as expected in both ways? There is some option around i missed?

                  Thanks,

                  Alex

                  Originally posted by Baruch View Post
                  I bet that the problem is that the run it with COBC = false.

                  p.s.
                  I may be wrong, but I estimate that this is the problem with more than 80% accuracy. I wish I had a strategy with those odds.

                  Comment


                    #10
                    It works if you line up all the settings between chart and control center. If you're still having trouble with this, we can setup a call with remote assistance support. Please send a note to support 'at' ninjatrader 'dot' com Attn: RyanM to arrange this.
                    Ryan M.NinjaTrader Customer Service

                    Comment


                      #11
                      Ok Ryan.. i think i lined up all the settings correctly (even before), i am anyway waiting for the error to repeat, since the other day was the first time that was happening in over 2 weeks of test. Next time this happens i am going to e-mail you with some logfile, screenshot or we can set up the call with the remote assistance support.

                      Thanks,

                      Alex

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Barry Milan, Yesterday, 10:35 PM
                      5 responses
                      16 views
                      0 likes
                      Last Post NinjaTrader_Manfred  
                      Started by DanielSanMartin, Yesterday, 02:37 PM
                      2 responses
                      13 views
                      0 likes
                      Last Post DanielSanMartin  
                      Started by DJ888, 04-16-2024, 06:09 PM
                      4 responses
                      13 views
                      0 likes
                      Last Post DJ888
                      by DJ888
                       
                      Started by terofs, Today, 04:18 PM
                      0 responses
                      12 views
                      0 likes
                      Last Post terofs
                      by terofs
                       
                      Started by nandhumca, Today, 03:41 PM
                      0 responses
                      8 views
                      0 likes
                      Last Post nandhumca  
                      Working...
                      X