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

Streamwriter

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

    Streamwriter

    Hi,

    I would like to know if it is normal when using the streamwriter for the text file to show no data until the indicator using the streamwriter function is closed?

    When testing the file attached I found this to be the case.

    Is it possible to do this differently so the data being written to the file is shown in the file as soon as it has been written to the file and you are able to open and close the text file and see the changes?

    Regards,
    suprsnipes
    Attached Files

    #2
    Yes, that's correct suprsnipes - once the write is diposed the buffered resources would be written to the file. You can also look into the Flush method to 'flush' the buffer periodically while the process is still running - http://msdn.microsoft.com/en-us/libr...(v=vs.90).aspx

    However since this is more general C#, we could not really offer much support in this area.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Could I also ask an additional question related to the code sample attached originally.

      With the code under OnMarketData what is the best way to store the last two trades so they are available to measure against one another, i.e difference between the two is an up tick or a down tick.

      How would you do that?

      Comment


        #4
        suprsnipes, you can store reference values in variables in your OnMarketData - if you get a new trade event you know a trade has occurred and you can update those variables then and compare.
        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Jon17, Today, 04:33 PM
        0 responses
        1 view
        0 likes
        Last Post Jon17
        by Jon17
         
        Started by Javierw.ok, Today, 04:12 PM
        0 responses
        6 views
        0 likes
        Last Post Javierw.ok  
        Started by timmbbo, Today, 08:59 AM
        2 responses
        10 views
        0 likes
        Last Post bltdavid  
        Started by alifarahani, Today, 09:40 AM
        6 responses
        41 views
        0 likes
        Last Post alifarahani  
        Started by Waxavi, Today, 02:10 AM
        1 response
        21 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Working...
        X