CONTRACT LIMIT UNTIL TIME
Forums › ProRealTime forum Italiano › Supporto ProOrder › CONTRACT LIMIT UNTIL TIME
- This topic has 6 replies, 2 voices, and was last updated 2 years ago by ashehzi.
-
-
04/21/2022 at 9:12 AM #192002
Hi,
I put limit order based on my condition being fullfilled i.e.
myLong= someValue
TIMEOPERATE = TIME>000059 AND TIME<204500
if condition=1 and TIMEOPERATE then
BUY 1 CONTRACTS AT myLong limit
endif
Above will make sure the limit order is placed as (IG) GOOD UNTIL CANCEL.
I don’t want any BUY orders after 2055 hours, so I want my LIMIT order to be LIMIT 205500 (time). Is there a way to do it in ProOrder?
Thanks.
04/21/2022 at 9:27 AM #192004There’s no UNTIL CANCEL instruction, as ProOrder CANCELS ALL pending orders when a candle closes (be it once a day in case of a Daily TF, or every second in case of 1-second TF).
It’s the other way round… you’ll have to place pending orders again and again until you need it.
So at any given time of your choice you only need to stop placing pending orders.
04/21/2022 at 9:51 AM #192006Hi,
The below logic is on 5m timeframe.
Assuming I want my program to put orders until 204500 (08:45pm).
Once condition is met, limit order is opened (attached snap bottom 20/04/22 20:45).
The above is fine as per the rules till now.
Now, I want to get my order cancelled (if already in place) and the time is 205000 (08:50 pm) because I don’t want any executions after 08:50pm.
As per the snapshot, the original order of 20:45 stays in place and gets executed at 20:54 (because it was a limit order). At the same 20:54 stop and limit get amended as shown in the snapshot.
Because of the price movement in my favour, Stop loss is pushed up at 21:05 (candle close/open time based on 5m tf).
It gets closed at 21:06 on a small loss because of price movement of nasdaq based on TESLA earnings reporting.
Is there a way to get the limit order closed at 08:50pm which was opened in the beginning at 08:45pm.
Thanks for your quick responses.
04/21/2022 at 11:00 AM #192016The rules about pending orders only apply to orders while they are still pending.
Once they are triggered, you have to use the istructions to exit a trade at any given time, like any open trade.
To exit an open trade at 08:45pm:
1234IF Time = 204500 THENSELL AT MARKETEXITSHORT AT MARKETENDIFIf, instead, you are using a 5-minute TF and want to close any open trade AFTER 1 single bar, then place these few lines at the beginning of your code (just after DEFPARAMs, if any):
1234IF OnMarket THENSELL AT MARKETEXITSHORT AT MARKETENDIF04/21/2022 at 11:11 AM #192018Hi,
If in trade, I have a condition already such as:
IF LONGONMARKET and DayOfWeek = 5 and (TIME>205400) then
Sell at market
endifI am interested in closing my pending order programmatically at 2050 (e.g.) as I don’t want my pending order getting filled after 2050.
04/21/2022 at 12:33 PM #192020I see your post on https://www.prorealcode.com/topic/cancel-pending-orders/ stating
I will have a look and try that option of QUIT and system settings.
Thanks.
04/21/2022 at 1:14 PM #192021 -
AuthorPosts
Find exclusive trading pro-tools on