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)
New to the community and new to programming on TradeStation. Building a simple strategy for practice. Creating an automated strategy to buy SPY on the 14th day of each month and sell on the 16th day (2 days after). I am having trouble building out the match for trading day.
For example if the entry or exit day falls on a non-trading day, how do I execute the last trading day before the non-trading day? My code so far:
//This is entry on the 14th of each month
If dayofmonth(date)=13 then buy ("Entry") next bar open;
//This is exit on the 16th of each month
If dayofmonth(date)=16 then Setexitonclose;
you will likely need code that is able to detect holidays and weekends first. This would allow you to check at the beginning of every month if the 13th and 14th days are regular trading days and adjust the days accordingly if they are not.