First time poster, so I hope I'm not asking something obvious. I search but couldn't find a solution to thank you for the time.
This is what I'm trying to do:
I would like to identify the bar which was just closed, let's say it's an inside bar.
If the the last bar was an inside bar, then I would like to submit a bracket order: Buy X shares when the prices goes above that bar + stoploss at some price.
But, if during the next bar, the price goes below the inside bar, then cancel all orders that were submitted.
How can I do that?
What I'm having trouble with is:
1. How to know that a bar was just close [I want to check the inside bar only on bar close]
2. How do I check the prices on bar update [not wait for the second bar to close]
3. how to I submit bracket orders and how do I cancel all orders.
Thank you!
Comment