which positions are exited first?

Forums ProRealTime English forum ProOrder support which positions are exited first?

Viewing 15 posts - 1 through 15 (of 19 total)
  • #176739

    Hi all,

    I havent found the answer to a possibly stupid question here. I’ll try to explain, grateful for any help. the answer is very likely quite simple.

     

    I am creating some algos that cumulates positions (“scaling in/out”).

    Let’s assume:

    1. I issue a buy order for 1 contract (go long) first at price 50, then 1 at price 60, then 1 more at price 70.
    2. Next the price reaches 75, and I want the algo to exit 1 position to take a partial loss, and issue for example “exitshort 1 contracts at market” or similar.

    But which position is then exited? If it is the middle position my average entry price will be 60, if it is the first one (with the greatest latent loss) it will be 65, and if the most recent one (with the smalles latent loss) it will be 55. This has important implications for the strategies possible with the algo.

    I suppose I could test it live in demo and try to watch it in real time to find the answer, but hopefully someone here has more detailed information or references to point me to!

    grateful for any help

    thanks in advance

     

     

    #176740

    First in First out is the method used, as far as I know.

     

    #176743
    JS

    When you go LONG at 1@50, 1@60, 1@70 then your average entry price is 3@60.

    You want to SELL (not ExitShort) because you are LONG (it is Buy versus Sell and SellShort versus ExitShort).

    SELL 1@75 and take a partial WIN (not Loss), this action will Sell 1 contract at the average price of 60 (partial win = 75 – 60  = 15)

     

     

     

    #176746

    thanks for the clarification. then it is fairly simple, if that is the case, that it is base on time, when the position was entered. and very easy to achieve what I want, although I in principle would want to exit the position with the largest latent loss, but the first position entered is probably workable. thanks.

    #176747

    JS, I am very sorry for my confusing post! I dont know what happened to may brain there ….

    anyway, ofcourse you are right, I actually intended to write sellshort and the exitshort, so that it would be a loss.

    However, your reply is interesting because it is implying that the original positions entry price do not matter in automatic trading in proorder? but rather it is all made into an average? (unlike in manual trading, where it certainly is not, although there is, ofcourse, an average, and your average opening price matters for your success ofcourse).

    but if that is so, that is a quite interesting limitation of proorder, no?

    or maybe I am just being stupid and my brain playing tricks on me again.

    #176748
    JS

    ???????

    #176749

    hm. sorry but i cannot guess which part of my latest post it is that was not understandable.

    maybe all of it.

    but as I interpret this, both your reply and that of @roberttogozzi cannot be true at the same time…?

    I have been searching the documentation but cannot find anything on this topic. maybe I am not looking in the right place.

     

    #176750

    An average price * traded lots  is calculated, but when you want to close one position, which one ProOrder would tell  IG to close?

    It’s FIFO.

     

    1 user thanked author for this post.
    #176751
    JS

    The difference with manual trading is that you can close manual a certain trade, so you can manual close for example 1@50 or 1@60 or 1@70.

    You can do this also with auto trading but then you must program it in your algorithm, so you can close the first, middle or last trade but then you must specify this in your program.

    When you don’t specify this in your algorithm and just “Sell 1 contract at market” then the program will Sell 1 contact at average price.

    (“Sell at market” will Sell all the 3 contract at 60)

    The remaining (first two) contracts will form a new average price.

    #176752
    JS

    Or according to Roberto the remaining last two contracts will form a new average price.

    #176753

    You can’t choose which one position is to be closed, just the number of lots to be closed.

    IG don’t  know about average prices, they only assign an ID to each opened position. It’s ProOrder which needs an algorithm to keep track of them. It doesn’t sell at an average price, but at the current or selected price, then it updates the average price only to set PositionPerf, SL and TP.

     

    1 user thanked author for this post.
    #176756
    JS

    @robertogozzi

    Open Long positions 1@50 + 1@60 + 1@70

    Then Close 1 contract at market (Market price = 75)

    Which contract will be sold for what price?

    Which contracts are still open after the sell of 1 position?

    #176757
    JS

    According to ProBacktest:

    Buy 1@732,48

    Buy 1@742,58

    Sell 1@762,57

    Buy 1@772,59

    Sell 1@793,59

    Profit first Sell 1@762,57:     762,57 – (732,48 + 742,58)/2 = 25,04 x 40 = 1001,60

    Profit second Sell 1@793,59:    793,59 – (737,53 + 772,59)/2 = 38,53 x 40 = 1541,2 (rounding error?)

    #176760

    Profit second Sell 1@793,59:    793,59 – 742,58 = 51,01 x 40 = 2040,4

     

    #176761
    JS

    According to ProBacktest the profit of the second sell is: 1526 ????

     

Viewing 15 posts - 1 through 15 (of 19 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login