• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.


No announcement yet.

Partner 728x90


Problem Launching Own Indicator

  • Filter
  • Time
  • Show
Clear All
new posts

    Problem Launching Own Indicator

    Hi, I am new to NT7, currently I am trying and practising writing myself some simple indicators script as testing. However, I found some issue that troubling me badly, when I launch my indicator, the real time data did not update itself, when my realtime data did update itself, the indicator is not working, may I know did I miss anything in my script? I just using Wizard to create my indicator and make some simple equation and drawing some shape on my chart, but I cannot test it for work. Sorry for newbie here, but I cannot find any resources regarding my problem hence I need to request help from here. Thanks in advance.
    My data service provider is CQG


    Thank you for the questions I will be happy to help.

    It is hard to say exactly why the indicator is not working without seeing the code you are using. If you would like you can post the code you are using in the forum, support staff along with users are then able to assist you in problems you may be having.

    A couple of helpful notes on how to debug what may be happening:

    When you do not see the indicator plotting on the chart when you expect it to a good first step is to check the output log.
    You can open the output window by clicking Tools -> Output window

    this window is used solely for NinjaScript so this is a great window to have open 100% of the time you are developing a NinjaScript file.

    In this case if you open the output window and then apply the indicator to a chart, do you see any errors listed?

    Additionally we have a excellent Tips section for NinjaScript:

    Also a Reference Samples section:

    If you can provide the code I would be happy to look at it and see where the holdup is.

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


      Ok thanks, the problem solved by defining if (CurrentBar < 2).
      Another problem and question I am having here, how can i define and made use of my own variable?
      Can you show me a syntax of command for NT?
      For eg, I need to define "A" as "Volume[0] / (High[0]-Low[0])
      Then I wish to make a comparison of value A through SMA[A] (my customised variable)
      If A[0] > SMA[A] + 500, then continue with plotting or alert command, may I know how can I do so in NT? Thanks if any help provided, because I am newbie here, looking forward your reply, thanks!


        Thank you for the questions.

        For defining variables, NinjaScript follows C# guidelines so some examples of some variables are below:

        double A = Close[0];
        bool trueFalse = true;
        int integerVal = 100;
        decimal dec = 100.05M;
        string str = "Hello World";
        So each variable must have a type followed by a name followed by an assignment.

        Now if you wanted to do some calculations using a variable you could do something like this:

        double A = Volume[0] / (High[0]-Low[0]);
        if this was put in OnBarUpdate this would calculate the double A every bar for use.

        For your second question I would like to clariify, are you trying to use the value of the double A for the bars ago in this equation?
        A[0] > SMA[A]

        If so the SMA would only be able to accept a period of a integer value or a whole number.

        If you are trying to use the SMA to average the results of the double A you would need to change A from a double to a DataSeries so that it could be used with the SMA.
        Here is more information on DataSeries http://www.ninjatrader.com/support/h...ries_class.htm

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


          Ok quite a shock and surprise when seeing your reply Jesse! Really thanks very much for providing such good support services for NinjaTrader user, however, I already finished develop my indicator by referring DataSeries guide 2 days ago, anyway really thanks very much for your help, appreciated and will support NinjaTrader!


          Latest Posts


          Topics Statistics Last Post
          Started by morrnel, Today, 01:13 PM
          0 responses
          Last Post morrnel
          by morrnel
          Started by babouin77, Today, 12:41 PM
          5 responses
          Last Post babouin77  
          Started by punkiy2111, Today, 12:17 PM
          1 response
          Last Post NinjaTrader_Tabor  
          Started by GLFX005, Today, 11:22 AM
          4 responses
          Last Post GLFX005
          by GLFX005
          Started by mintxom, Today, 10:25 AM
          1 response
          Last Post NinjaTrader_Melissa