Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Compile issues

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

    Compile issues

    I start by saying I have a lot of C# experience but new to Ninjascript. I used the Ninjascript Indicator wizard to generate code and filled in some of the methods. When I go to compile I get the same 3 errors:

    Line 16 Unexpected preprocessor directive
    Line 14 { expected
    Line 129 } expected


    I thought I had nested something incorrectly but there is simply no code there. For giggles I pulled up some existing indicators that work and tried to compile them but got the same errors. Ideas?
    Attached Files
    Last edited by stuart; 05-09-2012, 08:26 PM.

    #2
    Welcome to our forums and please give the attached a try, compiles well here.

    1. For the Add() overload including the marketdata type, please include the specific symbol name

    2. For MultiSeries access to the Close prices array use, please use Closes and not Close -

    http://www.ninjatrader.com/support/h...nt7/closes.htm

    Generally it's helpful to step through available parameters / overloads with Intellisense -

    http://www.ninjatrader.com/support/h...tellisense.htm
    Attached Files
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thanks for the reply Bertrand. I did use intellisense and there were serveral overloads for the Add function and I was trying to use the one that referred to the primary symbol. That said the code you sent me still did not compile and I got the same three errors

      Comment


        #4
        There's unfortunately no overload for adding marketdata types on the primary series, you have to explicitly specify the instrument name here to use.

        Add(string instrumentName, PeriodType periodType, int period, MarketDataType marketDataType)

        Are you sure you copied my file over yours and are not accidentially using your old uncompilable one? Please recheck.

        You can of course also simply fix your present file with the points I mentioned so it could compile normally.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          If you look at my post I specifically stated that I can't compile anything. If I bring up existing indicators that work and try to compile them I get the same three errors

          Comment


            #6
            Right, that would be expected - all files have to be compilable, or nothing would compile - since all is compiled into one assembly for runtime use.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              So a partially completed script was causing the issue. Once deleted your code compiles. It doesn't work but it does compile. So when you use "Add" you give the "ES" as the contract. Is that just a placeholder that is overwritten by the primary contract when used in a chart?

              Comment


                #8
                Correct, one script with compile issues could stop the whole compile process for all scripts you have installed as everything is maintained in one assembly for performance reasons.

                I've added the ES in as example for a symbol, so you could compile your code - you would need to add here the symbol you wish to use.

                For an index, for example ^SP500

                For a spot fx instrument $EURUSD

                For a stock MSFT
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  But I want the symbol to reference the primary symbol i am adding the indicator to. ie. if you are charting $AUDUSD i don't want to have to change the code every time. How do you choose the context symbol?

                  Comment


                    #10
                    Although we can't support dynamically adding offically, you can try using Instrument.FullName here in your Add() call. Cleanest way would be setting up a string user input to enter the instrument you would like to run on.
                    BertrandNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by hayleeabb, Today, 04:21 PM
                    1 response
                    5 views
                    0 likes
                    Last Post NinjaTrader_ShawnB  
                    Started by mg.watts, Today, 03:17 PM
                    1 response
                    15 views
                    0 likes
                    Last Post NinjaTrader_ChrisL  
                    Started by JTizz, Today, 01:20 PM
                    1 response
                    8 views
                    0 likes
                    Last Post NinjaTrader_Jesse  
                    Started by omermirza, Today, 12:39 PM
                    2 responses
                    13 views
                    0 likes
                    Last Post omermirza  
                    Started by mballagan, Today, 01:02 PM
                    1 response
                    10 views
                    0 likes
                    Last Post NinjaTrader_Kate  
                    Working...
                    X