Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error on generating Strategy

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

    Error on generating Strategy

    Hello,

    This is my first posting to ninjatrader. Let me know if there's a more appropriate place for posting these types of requests. I'm a former Tradestation user, and am looking forward to learning NT.

    Part of a strategy I'm working on is to keep track the most recent low. I used the Wizard to set up the following, but get an error code CS0021 when trying to save. Here's the code-

    // Condition set 1
    if (Low[0] < Low[1])
    {
    Variable0 = Low[0];
    }

    All values should be integers, so I don't see where the problem is. I would appreciate if someone could shed more light on what's causing the error, or recommend another way to keep track of a recent low (or high).

    Thanks.

    #2
    Welcome to the NT forums here philotrader, best place would be the NinjaScript development support section for those type of issues...your code snippet posted looks ok to me - likely you run into an offending code lines in another script (as in NinjaScript all scripts will be compiled every time you compile, thus all have to be error free). To see which script is the one giving you the issue, please double click on the compile error listed at the bottom and then either debug the section or comment it out to be able to compile.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hi Bertrand,

      Thanks for your reply. Again, the Wizard created the code snippet I included. I'm just trying to create some logic to keep track of the most recent low(or high). I though this would be fairly easy, but tried this several times in the Wizard and keep getting the same error. It's a nice interface to use, but it looks like debugging is going to be a challenge. I can post this in the development section if you think that's the best route to go.

      Comment


        #4
        philotrader, even if you've created this snippet from the wizard, at the time you compile ALL scripts present (indicators and strategies) would be compiled 'under the NT hood' as we only run those studies from one compiled assembly file for maximum performance at runtime. This of course forces the compile process to note any code issue in any file, not only for example one in the file you're currently working on specifically.

        To check what causes, please open one indicator in the NinjaScript editor and press F5 then as you see the source code loaded up, this will start the compile process then with all found errors listed at the bottom.

        Please take a screenshot then of those and post it here for us to take a look.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Hi Bertrand,

          Thanks for your offer. Attached is a screenshot of the compile errors when I try to "Finish" in the Wizard. Please let me know where the problem may be.
          Attached Files

          Comment


            #6
            The issue is in the ForexRunner strategy, not the one you're currently editing - please doubleclick on the error and fix the relevant code portions, as you're attempting to access an historical int value > which is unfortunately not possible (unless it's an Int series you're working with).
            BertrandNinjaTrader Customer Service

            Comment


              #7
              I see. This was a painful, but valuable lesson. I removed the other strategy, and the new compiles OK. I'll certainly keep this in mind for the future.

              Thank you for your assistance.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by xiinteractive, 04-09-2024, 08:08 AM
              5 responses
              13 views
              0 likes
              Last Post NinjaTrader_Erick  
              Started by swestendorf, Today, 11:14 AM
              2 responses
              5 views
              0 likes
              Last Post NinjaTrader_Kimberly  
              Started by Mupulen, Today, 11:26 AM
              0 responses
              2 views
              0 likes
              Last Post Mupulen
              by Mupulen
               
              Started by Sparkyboy, Today, 10:57 AM
              1 response
              6 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by TheMarlin801, 10-13-2020, 01:40 AM
              21 responses
              3,918 views
              0 likes
              Last Post Bidder
              by Bidder
               
              Working...
              X