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

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.
    Brandon H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by AveryFlynn, Today, 04:57 AM
    0 responses
    4 views
    0 likes
    Last Post AveryFlynn  
    Started by RubenCazorla, 08-30-2022, 06:36 AM
    3 responses
    77 views
    0 likes
    Last Post PaulMohn  
    Started by f.saeidi, Yesterday, 12:14 PM
    9 responses
    23 views
    0 likes
    Last Post f.saeidi  
    Started by Tim-c, Today, 03:54 AM
    0 responses
    3 views
    0 likes
    Last Post Tim-c
    by Tim-c
     
    Started by FrancisMorro, Today, 03:24 AM
    0 responses
    5 views
    0 likes
    Last Post FrancisMorro  
    Working...
    X