Moving a stop on Trade1 to breakeven when Trade2 is added

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

    Good morning,

    Any ideas how to write this?

    I would like to build, incrementally, a position in a market. Once a 2nd incremental unit is added, with a stop loss of $x, I would like to move the stop loss of the 1st unit, originally also $x, to breakeven

    Any ideas very much appreciated. Many thanks

    #10167 quote
    Nicolas
    Keymaster
    Master

    Yes, you can have directly access to the previous trade open price with TRADEPRICE.

    So, you need to place your orders exit at this price plus some distance to keep little profit:

    //example for long positions
    pointstokeep = 2 
    
    if countofposition>1 then 
     SELL AT TRADEPRICE(1)+pointstokeep*pipsize STOP
    endif
    

    Not tested but it should do the job. Also consider a spread between the last order and the placing of the stop order, for not triggering it too fast (10 points for example) :

    if countofposition>1 and close-TRADEPRICE(1)>10*pipsize then 
    #11610 quote
    smartinick
    Participant
    New

    Sorry for reusing this thread, but just a short question that’s fitting on this topping: afaik there’s no way to manage a stop for each single position…? so e.g. i open 5 positions, i can only set one stoploss that is valid for all positions, right…? (off course i can get the tradeprice for each position… but there’s nothing like “set stop(x)”, right?

    do you know if this feature will be coming in 10.3 or 10.4…? (as i’m stuck on IG’s 10.2…)

    Brgds, Martin.

    #11612 quote
    Nicolas
    Keymaster
    Master

    Nope. Each order on market aggregate in a whole big one. It’s called “position centric”.

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

Moving a stop on Trade1 to breakeven when Trade2 is added


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
merc1203 @merc1203 Participant
Summary

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

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