If this condition is true, I would like to get the (stop) price of this order.
I need this because my strategy continuously adjusts the stop price based on some computation, and I only want to invoke ibc.ModifyOrder(…) if the newly computed price is different from the current one.
I saw in the doc that there is an IB controller method
GetExecInfo( string OrderId, , string Field)
but this seems to return a field for an order in the execution list. My order is not filled however, so it won’t show up in this list.
As far as I understand, if I store the order ID and the stop price in static variables, these will not survive an AmiBroker restart. Is this the case? If yes, what is the best way to ensure that these variables are available even after such a restart?
More generally, what is the best pattern/approach to implement state recovery for strategies in AmiBroker? By state recovery I mean to be able to recover the order IDs, prices, and other order attributes for each product traded by a strategy.
Static variables can be set to persist (i.e. survive restart). Consult the Users’ Guide, AFL reference. It is really easy just press F1 in AmiBroker. Yes single key stroke divides you from ocean of knowledge. It works contextually so if you click on StaticVarSet and click F1 — it magically brings you to relevant doc.
Thanks Tomasz! This really makes life easy.
Am I correct to assume that using IB controller methods only it is not possible to recover order properties (like order type, price, size, etc) and one must use static vars for that?
As far as I can tell it looks like you can only get this level of information with Executed trades, using GetExecInfo();.
I found this thread because I had the same question. Replying because there was no follow up. Based on the responses I think it's safe to assume there is no way to access Limit/Stop information on pending orders through IBC. So static variables it is!