close position last bar intrayday
Forums › ProRealTime English forum › ProOrder support › close position last bar intrayday
- This topic has 7 replies, 4 voices, and was last updated 7 years ago by
Paul.
-
-
09/24/2017 at 7:50 PM #47157
Hi,
You can use time to set a exit-time to close a position for intraday. But is it possible to automatically close at the last bar of a intraday chart? Which adjust itself based on timeframe. If selected daily it should be disregarded.
Regards,
Paul
09/24/2017 at 8:55 PM #47158I don’t think so. Would be convenient to have though.
You have to take care of this yourself and even keep in mind that there can be differences in the time when a market closes when there is a shift from summer time to winter time or vice versa. And this is different for different instruments. 🙂
09/25/2017 at 7:29 AM #4717409/25/2017 at 9:41 AM #4718809/25/2017 at 3:36 PM #47282You can recognize on which timeframe you are on with this little code snippet:
1234567891011121314once NbBar = 1if BarIndex < NbBar+2 thenMyDay=opendaydayminutes = 1440*(MyDay-MyDay[1])MyHour=openhourhourminutes = 60*(MyHour-MyHour[1])MyMin=openminutebarminutes = MyMin - MyMin[1] + hourminutes + dayminutesbarminutes=abs(barminutes)Mybarminutes = lowest[NbBar](barminutes)[1]endifreturn Mybarminutes as "Timeframe"So it would be possible to set a different “intradaybarindex” for each of the found timeframe to close your orders (or event a different Time).
1 user thanked author for this post.
09/26/2017 at 10:13 AM #47379Thanks for the responses.
That’s an interesting snippet Nicolas. It gives new possibilities to play with.
A look at intradaybarindex set as indicator shows that not everyday has the same number of bars although the longer the timeframe the more consistent they become.
Because of that I guess it doesn’t work to set a close at a specific bar based on selected timeframe.
09/26/2017 at 10:44 AM #47382Even if intraday bars are not the same exact number each day, a range of bars quantity could be determined for each of the timeframe?
Anyway, with the timeframe code snippet I posted, you should also be able to set a time to close the orders, for example, if the timeframe is 5 minutes, close the trade @ 235500 or if the timeframe is 1 minute, close orders @ 235900.. etc.
09/26/2017 at 12:57 PM #47390 -
AuthorPosts
Find exclusive trading pro-tools on