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 8 replies, 3 voices, and was last updated 1 month ago by robertogozzi.
-
-
09/14/2020 at 8:58 PM #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!
09/14/2020 at 9:10 PM #144259160000, 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.
09/14/2020 at 10:44 PM #14426009/14/2020 at 11:52 PM #144264The 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).
09/15/2020 at 12:09 AM #14426611/10/2024 at 3:39 PM #240207Dear 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
ENDIFThis code buy at the open instead of the previosu candle high +1
Could you please advise what shoul be written ? to activate it ?
Thanks
11/10/2024 at 4:21 PM #240212Without 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:
12345IF close > HIGH[1]+1 THENBUY 1 CONTRACT AT HIGH[1]+1 LIMITELSIF close < HIGH[1]+1 THENBUY 1 CONTRACT AT HIGH[1]+1 STOPENDIFYou 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).
11/13/2024 at 8:34 PM #24032911/14/2024 at 11:37 AM #240362Then the above code should do.
-
AuthorPosts
Find exclusive trading pro-tools on