4.7.5.2.1 Collections elements

From MultiCharts
Jump to navigation Jump to search

Below the elements of IAccounts, ILogs, IOrders, and IPositions collections will be described.


IAccounts collection contains the following elements: public struct Account:

  • public string Profile { get; private set; } – Profile name.
  • public string Name { get; private set; } – Account name.
  • public double? Balance { get; private set; }
  • public double? Equity { get; private set; }
  • public double? OpenPL { get; private set; }
  • public bool BalanceInPrcnt { get; private set; } – Returns true, if Balance returns values in percent.
  • public bool EquityInPrcnt { get; private set; } – Returns true, if Equity returns values in percent.
  • public double? Margin { get; private set; } – Absolute value of margin.
  • public double? MarginAsPrcnt { get; private set; } –Margin value in percent.
  • public double? AvailableToTrade { get; private set; }
  • Nullable<T> fields(for example, double?) may be == null if the broker does not provide corresponding information.


ILogs collection contains the elements: public struct Log

  • public DateTime Time { get; private set; } – event time
  • public string Symbol { get; private set; } – symbol name
  • public string Profile { get; private set; } – profile name
  • public string Text { get; private set; } – message text
  • public ETM_MessageCategory Category { get; private set; } – message category (info, warning, error)
  • public string Source { get; private set; } – event source name
  • public string ID { get; private set; } – Event identifier, this is a number.


IOrders collection contains the following elements: public struct Order

  • public bool IsManual { get; private set; } – returns true if the order was generated manually, false if the order was generated by an automated system.
  • public DateTime GeneratedDT { get; private set; }- time of the order creation, i.e. the time when the order appeared in MultiCharts .NET during the current connection.
  • public DateTime? FinalDT { get; private set; } – time when the order moves to the final state.
  • public string Account { get; private set; } – account
  • public string Profile { get; private set; } – profile
  • public string Symbol { get; private set; } - symbol
  • public string Resolution { get; private set; } – resolution, this should not be empty when Automated Trading is being used.
  • public string Name { get; private set; } – order name, when Automated Trading is being used this contains the order name generated by the strategy. If Semi-Automated strategies for manual trading are being used this is contains the order names generated by them.
  • public string StrategyName { get; private set; } – strategy name, this should not be empty when Automated Trading is being used.
  • public string Workspace { get; private set; } – workspace name, this should not be empty when Automated Trading is being used.
  • public ETM_OrderAction Action { get; private set; } – action, this is buy or sell
  • public ETM_OrderState State { get; private set; } – order state, this is filled, cancelled, sent, etc.
  • public ETM_OrderCategory Category { get; private set; } – category this market, stop, limit, etc.
  • public ETM_OrderTIF TIF { get; private set; } – Time In Force of the order
  • public DateTime? TIFDate { get; private set; } Date for GTD Time In Force
  • public int Contracts { get; private set; } – number of contracts
  • public int FilledContracts { get; private set; } – number of filled contracts
  • public double? StopPrice { get; private set; } – stop price (!=null for stop & stoplimit orders)
  • public double? LimitPrice { get; private set; } – limit price (!=null for limit & stoplimit orders)
  • public double? ExecPrice { get; private set; } – average order execution price
  • public string BrokerID { get; private set; } – order ID returned by the broker
  • public int OrderID { get; private set; } – internal order ID that is generated by МultiСharts and is used for internal calculation for Automated Trading.
  • public string OCOGroupID { get; private set; } – OCO group ID. If the order is not a member of OCO group this field will be empty.
  • public string ID { get; } – unique order identifier, which is - Profile + BrokerID.


Order statuses: public enum ETM_OrderState

  • eTM_OS_Cancelled = 2, - cancelled, Final status.
  • eTM_OS_Filled = 3, - filled, Final status.
  • eTM_OS_Ignored = 9, - user cancelled order transmission within Automated Trading in the configuration dialogue, Final status
  • eTM_OS_PartiallyFilled = 7, - partially filled, will continue to be filled and will turn to eTM_OS_Filled state.
  • eTM_OS_PreCancelled = 6, - cancellation command has been sent.
  • eTM_OS_PreChanged = 8, - modification command has been sent.
  • eTM_OS_PreSubmitted = 0, - sent to the Exchange.
  • eTM_OS_Rejected = 4, - rejected by broker, Final Status.
  • eTM_OS_Saved = -10, - artificial status, that is set by MultiCharts .NET for active orders when the broker profile is disconnected or MultiCharts .NET is close, Final status.
  • eTM_OS_Sent = 5, - sent to the broker.
  • eTM_OS_Submitted = 1 – submitted at the Exchange.

Final Status means that the order turned in its final state and will not be modified.


IPositions collection contains the methods: public struct Position

  • public string Account { get; private set; } - account
  • public string Profile { get; private set; } - profile
  • public string Symbol { get; private set; } - symbol
  • public int Value { get; private set; } – market position(0== if closed, 0< if long and 0> if short).
  • public double AvgPrice { get; private set; } – average entry price
  • public double OpenPL { get; private set; } – current unrealized profit
  • public string ID { get; } – identifier, which is Profile + Account + Symbol