• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to avoid File errors using StreamWriter on multiple instrument Backtest

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

    How to avoid File errors using StreamWriter on multiple instrument Backtest

    Hi,

    I'm trying to collect statistics using StreamWriter and Strategy Analyzer. For a single instrument, all works fine. But I would like to be able to run the strategy on an instrument list, and collect all the resulting data in a single file to save work.

    This causes file access errors because NT runs a bunch of the instruments simultaneously.

    I am sure there must be a simple way around this problem, but I can't figure it out...

    Perhaps some of you crack programmers out there could provide some tips?

    Most appreciated!

    PS. Im using NT8B10

    #2
    Hi ours_solaire,

    As a tip, use a static method that queues things in a list and writes that list to the file line by line (instead of many instances that all try and write simultaneously).

    Attached is an example of creating static methods.


    You can also contact one of our professional NinjaScript Consultants who would be eager to create or modify this script at your request or assist you with your script. Please let me know if you would like our business development follow up with you with a list of professional NinjaScript Consultants who would be happy to create this script or any others at your request.
    Attached Files
    Last edited by NinjaTrader_ChelseaB; 04-19-2016, 03:14 PM.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello ours_solaire,

      If you want a less elegant, but easy-to-implement solution, you could prefix the filename used by StreamWriter with Instrument.MasterInstrument.name for stocks, or name & contract date for futures . This would separate the write operations to separate files and eliminate simultaneous access errors.

      Then later manually merge the files together.

      Comment


        #4
        Thanks for the tips guys!

        rayko: it's exactly this last step of concatenating the files together manually that I want to avoid. If I run this puppy on the NASDAQ100 list, for example, that's quite a lot of merging

        ChelseaB: thanks for your offer of support. I will try to sort this out myself, but if I run up against too many more issues, I will contact your support guys. thanks!

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by akuntysh, Today, 02:43 AM
        0 responses
        4 views
        0 likes
        Last Post akuntysh  
        Started by thgamey, Today, 02:05 AM
        0 responses
        6 views
        0 likes
        Last Post thgamey
        by thgamey
         
        Started by tpdk2012, Today, 12:51 AM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_ChrisSch  
        Started by simonerg, Today, 12:13 AM
        0 responses
        7 views
        0 likes
        Last Post simonerg  
        Started by rickyblah12, 07-20-2019, 01:01 PM
        2 responses
        24 views
        0 likes
        Last Post NinjaTrader_ChrisSch  
        Working...
        X