Noob help please SL and TS

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #232684 quote
    bob320
    Participant
    New

    Hi All,

    Im hoping someone can help a new starter in this field. Ive created a (very) basic auto trade system but it wont allow me to have both a Stop Loss and Trailing stop. Looking at other forum posts for a few hours I can see this is a common issue. Ive found some scripts created by other then enable this feature but dont understand how I can incorporate this into my own script?

    Appreciate this is a very cheeky ask, but would someone please amend my code so I have both a stop loss (20 points/pips) and a Trailing stop (5 points/pips) that I can run. Thanks in advance

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    
    // Conditions to enter long positions
    indicator1 = BollingerDown[17](close)
    c1 = (close CROSSES OVER indicator1)
    
    IF c1 THEN
    BUY 1 PERPOINT AT MARKET
    ENDIF
    
    // Conditions to exit long positions
    indicator2 = BollingerUp[17](close)
    c2 = (close CROSSES UNDER indicator2)
    
    IF c2 THEN
    SELL AT MARKET
    ENDIF
    
    // Stops and targets
    SET STOP pLOSS 20 pTRAILING 5
    #232694 quote
    JS
    Participant
    Senior

    Hi Bob,

    Try this…

    TimeFrame: 15 minuten

     

     

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
     
    // Conditions to enter long positions
    indicator1 = BollingerDown[17](close)
    c1 = (close CROSSES OVER indicator1)
     
    IF c1 THEN
    BUY 1 PERPOINT AT MARKET
    ENDIF
     
    // Conditions to exit long positions
    indicator2 = BollingerUp[17](close)
    c2 = (close CROSSES UNDER indicator2)
     
    IF c2 THEN
    SELL AT MARKET
    ENDIF
     
    // Stops and targets
    SET STOP pLOSS 30
    SET STOP PTRAILING 85
    #232797 quote
    DeathMetal
    Participant
    New

    BTW,
    your trail stop must be larger than your stop loss, otherwise only the trail stop works, so your position to be closed always ends up at your trail stop.

    #232805 quote
    bob320
    Participant
    New

    Ah, thank you both for the replies, think this is making more sense now.

    Thanks again!

    #232829 quote
    DeathMetal
    Participant
    New

    Hi JS,

    Does a trailingstop and a stoploss work together in your systems? Beacause I have found out, that it isn’t the case, see my post in the Pro order support.

    Thnx!

    #232830 quote
    JS
    Participant
    Senior

    Hi,

    I don’t use them together in my systems, I just use a “(custom) trailing stop” in IB…

    (I would make the “StopLoss” part of the TS myself…)

    DeathMetal thanked this post
    #232831 quote
    DeathMetal
    Participant
    New
    Ok, Thnx!
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

Noob help please SL and TS


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
bob320 @bob320 Participant
Summary

This topic contains 6 replies,
has 3 voices, and was last updated by DeathMetal
1 year, 8 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 05/15/2024
Status: Active
Attachments: 1 files
Logo Logo
Loading...