Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

What's most efficient way to write to file in a running strategy?

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

    What's most efficient way to write to file in a running strategy?

    Hi,

    I read this thread



    where a couple of options are discussed for writing to a file.

    My main aim is to seperate the logging for different instruments using the same strategy, and to save it to file immediately without the danger of losing logging from the output window by closing NT without saving it and so on.

    My main worry is that I'll slow down NT noticeably. I'm using a 6 month old machine so it's well specced still, but I don't want to overload NT unnecessarily.

    Second to that, I also need the output to be written to disk as soon as it's logged, so that I can monitor the real-time logging without stopping the strategies.

    What is the best option here? Any advice from the NT support team, or anyone?

    Thanks
    Last edited by adamus; 10-04-2010, 08:08 AM.

    #2
    adamus, this is unfortunately out of our supported scope here, but the pointer on mutex locks is an important one to consider for efficiency and performance of the code.

    Comment


      #3
      I should avoid the mutex pointer or I should use it?

      Comment


        #4
        Working with it is good practice to avoid running into file lock scenarios where concurrent attempted access would create a conflict.

        Comment


          #5
          Some thoughts:

          If you're automatically monitoring the output why not use the Log function to send stuff to the log file and just append the instrument name - then your monitoring can just filter by instrument name. Then you don't have to worry about opening/closing/locking etc. This is what I do and it works fine.

          In terms of performance, if you're logging something so much to make a difference, aren't you logging too much? If you were logging every few seconds I couldn't imagine it slowing Ninja down significantly. If logging on every tick, that's a lot of output to monitor.

          Dave

          Comment


            #6
            re concurrent access problems, each strategy instance will have a unique filename, and running them live is a single threaded process I believe - it's only optimization that implements multi-threading and I switch it off in optimization, so I figured it wouldn't be a problem - or am I mistaken?

            Good point about the NT log file and filtering. I'm using cygwin to run stuff like less and tail for monitoring, so that should be perfectly easy, although I think I might drown out the normal logging stuff which I might need to read at any point without a filter.

            In terms of the quantity of stuff being logged, it would only be once per onBarUpdate, onExecution and onOrderUpdate and the minimum timeframe is 5 mins so perhaps I shouldn't worry - unless I get 100 strategies running. But hopefully by the time I get to 100 the 1st will be so rock solid it won't need logging (and NT7 will be out of beta....)

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            647 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            367 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            108 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            571 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            573 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X