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 rdtdale, Today, 01:02 PM
        0 responses
        3 views
        0 likes
        Last Post rdtdale
        by rdtdale
         
        Started by alifarahani, Today, 09:40 AM
        3 responses
        15 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by RookieTrader, Today, 09:37 AM
        4 responses
        18 views
        0 likes
        Last Post RookieTrader  
        Started by PaulMohn, Today, 12:36 PM
        0 responses
        7 views
        0 likes
        Last Post PaulMohn  
        Started by love2code2trade, 04-17-2024, 01:45 PM
        4 responses
        41 views
        0 likes
        Last Post love2code2trade  
        Working...
        X