It is simple to do to Enter (eg. EnterLong(int barsInProgressIndex, int quantity, string signalName) but overly complex to exit, eg,: ExitLong(int barsInProgressIndex, int quantity, string signalName, string fromEntrySignal) is the only overload with BarsArray parameter available.
In some more advanced strategies I store Collection<IOrder> with some other details to keep track of the entered orders and their signal names but in most cases it is an overkill for a very simple need - to have a simple overload available like: ExitLong(int barsInProgressIndex) or ExitShort(int barsInProgressIndex), the point is to not have to provide fromEntrySignal, just exit all of them on the more granular level.
I understand you may be reluctant to make any changes right now to NT 7 so I was considering creating a method like (not tested):
private void ExitAllShort(int barsArray) { foreach (Order order in Orders) { if (order.Short && order.Filled > 0 && order.OrderState == OrderState.Accepted || order.OrderState == OrderState.Working) { ExitShort(barsArray, order.Quantity, "Exit " + order.Name, order.Name); } } }
Thanks
Comment