Retrieve number of pending orders

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #213421 quote
    SimLH
    Participant
    New

    Hi,

    Is there any system variable to retrieve the current number of pending orders?

    #213453 quote
    robertogozzi
    Moderator
    Master

    No, it’s not possible,

    But you can easily calculate them yourself, just tally any pending order you place,  buy or sellshort, that’s all.

    As pending orders are all automatically cancelled each candle, you simply restart tallying them each time.

    #213455 quote
    SimLH
    Participant
    New

    Hi <span class=”bbp-author-name”>robertogozzi</span>,

    Can I append new orders to the existing ones that were created in the last candle instead of cancelling all the orders and recreating after each candle?

    #213462 quote
    robertogozzi
    Moderator
    Master

    ALL pending orders are automatically cancelled each new candle.

    If you still need them the next candle you need to place them again.

    So, if you place 3 pending orders and want to add 1 more later, then next candle you will have to place 4 pending orders, the prior 3 orders + a new one.

    So you do not need to keep a tally to be incremented each time. You simply restart counting from zero each candle, as there are no past orders left pending.

    #213464 quote
    SimLH
    Participant
    New

    Hi <span class=”bbp-author-name”>robertogozzi</span>

    I tested it before on 1 second timeframe, as I have both buy limit and buy stop orders set, during price spikes, sometimes a sell order is sent instead causing me to realize losses. Is this a known issue or bug?

    #213465 quote
    robertogozzi
    Moderator
    Master

    Why a bug?

    Pending orders are placed to be triggered when a price is reached.

    If it is triggered it’s not a bug, it’s what they have to do.

    Returning a loss instead of a profit is not due to being a pending or at market order, but why it has been placed at the wrong time.

    #213526 quote
    SimLH
    Participant
    New

    Hi <span class=”bbp-author-name”>robertogozzi</span>,

    The bug probably lies in the part when the target is set. In IG, you can create an order with target directly but in prorealtime it sends orders without targets. The target is only set when the order is processed.

    In my code, there are no stop losses but I have encountered instances when during spikes, the order is triggered and in the next instance, it took a stop loss. So it really puzzles me that it took a loss when my code only sets targets.

    #213558 quote
    robertogozzi
    Moderator
    Master

    I have never experienced such issues. It might be due to GUARANTEED stops or to some LIMITED account types that require a stop loss, but I have no clue.

    I suggest asking PRT.

    #213621 quote
    ZeroCafeine
    Participant
    Senior

    @SimLH

    Maybe you can past a part of your code with an exemple on photos where is the problem, if will be better for help you 😊

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

Retrieve number of pending orders


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
SimLH @simlh Participant
Summary

This topic contains 8 replies,
has 3 voices, and was last updated by ZeroCafeine
2 years, 10 months ago.

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