The rules for setting take-profit orders. Similar to stop-loss logic, take-profit logic determines at what price to automatically close a winning trade. This could be a fixed profit target (e.g. 2:1 reward:risk), a trailing take-profit, or other exit algorithms. In NinjaScript, SetProfitTarget()
works in tandem with SetStopLoss()
.
-
Definition: Rules for the profit exit. E.g. “exit with a 100-pip profit” or “close half position at 1:1 RR and rest at 2:1”.
-
Context: Implemented by specifying a profit target price or sending a limit order. In MQL, provide the TP price to
OrderSend()
. In cAlgo, providetakeProfitPips
. In NinjaScript, useSetProfitTarget()
. -
Example (MQL4):
-
Example (cAlgo):
-
Example (NinjaScript):