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

Viewing 9 posts - 1 through 9 (of 9 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!

    #240207

    Dear All,

    How to set up a buy limit above the previous candle high plus 1 ?

    BUY 1 CONTRACT AT HIGH[1]+1 LIMIT
    SET TARGET PPROFIT 150
    SET STOP ploss 80
    ENDIF

    This code buy at the open instead of the previosu candle high +1

    Could you please advise what shoul be written ? to activate it ?

    Thanks

    #240212

    Without the code you used I cannot exactly tell, but you are likely not to have checked whether the order has to be a STOP or LIMIT order:

    You cannot use STOP or LIMIT at your own discretion, but based on the position of the current price. i.e. CLOSE, compared to the entry point (see attached dpic).

     

     

    #240329

    Thank you Roberto for your reply.

    I am just looking for a buy signal when the price crosses the previous candle high in the same timeframe.

    #240362

    Then the above code should do.

     

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

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