How To use Trailing function and own coded SL

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #162773 quote
    ScalpTraderScalpTrader
    Participant
    Junior
    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)
    #162774 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Replace line 15 with:

    SET STOP pLOSS 50
    #162775 quote
    ScalpTraderScalpTrader
    Participant
    Junior

    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

    #162791 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    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.

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 To use Trailing function and own coded SL


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 02/28/2021
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...