Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Streamwriter in Multi-Strategy

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

    Streamwriter in Multi-Strategy

    Dear NT team

    I am trying to build a multi-time frame strategy (weekly/daily) that will print daily values into a txt file.

    I have my strategy programmed and have added the streamwriter code. If I use only one time frame, it will print the daily values (even if am running the strategy on weekly) AND the weekly prints (so there are double prints for Fridays).

    How can I change the code in the streamwriter to only print the daily values. I am receiving this error message

    **NT** Error on calling 'OnBarUpdate' method for strategy 'a1027SSTTSposONEPRINTwrite/a6bf1b5b51eb4bd1a4cbe054eea7ac05': Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
    if I use:
    try
    {
    // If file at 'path' doesn't exist it will create the file. If it does exist it will append the file.
    if (CurrentBar == 0 && BarsInProgress == 1)
    sw = File.AppendText(path);

    // This is the output of all lines.
    sw.WriteLine(Time + ";" + Instrument.FullName + ";Exp;" );
    }
    As mentioned, the strategy is the same and works without the streamwriter; and the streamwriter works well without the BarsInProgress, so it has to do something with Bars In Progress.

    I have researched the forum but could not find an answer. How would I call the streamwriter on the daily update bar (=bars in Progress ==1) (weekly is BarsInProgress==0).

    Thank you for your help
    wtmnn

    #2
    Problem resolved

    Dear NT team

    I have resolved the problem myself. thus, this thread can be deleted. thank you.

    wtmnn
    Last edited by whotookmynickname; 03-21-2012, 03:11 PM.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    630 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    364 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    105 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    566 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    568 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X