Im looking for a combined function of STOP LOSS x and TRAILING y
As I understand you can use that combo in Backtest but not in Auto Trading.
I’ve read around in the forum and found several ways to “hard code”/own script code the TRAILING function and for ex. combine it with the STOP LOSS x command line.
Im looking for the reversal.
To use the SET STOP TRAILING and then set a coded SL
Example
// Conditions to enter long positions
c1 = (close > close[1])
IF c1 THEN
BUY 1 CONTRACT AT MARKET
ENDIF
// Stops and targets
SET STOP TRAILING 6
//Own coded SL command
XXXX
What code could I use?
Would like the SL to be X points bellow tradeprice
(trading index)
The basic Ide, as you probably understand, is too safe up the trade; so if after enter the trade goes down bellow SL sell. If that dosnt happends use TRAILING and follow the trade in favor direction (to exit after turnaround)
Thanks for the reply.
But using that line 15 will “overwrite” line 11 making line 11 obsolete.
Im looking for a code to add on line 15 for a SL to run together with TRAILING
After replacing line 15, replace also line 11 with lines 17 through 56 of the code snippet at https://www.prorealcode.com/blog/trading/complete-trailing-stop-code-function/.
that will act as a trailing stop.