iOS & macOS Charting Documentation - SciChart iOS & macOS Charts SDK v4.x
SCIStopLossTakeProfitCreationModifier
The SCIStopLossTakeProfitCreationModifier is a custom gesture modifier used for interactive creation of Stop Loss / Take Profit annotations on a SciChart surface.
It enables users to place two key points (Start → End) using touch gestures, with real-time visual feedback during placement. Style properties set on the modifier (takeProfitStroke, takeProfitFill, stopLossStroke, stopLossFill, showAxisLabels, axisSpanFillOpacity, labels, and formatLabel) are applied to the annotation as it is created, with the take-profit or stop-loss style pair chosen automatically depending on the direction between the two points.
Overview
The modifier handles the full lifecycle of Stop Loss / Take Profit annotation creation:
- Sequential point placement via touch interaction
- Real-time dragging feedback for each point
- Automatic take-profit/stop-loss style selection based on the direction of the second point relative to the first
- Optional axis labels and a filled band on the X and Y axes spanning between the two points
- Automatic completion after the final point (End)
- Immediate reset for continuous drawing
Once completed, the annotation remains on the chart and a callback is triggered.
Interaction Behavior
The creation flow follows a structured sequence:
Per Point Interaction (Start → End)
| Gesture | Behavior |
|---|---|
| Touch Down | Places the current point at the touch location |
| Drag | Moves the point dynamically in real-time |
| Touch Up | Locks the point and advances to the next one |
Completion
- After placing the End point, the annotation is finalized
- The direction between Start and End is resolved: if End is above Start,
takeProfitStroke/takeProfitFillare applied; if End is below Start,stopLossStroke/stopLossFillare applied - If
showAxisLabelsis enabled, labels for both points are drawn on the X and Y axes, withaxisSpanFillOpacityapplied to the band between them - Each entry in
labelshas its text populated via theformatLabelblock - The
annotationCreationCompletionListenercallback is invoked - The modifier resets immediately, ready for a new annotation

Retrieving Annotation Points After Drawing Completion
After an annotation drawing is completed, you can retrieve its underlying points using:
-[ISCITradingAnnotation getBaseDataValues]
-[ISCITradingAnnotation getBasePoints]
Both methods return the annotation’s defining points, but in different coordinate spaces.
-[ISCITradingAnnotation getBaseDataValues]
- X and Y values correspond to the chart’s actual data coordinates
- Independent of pixel resolution or screen scaling
- Useful for storing, analysis, or reloading annotations
-[ISCITradingAnnotation getBasePoints]
- X and Y values correspond to screen pixels
- Useful for rendering overlays or UI alignment
Usage Example
The SCIStopLossTakeProfitCreationModifier can be configured using the properties listed in the table below:
| Field | Description |
|---|---|
SCIStopLossTakeProfitCreationModifier.takeProfitStroke |
Defines the SCIPenStyle used for the level lines when the second point is above the first. |
SCIStopLossTakeProfitCreationModifier.takeProfitFill |
Defines the SCIBrushStyle used to fill the zone when the second point is above the first. |
SCIStopLossTakeProfitCreationModifier.stopLossStroke |
Defines the SCIPenStyle used for the level lines when the second point is below the first. |
SCIStopLossTakeProfitCreationModifier.stopLossFill |
Defines the SCIBrushStyle used to fill the zone when the second point is below the first. |
SCIStopLossTakeProfitCreationModifier.showAxisLabels |
Determines whether axis labels are shown on both the X and Y axes. |
SCIStopLossTakeProfitCreationModifier.axisSpanFillOpacity |
Defines the opacity of the band filled on the axes between the two axis labels. |
SCIStopLossTakeProfitCreationModifier.labels |
Defines the labels applied to each new annotation. |
fSCIStopLossTakeProfitCreationModifier.ormatLabel |
Defines the block which supplies the complete text of each label. |
NOTE: The xAxisId and yAxisId must be supplied if you have axis with non-default Axis Ids, e.g. in multi-axis scenario.
Best Practices
- Pair
takeProfitStroke/takeProfitFillandstopLossStroke/stopLossFillwith clearly distinct colours (e.g. green vs red) so risk and reward zones are identifiable at a glance - Use a dashed
strokeDashArrayon the level lines to visually distinguish them from solid trend or measure lines - Enable
showAxisLabelswith a moderateaxisSpanFillOpacityso the price band reads clearly directly on the axis - Use
formatLabelto surface distance, pip count, or risk-reward ratio alongside each entry inlabels - Disable conflicting gesture modifiers during drawing for better UX
- Use the CompletionListener to validate or store annotations
- Call reset when switching tools or exiting drawing mode
Notes
- The modifier automatically resets after completing the End point
- Direction (take profit vs stop loss) is resolved by comparing the Y value of the End point to the Start point
- Only one annotation is created per interaction cycle
- Designed for marking risk/reward zones relative to an entry price on financial charts
View on GitHub