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 Waxavi, Today, 02:10 AM
              0 responses
              2 views
              0 likes
              Last Post Waxavi
              by Waxavi
               
              Started by TradeForge, Today, 02:09 AM
              0 responses
              4 views
              0 likes
              Last Post TradeForge  
              Started by Waxavi, Today, 02:00 AM
              0 responses
              2 views
              0 likes
              Last Post Waxavi
              by Waxavi
               
              Started by elirion, Today, 01:36 AM
              0 responses
              4 views
              0 likes
              Last Post elirion
              by elirion
               
              Started by gentlebenthebear, Today, 01:30 AM
              0 responses
              4 views
              0 likes
              Last Post gentlebenthebear  
              Working...
              X