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

    Hello,
    I have used the Streamwriter example and in general all worked fine, only the last bar on the chart ist not updated in the textfile.
    Any suggestions
    Thanks
    Lars

    #2
    Hi Lars,

    This is likely due to your CalculateOnBarClose setting. When set to false, it will process script logic for the bar that's currently forming.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_RyanM View Post
      Hi Lars,

      This is likely due to your CalculateOnBarClose setting. When set to false, it will process script logic for the bar that's currently forming.

      In my experience, it needs to be false to get the final bar on an EOD chart, too.

      --EV

      Comment


        #4
        Hi Ryan,
        Thanks ! In the Initializie section I have set it to false, but I checked the chart setting and this was on true. After changing it each tick of the bar was appended.
        1) is the a setting where the initialize setting will overrule the chart parameter?
        2) how does only the last acutal value will be written to the file. I assume the last entry must be overwritten each time the a new tick is coming or?
        Thanks
        Lars

        Comment


          #5
          The selection made in the GUI will supersede anything written in the Initialize method. When you write it in the Initialize() method, this determines what is selected in the Gui initially.

          Yes, it will process logic for every tick, so this value is then continuously updated when new prices arrive.
          Ryan M.NinjaTrader Customer Service

          Comment


            #6
            What can i do to write only the last actual value of the bar ?

            Comment


              #7
              The last actual value can constantly change, so you could store it and only update when it's new.

              Initialize the value somewhere else, maybe during the first tick of bar

              if (FirstTickOfBar)
              myDouble = Close[0];

              if (myDouble != Close[0])
              myDouble = Close[0];

              Write myDouble to file rather than Close[0].
              Ryan M.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by f.saeidi, Today, 01:32 PM
              0 responses
              0 views
              0 likes
              Last Post f.saeidi  
              Started by traderqz, Today, 12:06 AM
              9 responses
              16 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by kevinenergy, 02-17-2023, 12:42 PM
              117 responses
              2,766 views
              1 like
              Last Post jculp
              by jculp
               
              Started by Mongo, Today, 11:05 AM
              5 responses
              15 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by SightCareAubetter, Today, 12:50 PM
              0 responses
              2 views
              0 likes
              Last Post SightCareAubetter  
              Working...
              X