Print()
<< Click to Display Table of Contents >> Print() |
Converts object data to a string format and appends the specified value as text to the NinjaScript Output window. Printing data to the NinjaScript Output window is a useful debugging technique to verify values while developing your custom NinjaScript object.
Notes: The Print() method only targets the Output tab recently specified by set PrintTo property. |
This method does not return a value.
Print(object value)
Warning: High frequency of Print() method calls can represent a performance hit on your PC. Please see the NinjaScript section of the Performance Tips article for more information. |
value |
The object to print to the output window |
Tips: 1.You can format prices aligned for easier debugging by using the ToString() method. E.g., Low[0].ToString("0.00") forces the format from 12.5 to 12.50. Low[0].ToString("0.000") forces 12.500. 2.You can format one or more objects in a specified string with the text equivalent of a corresponding object's value for better maintainability using the .NET string.Format() method. Please see the examples below. |
Passing objects directly to Print() method |
---|
protected override void OnBarUpdate() |
Passing string.Format() directly to Print() method |
---|
protected override void OnBarUpdate() |
Storing and reusing variables in Print() method |
protected override void OnBarUpdate() |