Trailing SL

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #39657 quote
    tob107
    Participant
    Average

    Hi,

    I bet this has been up a thousand times, but I can’t find anything when searching the forum, so I apologize for – probably – repeating the question.

    In a long position i EUR/USD, I’d like to set a TSL when profit is more than PSL. I’d like the TSL start 1 pip above the entry price. Let’s say that PSL is 20 pips, then I’d like a TSL of 19 pips. I realize there’s a difference if I use high[1] or close[1] and that in reality the TSL will be based on the difference between entry + 1 pip and the close of the previous candle.

    Am I totally lost for thinking this code should work?

    Thanks in advance!

     

    IF LongOnMarket AND high[1] > (positionPrice + PSL) THEN
    SET STOP pTRAILING -1
    ENDIF
    #39683 quote
    Nicolas
    Keymaster
    Master

    It will not work. You must define a size in points with pTRAILING keyword.

    #39743 quote
    tob107
    Participant
    Average

    Alright, thanks. Points from entry, right? Isn’t that then related to the current price?

    Is it possible to use negative numbers?

    #39770 quote
    Nicolas
    Keymaster
    Master

    Points from opening price, right, and a positive one.

    #39771 quote
    tob107
    Participant
    Average

    So what happends if I use a 20 pip trailing stop from entry, but the price is, say, 100 pip in profit? Isn’t that a 120 pip trailing stop then? As opposed to if the trade is 10 pip in profit, and the trailing stop would be only 30 pips?

    Can you tell me how to put a trailing stop from break even when I’m in profit?

    #39772 quote
    Nicolas
    Keymaster
    Master

    To be clear, if you code “SET STOP pTRAILING 20″, the stoploss will move of 20 points each time the price has moved favorably of the same amount of points. That’s how it operates with IG / PRT-CFD with each individual order.

    There are many trailing stop & breakeven codes snippets in the blog and in the library already, I think you’ll find them easily 🙂

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

Trailing SL


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 5 replies,
has 2 voices, and was last updated by Nicolas
8 years, 8 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 07/03/2017
Status: Active
Attachments: No files
Logo Logo
Loading...