Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Write ti file only once time when strategy finished

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

    Write ti file only once time when strategy finished

    Hi all

    I am triying to define a strategy to get returns accumullated per day of week, my goal is store the Close-Open= return per each day...monday, tuesday.. and when we reach the last bar to write to file this value.

    My approach till now is I can store this value per bar in each iteration of on bar update and in excel manage it but this is not the right way. Also a I can store my final values per each day of week but i cannot find where I have to locate my writeline code to write to file just before stratety finish, I already try do it with bar.count and currenbar, also with state,terminated but I could not figure it, please if somebody can help me.


    Regards.

    #2
    Hello J2512,

    Thanks for your post.

    I have moved this topic over to the NinjaTrader 8 General Development section of the forums since it is related to NinjaScript development.

    Something you could consider would be checking if CurrentBar == Bars.Count-2 and call your WriteLine method within that condition check.

    See the help guide documentation below for more information.
    SampleStreamWriter: https://ninjatrader.com/support/help...o_write_to.htm
    CurrentBar: https://ninjatrader.com/support/help...currentbar.htm

    ​​​​​​​Let us know if we may assist further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    41 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    28 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    45 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    37 views
    0 likes
    Last Post CarlTrading  
    Working...
    X