ShowLongStop (Function)
The ShowLongStop function adds text to a chart that displays the stop level on the chart for a long-side stop. This function is designed for use only with strategies.
Syntax
ShowLongStop(StopVal)
Returns (Integer)
In addition to displaying "Stop--", the function itself returns a numeric value representing the current market position (-1 for short, 1 for long, and 0 for no position).
Parameters
|
Name |
Type |
Description |
|
StopVal |
Numeric |
Sets the stop value where the text will be displayed. |
Remarks
The function adds the text "Stop--". If the stop value is beyond the upper/lower limit of the chart, the text will not appear unless the chart scaling is adjusted to include that area. In addition, the function returns the current market position that is assigned to a variable.
Example
Will display the "Stop--" at the lowest Low of the last two bars while the market position is long:
Value1 = ShowLongStop(Lowest(Low, 2));
Additional Example
If you wanted to show the stop text for a long trailing stop, you could use the following:
Variables: StopValue(0);
If Close Crosses Above Average(Close, 18) Then
Buy This Bar on Close;
StopValue = Lowest(Low, 2);
If MarketPosition = 1 Then
Sell Next Bar at StopValue Stop;
Value1 = ShowLongStop(StopValue);