Buy and Limit orders with relation to a price at a specific hour

Forums ProRealTime English forum ProOrder support Buy and Limit orders with relation to a price at a specific hour

  • This topic has 4 replies, 2 voices, and was last updated 3 years ago by avatarMICH.
Viewing 5 posts - 1 through 5 (of 5 total)
  • #144258

    Hello,

    I’m trying to set limit orders to buy and sell based on the price at a certain time.

    For example, if the price of a contract at 16:00 is 185, set a buy limit order to 5 pt less and a sell limit order to 2 pt more. Purchase and sale orders, in the example of 185, would be at 180 and 187.

    I tried with:

    IF (CurrentTime = 1600) THEN

    BUY 1 CONTRACT AT close[1]-5 LIMIT

    SHORTSELL 1 CONTRACT AT close[1]+2 LIMIT

    END IF

    But if in the timeframe considered (e.g. 5 min) these price levels are not touched the orders are not executed. If by 16:05 the price levels are not touched the orders are not opened. What can I do to have the orders open for the following periods? 

    Thank you very much in advance!

    #144259

    160000, always 6 digits.

    Sellshort, not Shortsell.

    Pending orders always expire each bar. If conditions are still valid you need to place them again and again.

     

    #144260

    Thank you very much for the correction and for the advice!

    But, how can to replace the orders for a specific time? E.g for 4 hours?

    Thank you in advance!

    #144264

    The simplest way is to run your strategy from a 4-hour chart.

    If you want to run your strategy from a 5-minute chart but want the pending orders be placed for the next 4 hours, then you have to do the math yourself to compute the correct expiration time or you may use the number of 5-minute bars required (each hour has 12 5-minute bars, so it’s a total 48 bars) to keep placing your pending order(s).

     

    #144266

    Thank you very much Roberto!

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

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