How combined STOPS work?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #189953 quote
    FermatikoFermatiko
    Participant
    New

    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.

    #189956 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    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.

    #189957 quote
    FermatikoFermatiko
    Participant
    New

    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.

    #189963 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    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.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

How combined STOPS work?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Fermatiko @fermatiko Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by robertogozzirobertogozzi
4 years, 6 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 03/14/2022
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...