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

Problem Launching Own Indicator

Collapse
X
 
  • 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

    #2
    Hello,

    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

    Comment


      #3
      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!

      Comment


        #4
        Hello,
        Thank you for the questions.

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

        Code:
        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:

        Code:
        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

        Comment


          #5
          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!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by aa731, Today, 02:54 AM
          0 responses
          4 views
          0 likes
          Last Post aa731
          by aa731
           
          Started by thanajo, 05-04-2021, 02:11 AM
          3 responses
          470 views
          0 likes
          Last Post tradingnasdaqprueba  
          Started by Christopher_R, Today, 12:29 AM
          0 responses
          10 views
          0 likes
          Last Post Christopher_R  
          Started by sidlercom80, 10-28-2023, 08:49 AM
          166 responses
          2,237 views
          0 likes
          Last Post sidlercom80  
          Started by thread, Yesterday, 11:58 PM
          0 responses
          5 views
          0 likes
          Last Post thread
          by thread
           
          Working...
          X