Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I was looking for the best way to exit trades close to the end of the day (3.15 pm) on intraday strategies that uses 5 minute bars.
So far I have been using "setexitonclose" together with a session that goes from 8.30 am-3.09 pm. To my understanding this would then exit the trade on the next bar that is 3.10 pm.
Now let's say I want to exit at 3.14 pm instead. How would I achieve this the best way possible? I was thinking about making a session from 8.30 - 3.14 and in the code write "If time > 1511 then sell this bar on close". Would this then close the trade at the session close (3.14 pm) or not?
Regards
Can you help answer these questions from other members on NexusFi?
After you backtest it, I suggest running in real time, preferably real account, just to test and make sure it is working correctly. I have seen times where this does not always work properly.
Thank you! Yeah I will test it live. I know the method of using "sell this bar on close" works well with bar building of daily bars (405 minute bars) with a session (8.30 - 15.14). But I always thought that is because the bars use smaller 1 minute intervals to build the full bars. This means that Tradestation can do proper backtesting as it could calculate the exit price at 15.14.
I just don't know how it would know the exit price at 15.14 if I do backtesting at 5 minutes bars since TS would only know the price at 15.15. Or would I have to use "look-inside-bar" for the backtesting to work properly?
In this cases I use a 1 minute chart and simply say "If Time = 1411 then begin.." if you us minutes ending with five then you can just use the 5 minute bar and so on. like 60minute bar if you just enter at round hours. The time information is stored in the chart bars obviously you have to consider local or exchange time settings.
I'm not sure I understand what you mean. My backtesting is done on 5 minute bars. You mean I should make a data2 with five minute bars but take the trades on 1 minute bars?
Anyway the previous method mentioned in this thread seems to work fine for me.