MultiCharts | PowerLanguage Tutorials | CH9: Print and File

Print and File

Print – Used to output information to the screen or file.
The most important application is to debug the program examining the execution flow.

Syntax

Print([OutputTarget],Expression1,Expression2,etc.);

where

OutputTarget – Specifies the target to output. If it is not specified, the default is output to the PowerLanguage Editor Output Log.
There are 2 output targets can be specified:

  1. Printer – Specify the default printer as the output target.
  2. File("PathFilename") – Specify the file located at PathFilename as the output target. If the file does not exist, a new file will be created.

ExpressionNumerical、String and TrueFalse
Expression:C:D – If Expression is the numerical, can use this syntax to further specify the output format of numerical.
Where:
– The minimum number of output chars (integer + decimal point + decimal places), if the number of output chars is less than C, leading spaces will be added in front of the value to fill up the minimum number of output chars.
– the number of decimal places, if the number of decimal places is greater than D, the value of decimal places will be rounded to D.

The default output format is the 7 minimum number of output chars and 2 decimal places.

Examples

0.10 is printed in the PowerLanguage Editor Output Log, and 3 leading spaces is added in front of 0.10.

Print(.1);

1.556 is printed in the PowerLanguage Editor Output Log, and 1 leading space is added in front of 1.556.

Print(1.555555:6:3);

Output CurrentData and CurrentTime to file C:\test.txt.

Print(File("C:\test.txt"),CurrentDate,CurrentTime);

Reference

https://www.multicharts.com/trading-software/index.php?title=Print

Leave a Reply