SetProfitTarget()
Set a profit target to exit a trade in a profitable position.
This method can be used inside a strategy and which defines the difference in price of an asset which you bought in a particular trade. If the price increases by a specified amount, your strategy will automatically close the position.
Parameters
Name | Type | Description |
| double | Here, price defines the difference in price between when the strategy opened the position and the price at which the strategy will close the position to collect profit. |
| string | Optional parameter which can be used for labeling the signal generated by this method. Using labels can be useful in the process of developing and debugging your strategy. |
Within the strategy, you can define only one profit target. If you use SetProfitTarget()
more than once, the profit target value will be overwritten by your latest settings.
The browser app doesn't show the custom labels in the UI at the moment. It will be updated in the future release.
Example
Lets suppose that your strategy is trading BTC/USDT, assume your strategy bought BTC and you want to close the position once the price rises by 5 USDT. You can do so by setting the profit target method as follows:
Last updated