Hello,
Yesterday, doing backtest of a system with a combined stop of this type:
“SET STOP pLOSS x pTRAILING y: A stop loss is placed at x points from average position price and it
becomes a trailing stop of y points if the trailing stop level becomes closer to current price than the stop loss
level (this occurs price varies favorably by y points – x points).”
I understand that the logic of this order is to programm the “y”> “x”.
But I tried to optimise with “y” and “x” as a variables and I reach the best combination with a “y”<“x”.
As I understand, if I put the “y”<“x” it have to be the same if I put an order with only a trailing like: “SET STOP pTRAILING y”, because the trailing always be closer to the price than the fixed stop.
So I tried to reprogrammate the code only with the trailing order and the result are drasticaly different.
My question is:
- How a combined stop really works?
- Why is different an order like “SET STOP pLOSS 10 pTRAILING 5” than a “SET STOP pTRAILING 5”????
Sorry if my explanation is not the best, I know is a strange question and problem, but I really aprecciate if somebody can help me, is very important to me.
Thanks in advance.
SET STOP pLOSS x pTRAILING y is only available for backtesting, it can’t be used in autotrading, as it combines different types of SLs.
SET STOP pLOSS x pTRAILING y is only available for backtesting, it can’t be used in autotrading, as it combines different types of SLs.
Grazie mile Roberto, but how can I “translate it” to autotrading? I thought putting only the trailing was going to be the same but no, I need to know how the programm understands the combined order to tranlaste it to single code for AutoTrading.
You should only use SET STOP pLOSS x, then use a code snippet for the trailing stop.
You can find Nicolas’original code (lines 17-56) at https://www.prorealcode.com/blog/trading/complete-trailing-stop-code-function/.
You can find additional snippets (of any type) at https://docs.google.com/spreadsheets/d/1rgboqj7sVwsP9ZRhOduOefye48QMWC07jWVXCl-KJPU/edit#gid=0.