Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Strategy analyser not working

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

    Strategy analyser not working

    Hi,

    I have had a custom strategy coded for me. I am using IB data and connecting to IB to trade. Sim and live trading works fine connecting to IB. But when I try to to use the ninjatrader strategy analyser to backtest the system I do no receive any results.

    I go to new , strategy analyser, select my strategy etc. click run, I get the message running backtest and it runs the backtest for a while but no results display.

    The strategy would have traded in the period i test.

    Thanks for your help

    #2
    Hello blueboy,

    Thank you for the post.

    If the strategy is otherwise working in live but does not work in historical modes such as backtesting, this may be to do with how the script was programmed or the data that is available. Have you at this point confirmed with the developer if this was created to allow for backtesting? Have you also confirmed you have data for the complete test period?

    It is possible to program a script for realtime in ways that will prevent it from working in historical tests so confirming with the developer on this will be helpful. You can also test applying the strategy to a chart, and then review the historical bars on the chart. Did the strategy place historical trades? This is similar to running a backtest as historical data is being used.

    Another test would be to use the SampleMACrossOver in the backtest and ensure that it can place trades and sees results. If that does not have results, it may be a configuration problem or data available for the testing period.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thanks for the quick reply.

      I will have to confirm with developer.

      I have data for relevant period. I am getting my data from IB I subsribe to their data feeds for the relevant product.

      On the charts the strategy shows the buy and sells annotated above and below each candle.

      The samplaMAcrossover showed results for a backtest.

      Thanks

      Comment


        #4
        Hello blueboy,

        Thank you for confirming that.

        You said: On the charts the strategy shows the buy and sells annotated above and below each candle.

        Was this historically or are these realtime trades you are referring to? If you are seeing historical trades, then the backtest tool should also be able to work. Essentially if the strategy can place historical trades it will, the backtest also uses historical data so it should also be able to place trades there if it can. If it is not, that may be due to an error happening (you can check the log tab for that) or possibly the data. It is still a good idea to confirm the specifics surrounding your script with the developer in this case.

        You may try to use a very small period like 1 week or 1 month and see if that produces results. If you are using Tick data or a large period that exceeds the historical data servers availability, the test may not process or return results.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Yes I am seeing historical trades annotated on the chart but strategy analyser does not produce any results.

          Developer says backtesting should work.

          I have tried it over short periods, still doesn't work.

          Thanks

          Comment


            #6
            is this something you'd be willing to send to receive help on? I used to have the same issue but then realised after some teaching from NT staff that it was a multi-time frame strategy so I needed to add a few more data calls in the strat.

            If you'd like if it's proprietary and such, feel free to send a PM

            Cheers

            Comment


              #7
              Hello blueboy,

              Thank you for the reply.

              Yes based on the information, it sounds like it should be able to work in a backtest but this is likely due to some difference between the chart test and the backtest.

              As I do not have the specifics surrounding the script, it would likely be best if you can reach out to the developer to see what settings they used when testing it in backtest. This would allow you to replicate the test and confirm it works, or if there is still a difference.

              This is a situation that is difficult to see what the problem may be as a third party is involved and we don't have the full context of the code being used. With that being said, any information the developer can share would be helpful to find the reason.

              Can you detail the chart setup versus the backtest setup? Potentially we could recognize a difference in the settings you are using as well. You may try taking images of the backtest settings and also the Dataseries window/strategy settings you are using and post those.

              I look forward to being of further assistance.
              JesseNinjaTrader Customer Service

              Comment


                #8
                Thanks for the replies

                I've spoken to the developer. He says he has tested it on his computer and backtest is working fine. So it's a bit of a mystery.

                If I have a live connection to IB running, should backtest still work?

                I am backtesting via strategy analyser this is right?

                Comment


                  #9
                  Hello Blueboy,

                  Thank you for the reply.

                  The datafeed would be one item to consider, do you know what data feed the developer is using?

                  Also, are you receiving live/historical data for all instruments the strategy uses? You may double check that you can open a chart for the full period of time being tested for all instruments the strategy uses.

                  Each data provider does have stipulations surrounding the data you receive and what is available, potentially there is a difference in data causing the test to fail due to missing data. If you open the control center logs tab and then run the backtest, is there any warning or error output?

                  Backtesting in the strategy analyzer would be correct. If you can provide images of the two separate tests it may be a setting being used that you have overlooked as well.


                  I look forward to being of further assistance.
                  JesseNinjaTrader Customer Service

                  Comment


                    #10
                    Developer using CQG NT and I am using IB

                    No error messages in the log

                    Yes receiving data for all instruments I use, have checked by opening chart.

                    Here is an image of the test used.

                    I also tested to check it wasn't a data issue. SAMPLE MA CROSSOVEr produced results but SAMPLE ATM STRATEGY produced zero results like my custom strategy is doing.

                    Thanks
                    Attached Files

                    Comment


                      #11
                      Hello Blueboy,

                      Thank you for the reply.

                      The SampleMACrossOver should produce results historically so it sounds like on a single series strategy that is working in that test. The SampleATMStrategy should not work in a backtest, this is a realtime only script.

                      Can you provide an image of the chart setup as well for your script? I would need to see both the backtest settings, along with the Chart/strategy settings where you applied it to be able to compare them.

                      This may also be a case where you want to contact the developer for further assistance. If the developer has added any kind of debugging or logging to the script, that may be able to be viewed to see what the problem is. It sounds like the backtest is working as expected, but something in your script or its configuration specifically is preventing results.

                      I look forward to being of further assistance.
                      JesseNinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by NinjaTrader_Jesse View Post
                        Hello Blueboy,
                        The SampleATMStrategy should not work in a backtest, this is a realtime only script.
                        Hi Jesse,
                        Is there a video anywhere showing the SampleATMStrategy in progress/work?
                        Thanks!

                        Comment


                          #13
                          Hello SBMT17,

                          I am unsure of a specific video of the sampleATM working, you can test it in realtime or on the simulated data feed connection to see it work though.

                          The SampleATMStrategy also entails you open the script and read the notes prior to using it, you do need to set up a specific ATM template and there is also a condition to be met before a trade is placed. For further questions on this topic specifically, I would suggest creating a new thread as this is unrelated to the blueboy's question in this post.

                          I look forward to being of further assistance.
                          JesseNinjaTrader Customer Service

                          Comment


                            #14
                            Thanks for the replies

                            Please find chart settings attached which produces annotated buy and sell orders on the chart as per the strategy.

                            Please find strategy analyser settings I am using in strategy analyser.

                            The developer says it is a problem with Ninja Trader as when I run strategy analyser and record the logs no logs are recoded. So he says it it an error in NT otherwise it would produce error log if there was a code error.
                            Attached Files

                            Comment


                              #15
                              Hello blueboy,

                              Thank you for the reply.

                              In this case, I don't see anything specific from the images provided but I also don't believe this is a problem with the platform specifically. This is still likely related to configuration, the script its self of the data being used.

                              Based on your previous note that the SampleMACrossOver is working in the backtest, this indicates to me that your platform is working as expected and the problem is instead something surrounding this script specifically. This could be a difference in data between the developer and your PC or some other setting. I really couldn't detail what that may be as I don't have the full details of the problem here.

                              The developer is partially correct, you would see an error if there was one happening. A script will not always produce errors though, this only would happen if an error occurred. A script can also run normally and place zero trades or do nothing based on its logic. That is not a NinjaTrader problem but a logic problem. Generally, if there is no output but there is also no error, that would indicate to me that the portion of the script where that output is placed is not being reached. This would also be a case the developer would need to debug as this would be outside of the scope that you or I could see as it relates to the code.

                              In a situation that the developer feels there is an actual problem with the platform and not the code being used, we ask that they provide a specific example of the problem which may include a sample script and steps to reproduce the problem. The developer can always reach out to our NinjaScript support for further assistance in cases that may arise like this.

                              Otherwise, I would suggest seeing if your developer can remotely connect to your machine to test the code they created. The developer has the full details on the requirements to run the script along with the ability to debug it in case it is not running as expected. This is not something I could do for you and is also not something you can do without being able to see the code.

                              If the case is that you had something developed for you and have the source code and are no longer working with the developer, in that situation we could review the code together or review ways you can edit the code to add debugging.

                              I look forward to being of further assistance.
                              JesseNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Davidtowleii, Today, 12:15 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post Davidtowleii  
                              Started by guillembm, Yesterday, 11:25 AM
                              2 responses
                              9 views
                              0 likes
                              Last Post guillembm  
                              Started by junkone, 04-21-2024, 07:17 AM
                              9 responses
                              68 views
                              0 likes
                              Last Post jeronymite  
                              Started by trilliantrader, 04-18-2024, 08:16 AM
                              4 responses
                              20 views
                              0 likes
                              Last Post trilliantrader  
                              Started by mgco4you, Yesterday, 09:46 PM
                              1 response
                              11 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Working...
                              X