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 junkone, Today, 11:37 AM
    2 responses
    15 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by frankthearm, Yesterday, 09:08 AM
    12 responses
    44 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Started by quantismo, 04-17-2024, 05:13 PM
    5 responses
    35 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by proptrade13, Today, 11:06 AM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Started by love2code2trade, 04-17-2024, 01:45 PM
    4 responses
    36 views
    0 likes
    Last Post love2code2trade  
    Working...
    X