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

print format for output window

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

  • NinjaTrader_ChelseaB
    replied
    Hello Tony,

    You are trying to find the Quantity of a filled order in OnOrderUpdate()?

    Print(order.Quantity);
    Print(order.Filled);


    Leave a comment:


  • tonynt
    replied
    Originally posted by NinjaTrader_ChelseaB View Post
    Hello Tony,

    Unfortunately, there is only one output window and this only has two tabs. It is not possible to open two output windows.
    Hello Chelsea,

    OK. So I focus on one instrument for the moment to work with my idea. Can you please tell me how I can add the traded quanitity in the output window (so that I can also have the traded numbers in same output window as I have the bid and ask limits now)

    Thank you!
    Tony

    Leave a comment:


  • tonynt
    replied
    Hello bltdavid,

    thank you for your reply!! I think this will be to difficult for me because I have no idea what-where-...

    Best regards
    Tony

    Leave a comment:


  • bltdavid
    replied
    I'd like to recommend a different approach.

    Tony, design your own 'Print' function that writes its output
    to a log file. Start simply with something like this,

    Code:
    private void DebugOutput(string format, params object[] args)
    {
        Print(string.Format(format, args));
    }
    The 'params' feature makes it much easier to create formatted output,
    for example, call it like this,

    Code:
    DebugOutput("Bar={0} Time='{1}' {2}", CurrentBar, Time[0].ToString("M/d/yy ddd HH:mm:ss"), msg);
    And use it in a higher level wrapper, like this,

    Code:
    private void Debug(string format, params object[] args)
    {
        string msg = string.Format(format, args);
        DebugOutput("Bar={0} Time='{1}' {2}", CurrentBar, Time[0].ToString("M/d/yy ddd HH:mm:ss"), msg);
    }

    Then migrate DebugOutput to writing to a stream,

    Code:
    private StreamWriter DebugOutputStream = null;
    private string = DebugOutputFileName = null;
    private void DebugOutput(string format, params object[] args)
    {
        if (DebugOutputStream == null)
        {
            DebugOutputFileName = [COLOR=#27ae60]<your code>[/COLOR];
            DebugOutputStream = File.AppendText(DebugOutputFileName);
        }
    
        DebugOutputStream.WriteLine(string.Format(format, args));
    }
    It sounds like you want the filename to be instrument specific,
    which is straightforward to do, so modify <your code> to taste.

    Ok, so why do all this?
    What's the big deal?

    Easy.
    The point is: create separate debug output files, so that you can
    watch them all separately, using a separate program.

    Download one of the many Windows 'tail' programs to watch the
    output of each log file.

    I use BareTail, which has a free version, and a pro version for $25.

    Start BareTail three times, once on each log file, and now you have
    three separate 'output windows' ... Problem solved!

    BareTail even has configurable color highlighting, so you can colorize
    important lines when they appear. I really love that feature.

    Enjoy!

    [EDIT: Also, BareTail supports tabs, so you can tail as many files as
    you want inside one invocation, each file would appear in its own tab.]
    Last edited by bltdavid; 09-22-2020, 11:53 AM.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied

    Hello Tony,

    Unfortunately, there is only one output window and this only has two tabs. It is not possible to open two output windows.

    Leave a comment:


  • tonynt
    replied
    Hello,

    thank you for your reply. Is it possible to open output window 2 times? Or to float tab2?

    Thank you!
    Tony

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello Tony,

    You can set the PrintTo to .OutputTab2.

    Leave a comment:


  • tonynt
    replied
    Hello,

    thank you for your reply. You wrote above that there are 2 tabs in the output window: how can I plot in tab2, so I can run the code for 2 instruments, each plotting in one of the tabs.

    Thank you!
    Tony

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello Tony,

    New lines can be added with "\r\n" the \r is return the \n is new line.

    Calling draw methods does use CPU. It would depend on how frequently the draw method is being called.

    Leave a comment:


  • tonynt
    replied
    Hello,

    thank you for your reply. I´m not sure if I understand, sorry. As I wrote I use it in the chart already (with draw.textfixed). But how can I have plotting always a new new line so that the value before is always one row lower - instead of updating at the exact same xy-position. I mean the new value can be on the same xy-position but the value from before should be below. Would this be possible? And I allow to add a question in this concern: if this would work, would this use a lot of cpu? (because text plotting uses sometimes a lot of cpu as I saw in utm)

    Thank you!
    Tony
    Last edited by tonynt; 09-21-2020, 09:22 AM. Reason: inaccurate translation

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello Tony,

    You could accumulate the messages with newlines to a string. Then use Draw.TextFixed() to draw the string on the chart.

    string myString;

    myString += "\r\n" + Close[0];

    Draw.TextFixed(this, "tag1", myString, TextPosition.TopRight);

    Leave a comment:


  • tonynt
    replied
    Hello,

    thank you for your reply. OK. Is it then possible to plot it the same way in the chart? Now I have it also in the chart but always showing "only" the last value, can one have the printing/plotting same as in output window in the chart (I mean row below row... with incoming new numbers...eg the bid ask from the top in T&S)

    Thank you!
    Tony

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello Tony,

    Unfortunately, there is only one output window and this only has two tabs.

    Leave a comment:


  • tonynt
    replied
    Hello,

    thank you for your reply. Another question concerning the output window. How can one have an output window for ES, and another one for CL and one for 6E pls? I have coded in a script to print me what I need and want to bring up the output window ES beside ES chart, the output window with CL beside CL chart...

    Thank you!
    Tony

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello tonynt,

    bltdavid is giving good advice. Below is a link to the help guide on FormatPrice().


    You can also use numeric format strings with your print.
    In this article, learn to use standard numeric format strings to format common numeric types into text representations in .NET.

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by Christopher_R, Today, 12:29 AM
0 responses
8 views
0 likes
Last Post Christopher_R  
Started by sidlercom80, 10-28-2023, 08:49 AM
166 responses
2,235 views
0 likes
Last Post sidlercom80  
Started by thread, Yesterday, 11:58 PM
0 responses
3 views
0 likes
Last Post thread
by thread
 
Started by jclose, Yesterday, 09:37 PM
0 responses
7 views
0 likes
Last Post jclose
by jclose
 
Started by WeyldFalcon, 08-07-2020, 06:13 AM
10 responses
1,415 views
0 likes
Last Post Traderontheroad  
Working...
X