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

Backtest Properties window is empty

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

  • bltdavid
    replied
    Originally posted by Leeroy_Jenkins View Post
    I use CalculateOnBarClose, not OnBarUpdate, my bad. No errors.
    As a new programmer, there are two basic categories of errors you are forever learning
    to overcome:

    Compile-Time errors:
    Compiling your code finds language syntax errors, these errors must all be corrected before
    you can even run your code. These errors are reported at the bottom of the NinjaTrader
    editor window.

    Run-Time errors:
    These errors typically show a poor understanding of the language, they indicate things like
    incorrect usage of concepts, improper organization of code, and non-sensical logic violating
    language constraints. These errors are bad enough that the run-time environment (such as
    NinjaTrader's Strategy Analyzer) will usually stop the program (aka, your indicator or strategy)
    and print an error message. In our case all run-time error messages are sent to the log file,
    which are viewable via the Log tab in the Control Center window.

    The point is:
    Just because your code compiles correctly, does not mean that other errors don't exist. Like
    many terms in computer science, the word 'error' is very overloaded.

    Although it deals with Java, this link has good general information about 'errors' in programming:
    https://www.cis.upenn.edu/~matuszek/...ax/errors.html

    Btw, yes, there is a third major category of errors, known as 'bugs'. When a program is able
    to run to completion yet still produces incorrect results, the logic errors in the program causing
    the incorrect results are called 'bugs'. A software bug can be exceptionally difficult to find
    and become very notorious in its effects.

    You code is a classic example of the "run-time error" category.

    The philosophy section at the bottom of that link is very well said.
    No one starts out writing perfect error-free programs.
    Hang in there.
    Last edited by bltdavid; 02-19-2019, 11:41 AM.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello Leeroy_Jenkins,

    All of the code from lines 37 to 54 is accessing bar information and cannot be in Initialize(). Move this code to OnBarUpdate().

    Below I am providing a link to a forum post with helpful information about getting started with NinjaScript. Please watch the NinjaScript Editor 401 video.

    Leave a comment:


  • bltdavid
    replied
    Originally posted by NinjaTrader_ChelseaB View Post
    Is there any invalid code in the Initialize() method in the ADX6 script?
    Except where OP initialized CalculateOnBarClose to true, OP's entire Initialize is nothing but invalid code.

    Leave a comment:


  • bltdavid
    replied
    Originally posted by Leeroy_Jenkins View Post
    I though if I need CalculateOnBarClose = true I should put my code into Initialize(). Am I wrong?
    Yes, this is (very) wrong.
    Do you recall where you learned this from?

    Originally posted by Leeroy_Jenkins View Post
    Simple strategies from tutorial wrote like that...
    Which simple strategies? Please provide links.

    Originally posted by Leeroy_Jenkins View Post
    Could you please look at my code cuz I dunno where is a problem in Initialize(). I tried everything I know.
    I've looked at your code. It is not organized correctly.

    Except for the line where you set "CalculateOnBarClose = true", move all the other lines into OnBarUpdate.

    Originally posted by Leeroy_Jenkins View Post
    I use CalculateOnBarClose, not OnBarUpdate, my bad. No errors.
    The errors you are seeing are precisely because you are not using OnBarUpdate correctly.

    Have you studied any of the NinjaTrader sample strategies?

    Please note:
    Your code in attachment in post #3 is simply wrong.
    No sample strategy has any of the OnBarUpdate code placed inside Initialize.
    No tutorial would ever show code examples organized in that manner.

    Even though your code is wrong, you're very close, so do some simple editing and try again.
    Make sure you study and learn why your initial code attachment is organized incorrectly.
    Last edited by bltdavid; 02-18-2019, 10:20 PM.

    Leave a comment:


  • Leeroy_Jenkins
    replied
    Originally posted by NinjaTrader_ChelseaB View Post

    Keep in mind that bar information is not available in Initialize().
    I though if I need CalculateOnBarClose = true I should put my code into Initialize(). Am I wrong? Simple strategies from tutorial wrote like that...
    Could you please look at my code cuz I dunno where is a problem in Initialize(). I tried everything I know.
    Last edited by Leeroy_Jenkins; 02-18-2019, 03:57 PM. Reason: eu education

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello Leeroy_Jenkins,

    When you mention: "I run backtest at 11:13 and nothing happened. No results, no errors.", this is incorrect.
    There were errors.
    The errors are yellow in the Log tab of the Control Center.
    You even found the error that was produced when loading the script.
    "18.02.2019 11:11:21 Strategy Failed to call method 'Initialize' for strategy 'ADX6/0704599be6884fd1a3ca581361e0b8ec': Object reference not set to an instance of an object. "
    This is the error that is preventing your script from running.

    The error states the issue is that the script ADX6 cannot be Initialized.
    You have an error in Initialize.

    Please take a look at the Initialize method in ADX6 as directed by the error message that appears when attempting to load this script.

    Is there any invalid code in the Initialize() method in the ADX6 script?

    Keep in mind that bar information is not available in Initialize().

    Leave a comment:


  • Leeroy_Jenkins
    replied
    Originally posted by NinjaTrader_ChelseaB View Post
    Hello Leeroy_Jenkins,

    Are you 100% certain that there are no errors appearing on the Log tab of the Control Center?

    I am receiving errors in the Log tab of the Control Center.

    Please try testing the script again and look once more at the Log tab of the Control Center. Do you see any errors in yellow? If so, what do these say?

    This script is attempting to access bar information in Initialize() which is not allowed. You have to wait until OnBarUpdate() before you can start processing bar information.

    Please attempt to run the script again, then immediately after running the script please take a screenshot of the Log tab of the Control Center and then provide this screenshot with your next post.
    I run backtest at 11:13 and nothing happened. No results, no errors. But I found this:

    18.02.2019 11:11:21 Strategy Failed to call method 'Initialize' for strategy 'ADX6/0704599be6884fd1a3ca581361e0b8ec': Object reference not set to an instance of an object.

    My strategy is called ADX6.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello Leeroy_Jenkins,

    Are you 100% certain that there are no errors appearing on the Log tab of the Control Center?

    I am receiving errors in the Log tab of the Control Center.

    Please try testing the script again and look once more at the Log tab of the Control Center. Do you see any errors in yellow? If so, what do these say?

    This script is attempting to access bar information in Initialize() which is not allowed. You have to wait until OnBarUpdate() before you can start processing bar information.

    Please attempt to run the script again, then immediately after running the script please take a screenshot of the Log tab of the Control Center and then provide this screenshot with your next post.

    Leave a comment:


  • Leeroy_Jenkins
    replied
    Originally posted by NinjaTrader_ChelseaB View Post
    Hello Leeroy_Jenkins,

    Are there errors appearing in the Log tab of the Control Center?

    Specifically errors about OnStateChange or the Constructor?


    If not, may I test an export of your script?

    To export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:
    1. Click Tools -> Export -> NinjaScript...
    2. Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
    3. Click the 'Export' button
    4. Enter a unique name for the file in the value for 'File name:'
    5. Choose a save location -> click Save
    6. Click OK to clear the export location message
    By default your exported file will be in the following location:
    • (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
    Below is a link to the help guide on Exporting NinjaScripts.
    http://ninjatrader.com/support/helpG...-us/export.htm
    I use CalculateOnBarClose, not OnBarUpdate, my bad. No errors.
    Attached Files

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello Leeroy_Jenkins,

    Are there errors appearing in the Log tab of the Control Center?

    Specifically errors about Initialize() or the Constructor?


    If not, may I test an export of your script?

    To export a NinjaTrader 7 NinjaScript so this may be shared and imported by the recipient do the following:
    1. Click File -> Utilities -> Export NinjaScript
    2. Enter a unique name for the file in the value for 'File name:'
    3. Select the strategy from the objects list on the left -> click the right facing arrow ">" to add the strategy to the export
    4. Click the 'Export' button -> click 'yes' to add any referenced indicators to the export -> click OK to clear the export location message
    By default your exported file will be in the following location:
    • (My) Documents\NinjaTrader 7\bin\Custom\ExportNinjaScript\<export_file_name.z ip>
    Below is a link to the help guide on Exporting NinjaScripts.
    Last edited by NinjaTrader_ChelseaB; 02-18-2019, 09:03 AM.

    Leave a comment:


  • Leeroy_Jenkins
    started a topic Backtest Properties window is empty

    Backtest Properties window is empty

    Hi there,
    I have a strategy (OnBarUpdate) and when I try to backtest it via Strategy Analyzer (choosing my strategy from list) I don't see any properties such as data series, time frame. This window is empty. I only see Run backtest button which do nothing.
    Maybe I should change smth in code?

Latest Posts

Collapse

Topics Statistics Last Post
Started by cls71, Today, 04:45 AM
0 responses
1 view
0 likes
Last Post cls71
by cls71
 
Started by mjairg, 07-20-2023, 11:57 PM
3 responses
213 views
1 like
Last Post PaulMohn  
Started by TheWhiteDragon, 01-21-2019, 12:44 PM
4 responses
544 views
0 likes
Last Post PaulMohn  
Started by GLFX005, Today, 03:23 AM
0 responses
3 views
0 likes
Last Post GLFX005
by GLFX005
 
Started by XXtrader, Yesterday, 11:30 PM
2 responses
12 views
0 likes
Last Post XXtrader  
Working...
X