Im looking for some existing ways in a automated system how usually and order is generated being tracked and once a position is filled, how it is being monitored for exiting. Just start to explore this aspects, so any thoughts or reference is appreciated. So far it seems to me I need to right a lot of if else condition to read market price/make and cancel order in order to buy a stock and watch if I need to sell for profit or sell stop loss. Now Im just looking for some leads to think in the right direction
keep track of bid/offers and size keep track of positions keep track of open orders, submitted orders listen to your signals do not "right" a lot of if else condition unless you want a mess
Thanks for the advise. If I have a position that I want to close it whenever the price is above or below a threshold, is there any specific way to set up the order so the execution will be robust and easy to understand. I’m thinking of some if else condition and then set up orders, but I can guess there will be a lot if potential problems. I’m wondering usually how usually the code is design exiting a position.
might be some usable ideas in here...? Chart Trading and the Chart DOM https://www.sierrachart.com/index.php?page=doc/ChartTrading.html Attached Orders https://www.sierrachart.com/index.php?page=doc/AttachedOrders.html Order Types https://www.sierrachart.com/index.php?page=doc/OrderTypes.html#SendAttachedOrders
I might be wrong but this is what I am thinking. You monitor the bid/ ask price. When ask/bid price is at the level that you want you fire a market order. Let me know if i am missing something.
Yes, this is what I want (either a market order or limit order I think), my exact question is how usually this is implemented or code up, do I just do following: if price>xxxx or price<xxxx then sell at market order Is there going to be any problem if doing this way?
Just did some research, in the context of IB platform, I think what I want is bracket order implementation, like below. https://interactivebrokers.github.io/tws-api/bracket_order.html