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

NT 8 error message: is a type but used like variable

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

    NT 8 error message: is a type but used like variable

    I'm migrating from NT 7 to NT 8. Using your conversion tool, I'm running into errors when trying to compile the resulting script(s) in NT 8. Error message is what I wrote in the thread title. Here the offending lines:

    NT 7
    fastEma.Set(ZeroLagEMA(fast)[0]);
    slowEma.Set(ZeroLagEMA(slow)[0]);

    NT 8
    fastEma[0] = ZeroLagEMA(fast)[0];
    slowEma[0] = ZeroLagEMA(slow)[0];

    ZeroLagEMA is an indicator that compiled and works well in NT 8.

    #2
    Hello,

    Thank you for the post.

    Unfortunately I could not provide any insight on how this code may have been generated with the tool you are using, currently there is no suggested way to automatically convert code.

    For this error, this may be the plot or potentially the indicator call. To understand what specific syntax is the reason, I would suggest to try the following:

    comment out the offending code and try instead:

    Code:
    fastEma[0] = 0;
    Does this work?
    This would tell us if the variable is correctly set to be a plot and the indicator call could be reviewed.

    if so, try the following:

    Code:
    fastEma[0] = ZeroLagEMA(0)[0];

    Otherwise please attach the script and we could look further into what the syntax is and needs to be.

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

    Comment


      #3
      Hello Jesse,

      thanks for the quick reply.

      I used the conversion tool from this link:




      I tried the code modifications you suggested.

      fastEma[0] = 0;
      works.

      fastEma[0] = ZeroLagEMA(0)[0];
      doesn't work.

      I have attached the two NT 8 scripts to this post. ZeroLagEMA is the indicator that is called. HKZeroLagMACD is the script that generates the compiler error.
      Attached Files

      Comment


        #4
        Hello,

        Thank you for the files.

        The reason for the error is actually the ZeroLagEMA and how it was converted. If this was done by a conversion tool, I would not suggest to use these as they do not always work correctly.

        The NinjaScript generated code is missing from the ZeroLagEMA effectively making it invisible to NinjaScript.

        You would need to go into the ZeroLagEMA indicator and delete the blank spaces at the end of the file and then compile to generate the extra code at the bottom. Once this happens, you can uncomment the lines from your indicator and it should then work.

        Please let me know if I may be of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Jesse,

          I deleted the 2 blank lines at the end of the script and recompiled. All is well now.

          Thank you for your help.

          This is great customer service. Much appreciated.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by junkone, Today, 11:37 AM
          2 responses
          14 views
          0 likes
          Last Post junkone
          by junkone
           
          Started by frankthearm, Yesterday, 09:08 AM
          12 responses
          44 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by quantismo, 04-17-2024, 05:13 PM
          5 responses
          35 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by proptrade13, Today, 11:06 AM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by love2code2trade, 04-17-2024, 01:45 PM
          4 responses
          35 views
          0 likes
          Last Post love2code2trade  
          Working...
          X