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 statement syntax

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

    print statement syntax

    I'm trying to get a graphical representation with the print statements in the output window, but my print statements are not lining up. For example, I have two print statements like this;

    string buy4 = " LLLL";
    string buy7 = " LLLLLLL";

    I'm wanting the right most side of the string to line up, so I have more spaces in the buy4 line, than the buy7 line. Both strings have the same number of characters, but when they print in the output window, they show up like this;

    LLLL
    LLLLLLL

    So what happened to my leading spaces? In actuality, some of my strings have as many as 49 leading spaces in them. I thought I would mention this in case the length of my string is a problem. Is there some additional syntax I should be adding to get them to line up?

    Thanks,

    Safetrading

    #2
    Hello Safetrading,

    Could you show me an example of how you are adding the spaces and using the Print() statement?
    JCNinjaTrader Customer Service

    Comment


      #3
      I just did, but it appears they did not show up correctly in my post. In the string line, buy4, I typed in 6 spaces before LLLL, in the buy7 string line, I typed in 3 spaces before the LLLLLLL, although I see in my post the spaces are not there. Anyways, both strings I just posted have 10 characters in them, the first one has 6 spaces, then LLLL, the second string has 3 spaces, then LLLLLLL.

      When they print however, they are not lined up.

      Comment


        #4
        Hello Safetrading,

        They way you are declaring them:

        Originally posted by safetrading View Post
        string buy4 = "LLLL";
        string buy7 = "LLLLLLL";
        They will start on the left but if you are manually adding the spaces when you are printing them this would be because each Font has a different character spacing for the "Space" and every letter just like when you are using Microsoft Word. You may want to change the Font in your Output window that has a more standardize spacing for every character like "Consolas".

        You may do this by right clicking inside of the Output window -> Select "Font" -> Change the "Font" to "Consolas".

        See the attached images from the same Output Window with different Fonts.
        Attached Files
        JCNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Barry Milan, Yesterday, 10:35 PM
        5 responses
        16 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by DanielSanMartin, Yesterday, 02:37 PM
        2 responses
        13 views
        0 likes
        Last Post DanielSanMartin  
        Started by DJ888, 04-16-2024, 06:09 PM
        4 responses
        12 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by terofs, Today, 04:18 PM
        0 responses
        11 views
        0 likes
        Last Post terofs
        by terofs
         
        Started by nandhumca, Today, 03:41 PM
        0 responses
        8 views
        0 likes
        Last Post nandhumca  
        Working...
        X