Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Build issue

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

    Strategy Build issue

    Hi ,
    I have below code which compiled succussfully and created DLL ,But if i try to create new indicator with same code it is giving complilation issue. Can u help me to solve.
    [XmlIgnore]
    [Browsable(false)]
    public Series<double> Long_Stop => ((NinjaScriptBase) this).get_Values()[0];


    [XmlIgnore]
    [Browsable(false)]
    public Series<double> Short_Stop => ((NinjaScriptBase) this).get_Values()[1];

    Error is attached
    NinjaScript File Error Code
    ShankarSTV1.cs Floating-point constant is outside the range of type 'double' CS0594
    ShankarSTV1.cs ; expected CS1002
    ShankarSTV1.cs Invalid token ')' in class, struct, or interface member declaration CS1519
    ShankarSTV1.cs Method must have a return type CS1520
    ShankarSTV1.cs ; expected CS1002
    ShankarSTV1.cs Identifier expected CS1001
    ShankarSTV1.cs Invalid token '0' in class, struct, or interface member declaration CS1519
    ShankarSTV1.cs ; expected CS1002
    ShankarSTV1.cs Invalid token ')' in class, struct, or interface member declaration CS1519
    ShankarSTV1.cs Method must have a return type CS1520
    ShankarSTV1.cs ; expected CS1002
    ShankarSTV1.cs Identifier expected CS1001
    ShankarSTV1.cs Invalid token '1' in class, struct, or interface member declaration CS1519

    #2
    Hello shankar.deshapande,

    Thanks for your post.

    Are you having an issue with a strategy or an indicator?

    It looks like you are trying to add a Series in the same way a plot is used. Please see our AddPlot documentation for creating plots and assigning plot values. You can also use a New NinjaScript Wizard to have plots added to the script for you, and you can view the resulting syntax.

    AddPlot - https://ninjatrader.com/support/help...t8/addplot.htm

    New NinjaScript Wizards - https://ninjatrader.com/support/help.../ns_wizard.htm

    There are also several other syntax errors reported that would need to be corrected. If code was copied, it is possible that the code was copied improperly without minding curly braces. I suggest reviewing each line that is reported with errors and to check the syntax on that line. It can also help to build some simple logic with the Strategy Builder and to practice implementing it in a hard coded script if you are new to programming.

    Publicly available information on C# can be found here - https://www.tutorialspoint.com/csharp/index.htm

    We look forward to assisting.
    JimNinjaTrader Customer Service

    Comment


      #3
      hi,
      thanks for reply . What is difference between plot and series ?. Attached is full source code. It also give error with NinjaScriptBase
      Attached Files

      Comment


        #4
        Where did your original indicator come from?
        Did you try disassemble that indicator?
        Are you trying to use the disassembled indicator as the basis for a new indicator?

        I've looked at your attached code and I can't imagine why a human would write
        NinjaScript in that way ...

        Your compilation errors are a matter of simple programming issues.

        Comment


          #5
          Hello shankar.deshapande,

          A Series<T> is a collection of variables where one variable exists for each bar in the data series.

          Series<T> - https://ninjatrader.com/support/help...8/?seriest.htm

          A Plot uses a Series<double> to hold plot values in the Values array. If you have a look at our open source indicators, you may see that a public Series<double> is available that pulls from Values. This is to give other scripts that host this indicator a common name to work with, so they do not have to reference "Values[0][0]".

          The code provided does not look very familiar with NinjaScripts that are commonly written and the syntax errors will need to be corrected before the script can be usable. I suggest taking a step back and getting more familiar with existing indicators and how they are written so it is is clearer on how the C#/NinjaScript code should be written. You may reference our open source indicators as well as scripts that users have shared on our User App Share for further direction. Publicly available information on C# can help to understand compile error meaning as well.

          https://ninjatraderecosystem.com/user-app-share/

          The link above is publicly available.

          The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.


          We look forward to assisting.
          JimNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by nutmame1, Today, 08:26 PM
          0 responses
          8 views
          0 likes
          Last Post nutmame1  
          Started by dr0832, Today, 07:02 PM
          0 responses
          13 views
          0 likes
          Last Post dr0832
          by dr0832
           
          Started by mlurskint8, Today, 05:27 PM
          3 responses
          19 views
          0 likes
          Last Post NinjaTrader_ShawnB  
          Started by SteveTheCPA, Today, 04:54 PM
          0 responses
          10 views
          0 likes
          Last Post SteveTheCPA  
          Started by Unsuitable, Today, 02:42 PM
          2 responses
          14 views
          0 likes
          Last Post Unsuitable  
          Working...
          X