Question about multiple entries stop/profit

Forums ProRealTime English forum ProOrder support Question about multiple entries stop/profit

Viewing 11 posts - 1 through 11 (of 11 total)
  • #197008

    Hi,

    I haven´t used acumulated positions so far and wondering now how the standard stop/profit (SET STOP LOSS…) work with multiple positions. Does it close the positions one by one when each one reach its stop/profit, does it close all them at the same time or how?

    Thanks in advance

    #197010

    Hi – All at the same time, based on your target and the average gain/loss of the accumulated positions.
    But you can sell individual positions just the same (similar to how you buy them underway).

    1 user thanked author for this post.
    #197012

    How can I set separate stop/profit for each position?

    Cheers

    #197013

    Maybe my English was not clear enough : you can’t. You can only have one Set Stop Loss and/or Set Target Profit command active.

    What I further tried to say was :

    Supposed you bought 10, later another 2 and again later another 5 positions, then at some stage you can sell 8, later 5, later 1 and later the remainder (3 if I counted right). So you can exit at the prices/profits (or losses) you like. But you must yourself keep track of the current “gains” for the positions to sell. Thus if you want to get rid of those first 8, it is you yourself who has determined that selling those 8 will give you the profit of x you want.
    The PositionPerf “constant” will play a crucial role here.

    Just play (backtest) a bit with it, and you will get the hang of it.

    1 user thanked author for this post.
    #197041

    Thanks Peter,

    So I seem to understand that I cannot exit each entry, and only that entry, independently, each with its own stop/profit. But instead I have to create independent exits, no related to the entries, and based in the PositionPerf. Is that rigtht?

     

    #197042

    When partially closing a position the FIFO (First In, First Out)  rule is applied.

     

    1 user thanked author for this post.
    #197066

    instead I have to create independent exits, no related to the entries, and based in the PositionPerf. Is that rigtht?

    That is right. But the calculation of what would be your profit hence what would be your target for exiting (read : your reason for exiting at a particular price) is really a challenge.
    Like Roberto just said : it is based on FiFo which make my examples even too complicated (like buying 10 and selling 8, etc.). I think it would be best to work with percentages, because PRT can do that too and you can work out a scheme with that unrelated to prices. Still it would be cumbersome to do it.

    Point is – and focus should be at : when you sold a certain amount of position and you plan to sell more at x % of profit, what is actually accumulated in PositionPerf at the moment you observe it (in your program code) ?
    I personally gave up on that – not because it can’t be done, but because it can’t be properly backtested. The results from a backtest show different than what Live does. Just watch for the 0-length bar trades in backtest and the equal profit for each of the “sub trades”, registered when the last position is exited. In reality (Live) it does not go like that and with that your profits are very different too.

    1 user thanked author for this post.
    #198456

    Hi, i’ve tried to sort this out myself based on setting up different trailing, so this is what i am doping (not sure if works?).

    My reasoning is it takes TradePrice[1] to be the last trade price, if open or closed, so if a 2nd trade was opened then the first trade is TradePrice[2] if no closes occurred. But if say 1 position close did occur, then the open price of the first trade is then TradePrice[3] etc… thats why i have put in place the flags that keep track and reset when condition isnt so to null/stop one trailing and start the next.

    Note i only ever open up to 2nd accumulative, and don’t reopen any until the entire position is closed. As such for the last (aka after one trade was closed, and thus one only open) then i can use positionprice as it would be taking the price of the remaining trade and thus trailing would be correctly following that still. Also if you want to say reopen a 2nd, etc.. after it was closed, then you could reset the flags after a position closed, aka if back to 1 then flag reset, then trailing restarts to the first (use positionprice), and then when 2nd trade reopened then that would be the last TradePrice[1] again.

    If you want to do 3 or 4 or more accumulative, then you just keep repeating with more flags and more settings on more positions following the same approach (many lines and time consuming though).

    This is my reasoning, i am using this myself, ? unsure if as such it is working as suggested, but it does close positions and often has 2 stop-lose orders in place on my IG account when i look which appear to match my conditions. I also do use this same reasoning with “Breakevens”, and i also do see them correctly placed at positions with each subsequent trade when i check my account. I have had some issues in past where it appeared my phone was notifying me non stop of changes to the stop-lose orders: as appeared close one bar it read one and then read the other, some bug loop occurring, but i think i have sorted those out  after i added in the CountOfPositions and Flags ?

    Let me know thoughts ?

     

    2 users thanked author for this post.
    #198457

    Sorry was typing away with out checking above, a mistake at Line 81 and 82, should of been tradeprice[1] and not positionprice

     

    #198458

    Let me know thoughts ?

    Hey … I did not check the code contentually, but hats of already for the attempt.
    I think you (at least theoretically) covered for the pitfalls around TradePrice. Looks good !

     

     

    Sorry was typing away with out checking above, a mistake at Line 81 and 82, should of been tradeprice[1] and not positionprice

    Same for lines 111/112 I’d say.

    If I were you, I would add nice graphing of everything, so in forward testing you could see in real time whether your trailing etc. works as intended (otherwise it will always remain guessing). Make all graph 100% exactly as it will happen in reality (check with Live (could be Demo-Live)). Never think that can’t be done, because I can do it too (99% live-resemblance). Below is a teaser. 2nd is a zoom, showing that the horizontal line exactly matches the exit which later happens (that line exists in advance). Notice that this line trails (upwards for this Long), hence *is* the trailing. See the pink little triangle. Compare with the red triangle which is reality and which only tells that the filling happened at a slightly different price in forward-backtest than in Live.

    Man, would I be your teacher then I would be proud of what you achieved (and that you even dared starting it). 🙂

    1 user thanked author for this post.
    #198530

    Same for lines 111/112 I’d say.

    Hi, for line 111/112,. I should be able to use positionprice as in my example i have only 2 accumulated positions before that so that function starts after one of the stop-loses was meet, so i am back to only one position open only > so positionprice would work easiest in this example. HOWEVER YES if you have 3 or more accumulated positions, then that would just be one closed (aka 2 still open), so i would need to be using tradeprice[3] etc. depending on what flag is active, aka what position was closed and what position that is trailing still. In my example of 2 trades open and then 1 trade closed = it’s tradeprice[3] in my example because trade 1 = open, trade 2 = 2nd trade open, trade 3 = trade 3 closed if the trade 1 is the one still open [price of that trades open was thus 3 trades back]. Would need add an extra trailing and extra flag too, as need a seperate function starts for if 1st trade was closed and seperate function for if it was the 2nd trade that was closed.

    Thanks for your suggestion, i will graph it which make it easier to see if indeed it does respond correctly.

     

     

Viewing 11 posts - 1 through 11 (of 11 total)

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