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 am trying to code a system that is called "Filling the Gap":
Buy a stock when it opens more than 2% lower than the prior day close.
Sell at yesterday's closing price or a the close if yesterday's closing price is never hit.
Only downside to coding this is I want to Sell on the same day it is Bought. I was thinking about doing this with 5 minute bars and closing it at 3:55pm, but then I have to have the time of the Close of yesterday. I am using ToTime and Time, but not sure how to do it.
I guess I could do it daily and then close on the next day's Open.
Thanks,
Glen
Can you help answer these questions from other members on NexusFi?
Thanks Fat Tails. Yes, that is what I was looking for. Have you back tested it? How does it look? Did you use the TIME and ToTime functions to do that or some other function?
As far as a filter, one could look at the size of the gap, but not sure if that is correlated.
Some other filters when that day before was down for the stock, or using QQQ to see if it gaped down as well, or just buying and not shorting.
I do not use the ToTime function, but usually create a TimeSpan object which holds the value of the exit time. I then compare the hour and minute of the current time stamp with the TimeSpan object.
I had some issues with the ToTime and Time function so I found the Bars.GetDayBar(1) to get yesterday's close and also to close on today's close to be helpful for back testing. It probably wouldn't work for trading as it trades at close.
Also, I don't want to trade all day like your system does, but only daily and then only on the long side.