Announcement

Collapse
No announcement yet.

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);

    https://ninjatrader.com/support/help...rderupdate.htm
    https://ninjatrader.com/support/help.../nt8/order.htm

    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 = <your code>;
            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, 10: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.
    https://ninjatrader.com/support/help...t8/printto.htm

    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, 08: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);

    https://ninjatrader.com/support/help..._textfixed.htm

    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().
    https://ninjatrader.com/support/help...ormatprice.htm

    You can also use numeric format strings with your print.
    https://docs.microsoft.com/en-us/dot...ectedfrom=MSDN

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by swcooke, Today, 07:17 PM
0 responses
6 views
0 likes
Last Post swcooke
by swcooke
 
Started by aguison, Today, 04:20 PM
1 response
11 views
0 likes
Last Post s.kinra
by s.kinra
 
Started by timko, Today, 04:11 PM
0 responses
6 views
0 likes
Last Post timko
by timko
 
Started by djkiwi, Today, 03:25 PM
2 responses
12 views
0 likes
Last Post djkiwi
by djkiwi
 
Started by hdge4u, Today, 12:29 PM
1 response
21 views
0 likes
Last Post NinjaTrader_Manfred  
Working...
X