Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buy at Open, close at Close of the same candlestick #249

Open
tombohub opened this issue Feb 11, 2021 · 4 comments
Open

Buy at Open, close at Close of the same candlestick #249

tombohub opened this issue Feb 11, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@tombohub
Copy link

Can you make it so we can buy at Open and close the position at Close the same candlestick?

Thanks

@kernc kernc changed the title feature request: Buy at Open, close at Close of the same candlestick Feb 12, 2021
@kernc
Copy link
Owner

kernc commented Feb 12, 2021

The recommended approach for trading within candlesticks is to obtain/load OHLC data in a lower time-frame.

@tombohub
Copy link
Author

Thank you, that is viable approach. The only issue with that is that intraday data is not as free and easy to get as daily data so when we want to run across good amount of stocks we would need to pay for data

@kernc kernc added the enhancement New feature or request label Feb 13, 2021
@arisliang
Copy link

while we're at it, is it possible to specify the exact price we want to make it in? In that case, we can specify any OHLC, or combinations. We can set a flag somewhere if we don't want to accidentally cheat with it.

@AGG2017
Copy link

AGG2017 commented Oct 9, 2021

while we're at it, is it possible to specify the exact price we want to make it in? In that case, we can specify any OHLC, or combinations. We can set a flag somewhere if we don't want to accidentally cheat with it.

Instead of market order use limit order for the required price. If you mean completely different price like the options premium of this stock then it is not possible without serious modifications.

I think it may be possible to do several transactions in one bar by calling self._broker.next() after each order in Strategy.next(). This way the order will be processed and it will accept new order in the same bar. It is not verified, just an idea to experiment with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants