Bug with Limit pending orders when partially close position

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #207651 quote
    LucasBest
    Participant
    Average

    Hello,

    I was trying to code a Management strategy for my Bot and noticed that there is a bug with Limit pending orders when partially close position.

    If i use Sell mypartialclosesize at market it work, but if i try to use Sell mypartialclosesize at mylimit Limit, it does not work.

    It can work sometimes with Limit pending orders when partially close position though : for that you need to enter a position with more than one order, and then when you will try to close partially the position, Limit pending orders allows only to close partially the first opened position… Not sure if i am clear here 🙂

    For example, if my bot buy 10 shares with one order only, and try to close partially the position with Limit pending orders, it does not work (i had to use at market pending orders to do so)
    If my bot buy 10 shares with 2 or more orders (for example, it buy 2 shares, then 3 shares, then 5 shares), then it is possible to close partially the position with Limit pending orders, but not the whole position : only the part of the position that is not the last buy order (in my exemple, the last 5 shares are not partially closeable with Limit pending orders).

    Srange ? Have you notice same thing ?
    I think this bug ex^plane several issues like this that have found no solution :

    Vente partielle de contrat sur indice

    #207656 quote
    robertogozzi
    Moderator
    Master

    Pending orders cannot partially close positions. Only market orders can.

    #207658 quote
    LucasBest
    Participant
    Average

    Hello Roberto,

    They do, only if you enter the position with more than one order.

    This don’t work :
    Buy 2 shares at x limit or Buy 2 shares at market, can’t be partially closed by Pending Limit orders

    This work :
    Buy 1 share at x limit
    Buy 3 share at market
    then
    Sell 1 Share at x+10 limit => this works because it does not try to close the last buy order

    This does not work :
    Buy 1 share at x limit
    Buy 3 share at market
    Sell 2 Share at x+10 limit => this does not work because it is impossible to close partilly the partilly the last buy order with pending orders…

    Strange ?

    #207720 quote
    Nicolas
    Keymaster
    Master

    They do only in backtests, not possible through ProOrder. Sorry if there are misleading codes here and there in the forums that embed pending orders that close partially positions.

    LucasBest thanked this post
    #207740 quote
    LucasBest
    Participant
    Average

    Ok. Thank you for the precision… Good to know sooner! 🙂
    I will change the code and try with MTF to stick with the limits i want…

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

Bug with Limit pending orders when partially close position


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
LucasBest @lucasbest Participant
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by LucasBest
3 years, 1 month ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 01/18/2023
Status: Active
Attachments: No files
Logo Logo
Loading...