Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Prints on separate lines

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

    Prints on separate lines

    Hello

    I am trying to get my prints on separate lines with one Print, so I can see them better without using Print(string.Format(...)) for every line, but I'm not sure how to do it.

    I thought " \n " would do the trick, but it doesn't...

    #2
    Hello itrader46,

    Use "\r\n" in the string for a return carriage and a new line.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Great, thank you.

      One more thing, though: I can only write the statement between " " on one long line (as in the first code window), but when I am breaking it, the part on the second line changes from blue to white and at the end of the first blue line({4}), it's asking for another ' " ', then for two ' ) ', then for ' ; ' , then for a statement...

      Code:
      Print (string.Format("Bar[2] 5 min {0}  \r\nDMI Swing High[0] {1 :F4} | DMI Swing High Bar[0] {2}  \r\nDMI Swing Low[0] {3 :F4} | DMI Swing Low Bar[0] {4} \r\nPrice Swing High[0] {5} | Price Swing High Bar[0] {6} \r\nPrice Swing Low[0] {7} | Price Swing Low Bar[0] {8}  \r\nLast Price Swing High {9} | Last Price Swing High Bar {10} \r\nLast Price Swing Low {11} | Last Price Swing Low Bar {12} \r\nLast DMI Swing High {13 :F4} | Last DMI Swing High Bar {14}  \r\nLast DMI Swing Low {15 :F4} | Last DMI Swing Low Bar {16} \r\n#", 
                                          CurrentBar - 2, HSwDMI[0], HSwDMIbar, LSwDMI[0], LSwDMIbar, HSwPrice[0], HSwPriceBar, LSwPrice[0], LSwPriceBar, 
                                          LastHSwPrice[0], LastHSwPriceBar, LastLSwPrice[0], LastLSwPriceBar, LastHSwDMI[0], LastHSwDMIbar, LastLSwDMI[0], LastLSwDMIbar));
      Code:
      Print (string.Format("Bar[2] 5 min {0}  \r\nDMI Swing High[0] {1 :F4} | DMI Swing High Bar[0] {2}  \r\nDMI Swing Low[0] {3 :F4} | DMI Swing Low Bar[0] {4} 
                                          \r\nPrice Swing High[0] {5} | Price Swing High Bar[0] {6} \r\nPrice Swing Low[0] {7} | Price Swing Low Bar[0] {8}  \r\nLast Price Swing High {9} | Last Price Swing High Bar {10} \r\nLast Price Swing Low {11} | Last Price Swing Low Bar {12} \r\nLast DMI Swing High {13 :F4} | Last DMI Swing High Bar {14}  \r\nLast DMI Swing Low {15 :F4} | Last DMI Swing Low Bar {16} \r\n#", 
                                          CurrentBar - 2, HSwDMI[0], HSwDMIbar, LSwDMI[0], LSwDMIbar, HSwPrice[0], HSwPriceBar, LSwPrice[0], LSwPriceBar, 
                                          LastHSwPrice[0], LastHSwPriceBar, LastLSwPrice[0], LastLSwPriceBar, LastHSwDMI[0], LastHSwDMIbar, LastLSwDMI[0], LastLSwDMIbar));

      Comment


        #4
        Hello itrader46,

        Thank you for your reply.

        You're breaking the string into two lines in the second version. To avoid this, put an @ before the string, like this:

        Code:
        Print (string.Format(@"Bar[2] 5 min {0}  
                        DMI Swing High[0] {1 :F4} | DMI Swing High Bar[0] {2}  
                        DMI Swing Low[0] {3 :F4} | DMI Swing Low Bar[0] {4}
                        Price Swing High[0] {5} | Price Swing High Bar[0] {6} 
                        Price Swing Low[0] {7} | Price Swing Low Bar[0] {8}  
                        Last Price Swing High {9} | Last Price Swing High Bar {10} 
                        Last Price Swing Low {11} | Last Price Swing Low Bar {12} 
                        Last DMI Swing High {13 :F4} | Last DMI Swing High Bar {14}  
                        Last DMI Swing Low {15 :F4} | Last DMI Swing Low Bar {16}", 
                        CurrentBar - 2, HSwDMI[0], HSwDMIbar, LSwDMI[0], LSwDMIbar, HSwPrice[0], HSwPriceBar, LSwPrice[0], LSwPriceBar, 
                        LastHSwPrice[0], LastHSwPriceBar, LastLSwPrice[0], LastLSwPriceBar, LastHSwDMI[0], LastHSwDMIbar, LastLSwDMI[0], LastLSwDMIbar));
        That way you also don't need the escape characters.

        Please let us know if we may be of further assistance to you.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        50 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        126 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        69 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        42 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        46 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X