Open two positions simultaneously with different SL

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #157323 quote
    Mikael KMikael K
    Participant
    Junior

    Hi guys,

    short question. Is it possible to open two different positions simultaneously, both with 20 pip limit but one with 10 pip sl and the other with 20 pip sl?

     

    Sincerely

    /Mikael

    #157336 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    No, because every time you execute SET STOP LOSS and SET TARGET PROFIT, all open positions will be updated to the new value.

    You can do it yourself by keeping track of  positions entered and using pending STOP orders to manage their SL.

    #157374 quote
    MonobrowMonobrow
    Participant
    Senior

    No, because every time you execute SET STOP LOSS and SET TARGET PROFIT, all open positions will be updated to the new value.

    Yes…. but I faced a problem at the weekend similar to this and used:

    If not onmarket then
    Set stop/profit etc
    End if

    And it did the job for me!

    that wont solve opening 2 different stops, but it did stop my profits and stops updating every bar. Perhaps theres something clever someone can do with variables and once statements? Not sure

    #157379 quote
    VonasiVonasi
    Moderator
    Master

    Not tested:

    //Get more accurate entry price once on market in case there was a gap
    if onmarket and not onmarket[1] then
    if countofposition = 2 then 
    entryprice = tradeprice
    endif
    if countofposition = 1 then 
    entryprice = tradeprice[2]
    endif
    endif
    
    //Pending orders for two positions open
    if onmarket and countofposition = 2 then
    sell at entryprice + 20 limit
    sell 1 contract at entryprice - 10 stop
    sell 1 contract at entryprice - 20 stop
    endif
    
    //Pending orders for one position open
    if onmarket and countofposition = 1 then
    sell at entryprice + 20 limit
    sell 1 contract at entryprice - 20 stop
    endif
    
    //Enter market and place pending orders for two positions
    if not onmarket and (your entry conditions) then
    buy 2 contracts at market
    sell at close + 20 limit
    sell 1 contract at close - 10 stop
    sell 1 contract at close - 20 stop
    endif
    
    robertogozzi and Monobrow thanked this post
    #157765 quote
    NicolasNicolas
    Keymaster
    Legend

    Is it possible to open two different positions simultaneously, both with 20 pip limit but one with 10 pip sl and the other with 20 pip sl?

    Yes with partial closure of position.

Viewing 5 posts - 1 through 5 (of 5 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

Open two positions simultaneously with different SL


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Mikael K @mikael-k Participant
Summary

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

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