Print Function
Logs messages to the Expert Advisor log.
Signature
void Print(argument, ...);
Parameters
argument: Any values separated by commas. Maximum of 64 parameters.Notes
double data type is displayed with up to 16 decimal digits, in traditional or scientific format for compactness.float data type is displayed with 5 digits after the decimal point.PrintFormat().bool data type is output as "true" or "false".TimeToString() for custom formats.color data type is output as R,G,B or a color name if available in the color set.Print() function is non-operational during optimization in the Strategy Tester.Related Functions
Alert()Comment()DoubleToString()StringFormat()PrintFormat()TimeToString()Example
void OnStart()
{
// Output DBL_MAX using Print()
Print("---- how DBL_MAX looks like ----");
Print("Print(DBL_MAX)=",DBL_MAX); // Output float precision comparison
float c = (float)M_PI;
Print("c=",c, " Pi=",M_PI, " (float)M_PI=",(float)M_PI);
// Real number arithmetic precision example
double a=7, b=200;
Print("---- Before arithmetic operations");
Print("a=",a," b=",b);
Print("Print(DoubleToString(b,16))=",DoubleToString(b,16));
a=a/b;
b=7.0/a;
Print("----- After arithmetic operations");
Print("Print(b)=",b);
Print("Print(DoubleToString(b,16))=",DoubleToString(b,16));
// Small value subtraction example
double epsilon = 1e-13;
Print("---- Create a very small value");
Print("epsilon=",epsilon);
b = b - epsilon;
Print("---- After subtracting epsilon from the b variable");
Print("Print(b)=",b);
Print("Print(DoubleToString(b,16))=",DoubleToString(b,16));
}