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)
EL Code for Exit end of week, reenter start of next week
I've written code to exit all positions at the end of the week (signal "wknd") to avoid being exposed during the weekends while the futures markets are closed. I'm trying to write a code to re-enter on Monday morning at open in case the strategy had an open position at the end of the week and exited through the "wknd" signal.
Any ideas how to write this in EL? I'm thinking it will be something like this, with the parts not yet figured out in brackets:
If [lastorder was created by wknd signal] and MarketPosition = 0 then begin
Buy [the start of the next trading day] next bar market
Thanks for any ideas!
Can you help answer these questions from other members on NexusFi?
one idea is to set a variable within your code when you issue the exit order.
Then you can evaluate this variable at the time you want to issue re-entry orders and allow those in case the variable is true. After you issue the order you'd set the variable back to false to prevent another entry based on that exit.
Another idea is to simply hedge your position with the next contract, lets say you were long the Dec 2019 SP, friday afternoon right before the close you sell a March 2020 conctract, the spread between those two is incredibly tight and whie it might cost you a couple of dollars, so does exiting and re entering. Sometimes you even get lucky and get to close it sunday night for a profit