+1 888 340 6572

BEGINCMTRY

From MultiCharts

The statements between this compiler directive and the reserved word #End are evaluated only when the tool is used to select a bar on a chart or a cell in a grid. The reserved word #End must be used with this reserved word.

Usage

#BeginCmtry
Commentary("The indicator value here is " + NumtoStr(Plot1, 2));
#End;

Notes

  • All statements between the #BeginCmtry and #End are ignored, including calculation of MaxBarsBack, unless commentary is generated.

Example

An indicator that calculates the 10-bar momentum of the closing price needs ten bars in order to start plotting results. If commentary is added to this indicator and the commentary uses a 50-bar average of the volume, then the MaxBarsBack setting is increased to fifty. However, the 50-bar average is only used for the commentary, so there is no need to have the indicator wait fifty bars before giving results unless Commentary is requested.

To have the indicator plot after 10 bars and ignore the 50-bar requirement, the indicator can be written as follows:

Plot1( Close - Close[10], "Momentum");

#BeginCmtry;
 If Close - Close[10] > 0 Then
  Commentary("Momentum is positive, ")
 Else
  Commentary("Momentum is negative, ");
 If Volume > Average(Volume, 50) Then
  Commentary(" and volume is greater than average.") 
 Else
  Commentary(" and volume is lower than average.");
#End;

This indicator plots the momentum and the commentary states whether the momentum is positive or negative, and if the volume is over or under the 50-bar average of the volume. When the indicator is applied without using commentary, it will require only 10 bars to start calculating. When commentary is requested, the indicator is recalculated, the statements within the compiler directives are evaluated, and the new minimum number of bars required is 50. Any series functions within these reserved words are also ignored.