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

Write to a file from indicator

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

    Write to a file from indicator

    Hello,
    I have a custom indicator that write to an output file - Myout.txt. I followed the guidelines as in the documentation.
    I use this custom indicator in market analyzer.
    I get an error "Error on calling 'Onbarupdate' method on bar 72: the process cannot access the file Myout.txt because it is used by another process".
    Since the file is not opened in another editor , could the problem be due to market analyzer calling various instruments that are trying to update the file ?


    Any suggestions on how I can get this to work ?
    basically, what I want is when an instrument called by market analyzer , reaches a certain position I will be able to record it in a Log file.
    Thanks,
    Lior

    #2
    Hello Leope,

    Yes, that is very likely the case that the analyzer being used is causing the problem due to more instruments trying to write at once. If instrument A is writing data while instrument B tried to also write data, it could not.

    Does the output need to specifically be in one file? If not, a simple solution would likely be to make individual files so only one instrument can access the file at once.


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

    Comment


      #3
      Hello Jesse,
      Thanks for your answer. I will separate it a few files.
      One thing I am not clear is - doesn't the market analyzer "call" the instruments from the list in a serial manner (one after the other) ?
      If so , how can this kind of situation occur ?
      Thanks,
      Lior

      Comment


        #4
        Hello Leope,

        In the Market Analyzer, because this tool is driven by market data each indicator would be called once a new tick is received for the instrument it is applied to. If you are using CalculateOnBarClose = true then they would still be called once each series closes a bar which would all be independent of each other.

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

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by pvincent, 06-23-2022, 12:53 PM
        14 responses
        238 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Started by TraderG23, 12-08-2023, 07:56 AM
        9 responses
        382 views
        1 like
        Last Post Gavini
        by Gavini
         
        Started by oviejo, Today, 12:28 AM
        0 responses
        1 view
        0 likes
        Last Post oviejo
        by oviejo
         
        Started by pechtri, 06-22-2023, 02:31 AM
        10 responses
        125 views
        0 likes
        Last Post Leeroy_Jenkins  
        Started by judysamnt7, 03-13-2023, 09:11 AM
        4 responses
        59 views
        0 likes
        Last Post DynamicTest  
        Working...
        X