iOS & macOS Charting Documentation - SciChart iOS & macOS Charts SDK v4.x
The SCIStopLossTakeProfitAnnotation
The SCIStopLossTakeProfitAnnotation is a trade planning tool placed on the chart using two anchor points, which marks the zone between an entry level and a target level. It is commonly used to visualize a planned trade’s risk and reward before it is placed.

NOTE: Examples of the
Annotationsusage can be found in the SciChart iOS Examples Suite as well as on GitHub:
- Trading Annotations - Obj-C/Swift
NOTE: To learn more about Annotations in general - please see the Common Annotation Features article.
Structure and Points
The SCIStopLossTakeProfitAnnotation is defined by two base points, added sequentially using the setBasePointWithX(:y) method:
- Point 0: The entry level of the planned trade
- Point 1: The target level of the planned trade
Behavior
- The zone between the two points is bounded by two level lines, one at each anchor point.
- The styling used depends on the relative position of the second point:
- If the second point is above the first, the zone is coloured as a take profit, using
takeProfitStrokeandtakeProfitFill. - If the second point is below the first, the zone is coloured as a stop loss, using
stopLossStrokeandstopLossFill.
- If the second point is above the first, the zone is coloured as a take profit, using
- When
showAxisLabelsis enabled, price badges are drawn on the Y-Axis for the two levels, and badges are drawn on the X-Axis at the two anchor points. A band is also filled between the Y-Axis badges, with opacity controlled byaxisSpanFillOpacity. - Additional point or segment labels can be drawn via the
labelsproperty, with their text optionally overridden dynamically viaformatLabel.
The SCIStopLossTakeProfitAnnotation can be configured using the properties listed in the table below:
| Field | Description |
|---|---|
SCIStopLossTakeProfitAnnotation.takeProfitStroke |
The SCIPenStyle used for the level lines when the second point is above the first. |
SCIStopLossTakeProfitAnnotation.takeProfitFill |
The SCIBrushStyle used to fill the zone when the second point is above the first. |
SCIStopLossTakeProfitAnnotation.stopLossStroke |
The SCIPenStyle used for the level lines when the second point is below the first. |
SCIStopLossTakeProfitAnnotation.stopLossFill |
The SCIBrushStyle used to fill the zone when the second point is below the first. |
SCIStopLossTakeProfitAnnotation.showAxisLabels |
Determines whether axis labels are shown - price badges on the Y-Axis for the two levels, and badges on the X-Axis at the two anchor points. |
SCIStopLossTakeProfitAnnotation.axisSpanFillOpacity |
The opacity of the band filled on the axes between the two axis labels. Set to 0 to hide the band. Defaults to 0.2. |
SCIStopLossTakeProfitAnnotation.labels |
The labels drawn by this annotation. Empty by default, in which case no point or segment labels are drawn. Axis-anchored labels with an X or Both draw mode add badges on the X-Axis; the Y-Axis badges are always derived from the two levels and are governed by showAxisLabels instead. |
SCIStopLossTakeProfitAnnotation.formatLabel |
A block which supplies the complete text of each label, re-evaluated whenever the annotation changes. Takes precedence over SCIMultiPointLabel.text. Returning nil, an empty, or a whitespace-only string falls back to that text; when neither yields text the label is not drawn. |
Define Points
Points are added sequentially using [annotation setBasePointWithX: y:];. Each call adds the next point in order (Point 0 → Point 1).
The annotation is fully formed once both points are provided.
NOTE: The xAxisId and yAxisId must be supplied if you have axis with non-default Axis Ids, e.g. in multi-axis scenario.
Create a StopLossTakeProfitAnnotation
A SCIStopLossTakeProfitAnnotation can be added onto a chart using the following code:
NOTE: For interactive creation of SCIStopLossTakeProfitAnnotation, use the corresponding annotation creation modifier SCIStopLossTakeProfitCreationModifier available in SciChart iOS.
NOTE: To learn more about other Annotation Types, available out of the box in SciChart, please find the comprehensive list in the Annotation APIs article.
View on GitHub