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

Unstable script work

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

    Unstable script work

    Hello support --

    I developed a script which draw objects on a chart when I click on a line of separate windows form.

    I add the script to three different chart. The charts are linked. The problem is that some time the script draw objects only on one chart, objects on the other charts are not drawn at all, sometime objects are drawn by click particular line. Clicking on other lines of the form does not give a result.

    Actually I have another three linked charts and I add the script to the three of them too. The problem is the same.

    Sometime everything work good. Objects are drawn on all charts by clicking on each line of the form.

    What is the problem? I can send you the script if you need it to test and review the code.

    Regards.

    #2
    Hi Alex, do you see any errors / exceptions raised as this happens? We could sure give a quick testrun here and share our thoughts then. The way you initiate the drawing would not be direclty supported though, to further look into I would radically isolate and simplify matters to exactly understand where it would break for your setup. So for example unlink the charts and work with one chart now only to begin with.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Bertrand,

      I tryed the early version of my script (cs.zip attached file) and it works. I added Instrument check and tick size to the last version (cs_1.zip attached file) and the problem is in them.

      I tried to get Instrument value and tick size value by the following

      #region Variables
      double ts;
      Instrument instr;
      #endregion

      protected override void OnStartUp()
      {
      ts = TickSize;
      instr = Instrument;
      }
      also I tried to get that values by
      public void listView1_SelectedIndexChanged(object sender, EventArgs e) and protected override void OnBarUpdate() methods.

      The script works good if I have executions at the current trade session and do not shut down the terminal (NT7). As soon as I shut down the terminal the script gives zero values of instr and does not work.

      But the early script work whether the terminal was shut down or not. It needs the current session trades only.

      I guess the problem is in Instrument and tick size method. On what method and how can I get Instrument and tick size values to my script.

      Regards.
      Attached Files

      Comment


        #4
        Alex, both instrument and ticksize access should be fine either in OnStartUp() or OnBarUpdate() since you would have an instrument / bars series by then to work with - debug prints at the time you would want to work with those values would confirm this.

        Most of the code used we could unfortunately not really support officially here, to continue debugging this script I would recommend making just one change at a time going from your first working version to the one that broke then. That way you can hopefully get a better handling on the Achilles heel here.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Also, just seen this issue for your scripts -

          Error on calling 'OnTermination' method for indicator 'cs': Object reference not set to an instance of an object.
          BertrandNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by r68cervera, Today, 05:29 AM
          0 responses
          2 views
          0 likes
          Last Post r68cervera  
          Started by geddyisodin, Today, 05:20 AM
          0 responses
          3 views
          0 likes
          Last Post geddyisodin  
          Started by JonesJoker, 04-22-2024, 12:23 PM
          6 responses
          33 views
          0 likes
          Last Post JonesJoker  
          Started by GussJ, 03-04-2020, 03:11 PM
          12 responses
          3,239 views
          0 likes
          Last Post Leafcutter  
          Started by AveryFlynn, Today, 04:57 AM
          0 responses
          6 views
          0 likes
          Last Post AveryFlynn  
          Working...
          X