SET STOP pLOSS x pTRAILING y

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #108906 quote
    sulimaster
    Participant
    Average

    I want to understand better how pLOSS 200 becomes pTRAILING 30. Say my average position price is 500 (buy / long) with pLOSS 200 and pTRAILING 30. If I use both the stops together, can you please explain to me at what current price pLOSS 200 will become pTRAILING 30?

    Your definition in the manual is:

    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 become closer to current price than the stop loss level (this occurs price varies favorably by y points – x points)

    I’m assuming this means y points minus x points. In my example 30 minus 200 = -170

    #108909 quote
    Nicolas
    Keymaster
    Master

    While the instruction “SET STOP pLOSS x pTRAILING y” is working in backtests, it cannot be used in a live trading environment.

    If you want to use a fixed STOP LOSS + a trailing stop, you should do the following:

    Set a fixed stop loss in your code with:

    SET STOP pLOSS 100 // 100 points SL

    For a trailing stop, use of the following codes snippets below (there are many other ones in forums and library):

    Complete trailing stop code function

    Trailing stop with the Max Favorable Excursion (MFE)

    useful link with many codes: https://docs.google.com/spreadsheets/d/1rgboqj7sVwsP9ZRhOduOefye48QMWC07jWVXCl-KJPU/edit#gid=0

    sulimaster thanked this post
    #109190 quote
    sulimaster
    Participant
    Average

    Thanks Nicholas

    SET STOP pTRAILING x

    Does above trailing stop code automatically reject any worse stop positions even if x is not set as a hard number but is set as a variable based on say value of ATR at previous close? So the stop level can only get better not worse as price and ATR (previous close) fluctuate over time?

    I want my initial stop to be 1.5 * ATR (previous close) e.g. = 200 points, when new candlestick opens and I enter into a position. However, I don’t want the trailing stop to remain 200 points away from current price. I want it to change as the ATR (previous close) changes when new candlesticks open but only if it becomes less than 200. So will it retain the key trailing stop function where the stop level changes favourably only as price fluctuates but also change favourably only the stop distance from the current price level as ATR (previous close) fluctuates?

    I hope it does and I don’t have to code it.

    #109228 quote
    Nicolas
    Keymaster
    Master

    You can embed the instruction into a condition.

    But you should use pending stop order for your moving stop.

    When you set the order, put a pending stop order at close-1.5 * ATR (for a long order)

    Then, each time the price move favorably, use the new level for that stop order. But you’ll have to put the pending order continuously as long as your long order is on market.

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

SET STOP pLOSS x pTRAILING y


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
sulimaster @sulimaster Participant
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 09/30/2019
Status: Active
Attachments: No files
Logo Logo
Loading...