Time-based limit order

Forums ProRealTime English forum ProOrder support Time-based limit order

Viewing 4 posts - 1 through 4 (of 4 total)
  • #175221

    Hello all,

    I would like to seek some advice on coding time-based limit order.  For example if the buy condition is met, I do not want to buy right after the next candle.  Instead, if the condition is met, and when the new candle starts, I want to put a buy limit on the previous candle to buy a 50% of the high and low.  Say the condition is met, and at the start of the new candle, I look at the previous candle.  The previous candle high is 15, and low is 5, and thus I would like to out a buy limit at 10, as shown in the code below

    But if i want to make the buy limit order at 10 to be good for only the current candle + the next 4 candles only, how do I go about modifying the code to meet this criteria?  Appreciate your advice.  Thank you very much.

     

    #175223

    You cannot use use LIMIT or STOP randomly.
    You need to use LIMIT orders when the entry price is more favourable than the current one (you want to BUY at a lower price or SELLSHORT at a higher one), while STOP orders are to be placed when the entry price is less favourable (you want to BUY at a higher or SELLSHORT at a lower one).
    When placing pending orders you should also consider the minimum distance required by the broker for the instrument you are trading.
    Anyway, your code to accomodate for a 5-bar (4 + current one) expiration is:

    This version will compare the current price  to the entry price (with a 10-pip distance):

    as to the SHORT size you will have to revert conditions for the STOP/LIMIT order decision.

     

    1 user thanked author for this post.
    #175224

    Thank you Roberto,

    Yes the buy limit is to buy at a better level compare to current market.  Basically the strategy is if it is a long bodied green candle, I do not want to buy at the next candle which will open at the high, and thus would prefer to put a buy limit somewhere below, say 50 pct retracement of that candle.  And the buy limit is good for the current candle + the next 4 candle.

    But the code:

    at the current candle is correct.  But the Buy limit order is still good for the next candle, even tho the MyLongConditions is no longer valid.  So even if the buy limit is not filled in the current candle, the buy limit supposed to be still live.  But in the current code, because in the next candle, ifthe MyLongCondition is no longer valid, it will not continue to place the buy limit.  Any thoughts?

    #175226

    I also spotted a logical error. Replace line 3 with this one:

    1 user thanked author for this post.
Viewing 4 posts - 1 through 4 (of 4 total)

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