Using the BreakPoint Keyword

The EasyLanguage Debugger opens automatically when the BreakPoint keyword is encountered in a study or function while the EasyLanguage code is being executed.

Each occurrence of the BreakPoint keyword is assigned a name to allow the user to more easily identify which specific breakpoint caused the Debugger to pause. The name is specified as a string parameter, following the keyword, using the form: BreakPoint ("MyBreakName"). A string variable can also be used as the name or in combination with a literal string value such as: BreakPoint( "Break ID" + GetSymbolName.

The following example calculates and plots a moving average line. The placement of the BreakPoint keyword within the summation loop allows you to see how the value of the Sum changes with every iteration. The second occurrence of BreakPoint allows you to see the value of the AvgVal variable after the average is calculated.

 You can use the EasyLanguage Debugger and the BreakPoint reserved word in RadarScreen studies also. The EasyLanguage Debugger will be displayed for each symbol in the RadarScreen window. For more information, see EasyLanguage Debugger.

Input: Length(9);

Variables: Counter(0), Sum(0), AvgVal(0);

 

Sum = 0;

For Counter = 0 to Length -1 Begin

    Sum = Sum + Close[Counter];

    BreakPoint("Sum");

End;

 

AvgVal = Sum / Length;

BreakPoint("AvgVal");

 

Plot1(AvgVal);