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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    98 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    143 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    69 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    125 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    77 views
    0 likes
    Last Post PaulMohn  
    Working...
    X