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

Indicator "Executing" when not loaded

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

    Indicator "Executing" when not loaded

    I have been developing a pair of indicators. (1) to read many days of 1 Minute data, analyse it, and save results to a file (R). This summary information is to be read by a second (2) indicator to combine with real-time data and plot on a specific chart.

    There is a third (3) indicator relevent here, though it is only a test indicator used to explore various constructs like array and string methods.

    The Problem

    I kept getting a message saying that (R) could not be accessed because it was being used by another process. I stripped everything back so that (1) was the only custom indicator loaded. I deleted the file (R), restarted NT.

    On the Output panel I got the same message but the "cannot access.." was associated with (2), even though it was not loaded on any chart. Moreover, I also noticed a "Print" message that I had coded into (3) that was being output despite it not being loaded either.

    I cannot make any progress until I can resolve this.

    Ideas/solutions please.

    Thanks G.

    #2
    Hello Griesha_uk, and thank you for your question.

    NinjaTrader 8 is a multithreaded application, and tasks such as file access will most easily avoid these kinds of race conditions if they are restricted to the main UI thread. While you will need to add your own file I/O code, the attached educational reference sample add-on should help you get started. It will run a daemon once a microsecond which will check a public static string to see if it is non-empty, and if it is, it will call your code to print this message to a file. Please let us know if there are any other ways we can help.
    Attached Files
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      Indicator "Eexcuting" when not loaded

      Thanks, JessicaP, the information you sent may be useful in the future, but I am using NT7 and have no real intention of going to NT8 in the near future. I’d prefer to see NT8 settle down for a few more month first, then I can justify the full weekend or so to do the conversion from NT7.

      Unfortunately, in relation to NT7, I don’t think the question was answered. I understand how file usage can cause contention problems when 2 or more studies are writing/reading (potentially) at the same time. I think I can probably code around that, but need a clean starting point. Hence:

      1/ How can an indicator be executing when not being used/loaded on any chart? (in any Workspace).

      2/ If there is a known issue, is there a workaround?

      3/ Could my “NT code package” be corrupted? Should I simply reinstall? (How would I safely do this without losing my Template and Workspace setup, and of course, all the Indicators I have coded).

      Many Thanks,

      G

      [PS. I have a lot of experience around procedural languages, but struggle with object-orientated languages. So, please assume I am a novice]

      PPS. I just noticed another anomaly. Having removed the indicators I mentioned from all charts, and having cleared the Output window, I was about to add an indicator (std 30 period EMA). Immediately I clicked on the Indicator selection in the drop-down list, the Output window populated with the same problem info: "...cannot access.." etc. Strange?

      Please see attached...
      Attached Files
      Last edited by Griesha_uk; 02-17-2017, 09:19 AM. Reason: Noticed an additional phenomenon, which is relevent

      Comment


        #4
        Thank you for this additional information. Please note that NinjaTrader 7 is no longer under active development, and so our goal will be to find a work-around solution. Fully debugging user code is also beyond the scope of the support we may provide, however, we will be happy to put you in touch with this kind of help should you desire it.

        This said, the easiest approach as far as debugging would be to save your workspace, close Ninja, and delete your (My) Documents\NinjaTrader 7\workspaces\_Workspaces.xml file . This will cause Ninja to load a single, blank workspace on its next start-up. From here, please apply just one or the other of your indicators, to ensure these are individually able to use your code which writes to a file. Finally, try these together in the same workspace.

        To avoid this entirely, I would also like to recommend the built-in MSDN C# Path.GetTempFileName method, publicly available documentation here,

        Creates a uniquely named, zero-byte temporary file on disk and returns the full path of that file.


        This method was developed with this exact situation in mind. This way each of your indicators will have a unique filename only that indicator instance has access to.
        Jessica P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by fiddich, Today, 05:25 PM
        0 responses
        3 views
        0 likes
        Last Post fiddich
        by fiddich
         
        Started by gemify, 11-11-2022, 11:52 AM
        6 responses
        803 views
        2 likes
        Last Post ultls
        by ultls
         
        Started by ScottWalsh, Today, 04:52 PM
        0 responses
        4 views
        0 likes
        Last Post ScottWalsh  
        Started by ScottWalsh, Today, 04:29 PM
        0 responses
        7 views
        0 likes
        Last Post ScottWalsh  
        Started by rtwave, 04-12-2024, 09:30 AM
        2 responses
        22 views
        0 likes
        Last Post rtwave
        by rtwave
         
        Working...
        X