+1 888 340 6572

4.7.5.2.1 Collections elements: Difference between revisions

From MultiCharts
No edit summary
Line 1: Line 1:
Below the elements of IAccounts, ILogs, IOrders, and IPositions collections will be described.  
Below the elements of IAccounts, ILogs, IOrders, and IPositions collections will be described.  


'''IAccounts''' collection contains the following elements:  
'''IAccounts''' collection contains the following elements:  
'''{{color|blue|public struct Account}}''':
'''public struct Account''':
* {{color|blue|public string Profile { get; private set; }}} – Profile name.
* '''public string Profile { get; private set; }''' – Profile name.
* {{color|blue|public string Name { get; private set; }}} – Account name.
* '''public string Name { get; private set; }''' – Account name.
* {{color|blue|public double? Balance { get; private set; }}}
* '''public double? Balance { get; private set; }'''
* {{color|blue|public double? Equity { get; private set; }}}
* '''public double? Equity { get; private set; }'''
* {{color|blue|public double? OpenPL { get; private set; }}}
* '''public double? OpenPL { get; private set; }'''
* {{color|blue|public bool BalanceInPrcnt { get; private set; }}} – Returns true, if Balance returns values in percent.  
* '''public bool BalanceInPrcnt { get; private set; }''' – Returns true, if Balance returns values in percent.  
* {{color|blue|public bool EquityInPrcnt { get; private set; }}} – Returns true, if Equity returns values in percent.     
* '''public bool EquityInPrcnt { get; private set; }''' – Returns true, if Equity returns values in percent.     
* {{color|blue|public double? Margin { get; private set; }}} – Absolute value of margin.   
* '''public double? Margin { get; private set; }''' – Absolute value of margin.   
* {{color|blue|public double? MarginAsPrcnt { get; private set; }}} –Margin value in percent.  
* '''public double? MarginAsPrcnt { get; private set; }''' –Margin value in percent.  
* {{color|blue|public double? AvailableToTrade { get; private set; }}}
* '''public double? AvailableToTrade { get; private set; }'''
* {{color|blue|Nullable<T> fields(for example, double?)}} may be == null if the broker does not provide corresponding information.
* '''Nullable<T> fields(for example, double?)''' may be == null if the broker does not provide corresponding information.
 
 
'''ILogs''' collection contains the elements:
'''{{color|blue|public struct Log}}
* {{color|blue|public DateTime Time { get; private set; }}} – event time
* {{color|blue|public string Symbol { get; private set; }}} – symbol name
* {{color|blue|public string Profile { get; private set; }}} – profile name
* {{color|blue|public string Text { get; private set; }}} – message text
* {{color|blue|public ETM_MessageCategory Category { get; private set; }}} – message category (info, warning, error)
* {{color|blue|public string Source { get; private set; }}} – event source name
* {{color|blue|public string ID { get; private set; }}} – Event identifier, this is a number.
 
 
'''IOrders''' collection contains the following elements:
'''{{color|blue|public struct Order}}
* {{color|blue|public bool IsManual { get; private set; }}} – returns true if the order was generated manually, false if the order was generated by an automated system.
* {{color|blue|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.
* {{color|blue|public DateTime? FinalDT { get; private set; }}} – time when the order moves to the final state.
* {{color|blue|public string Account { get; private set; }}} – account
* {{color|blue|public string Profile { get; private set; }}} – profile
* {{color|blue|public string Symbol { get; private set; }}} - symbol
* {{color|blue|public string Resolution { get; private set; }}} – resolution, this should not be empty when Automated Trading is being used.
* {{color|blue|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.
* {{color|blue|public string StrategyName { get; private set; }}} – strategy name, this should not be empty when Automated Trading is being used.
* {{color|blue|public string Workspace { get; private set; }}} – workspace name, this should not be empty when Automated Trading is being used.
* {{color|blue|public ETM_OrderAction Action { get; private set; }}} – action, this is buy or sell
* {{color|blue|public ETM_OrderState State { get; private set; }}} – order state, this is filled, cancelled, sent, etc.
* {{color|blue|public ETM_OrderCategory Category { get; private set; }}} – category this market, stop, limit, etc.
* {{color|blue|public ETM_OrderTIF TIF { get; private set; }}} – Time In Force of the order
* {{color|blue|public DateTime? TIFDate { get; private set; }}} Date for GTD Time In Force
* {{color|blue|public int Contracts { get; private set; }}} – number of contracts
* {{color|blue|public int FilledContracts { get; private set; }}} – number of filled contracts
* {{color|blue|public double? StopPrice { get; private set; }}} – stop price (!=null for stop & stoplimit orders)
* {{color|blue|public double? LimitPrice { get; private set; }}} – limit price (!=null for limit & stoplimit orders)
* {{color|blue|public double? ExecPrice { get; private set; }}} – average order execution price
* {{color|blue|public string BrokerID { get; private set; }}} – order ID returned by the broker
* {{color|blue|public int OrderID { get; private set; }}} – internal order ID that is generated by МultiСharts and is used for internal calculation for Automated Trading.
* {{color|blue|public string OCOGroupID { get; private set; }}} – OCO group ID. If the order is not a member of OCO group this field will be empty.
* {{color|blue|public string ID { get; }}} – unique order identifier, which is - Profile + BrokerID.
 


<br>'''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.


Order statuses:
<br>'''IOrders''' collection contains the following elements:  
'''{{color|blue|public enum ETM_OrderState}}
'''public struct Order'''
* {{color|blue|eTM_OS_Cancelled}} = 2, - cancelled, Final status.
* '''public bool IsManual { get; private set; }''' – returns true if the order was generated manually, false if the order was generated by an automated system.  
* {{color|blue|eTM_OS_Filled}} = 3, - filled, Final status.
* '''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.
* {{color|blue|eTM_OS_Ignored}} = 9, - user cancelled order transmission within Automated Trading in the configuration dialogue, Final status
* '''public DateTime? FinalDT { get; private set; }''' – time when the order moves to the final state.
* {{color|blue|eTM_OS_PartiallyFilled}} = 7, - partially filled, will continue to be filled and will turn to    eTM_OS_Filled state.
* '''public string Account { get; private set; }''' – account
* {{color|blue|eTM_OS_PreCancelled}} = 6, - cancellation command has been sent.
* '''public string Profile { get; private set; }''' – profile
* {{color|blue|eTM_OS_PreChanged}} = 8, - modification command has been sent.  
* '''public string Symbol { get; private set; }''' - symbol
* {{color|blue|eTM_OS_PreSubmitted}} = 0, - sent to the Exchange.
* '''public string Resolution { get; private set; }''' – resolution, this should not be empty when Automated Trading is being used.  
* {{color|blue|eTM_OS_Rejected}} = 4, - rejected by broker, Final Status.
* '''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.
* {{color|blue|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.  
* '''public string StrategyName { get; private set; }''' – strategy name, this should not be empty when Automated Trading is being used.
* {{color|blue|eTM_OS_Sent}} = 5, - sent to the broker.
* '''public string Workspace { get; private set; }''' – workspace name, this should not be empty when Automated Trading is being used.  
* {{color|blue|eTM_OS_Submitted}} = 1 submitted at the Exchange.
* '''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.


Final Status means that the order turned in its final state and will not be modified.
<br>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.


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


'''IPositions''' collection contains the methods:  
'''IPositions''' collection contains the methods:  
'''{{color|blue|public struct Position}}'''  
'''public struct Position'''
* {{color|blue|public string Account { get; private set; }}} - account
* '''public string Account { get; private set; }''' - account
* {{color|blue|public string Profile { get; private set; }}} - profile
* '''public string Profile { get; private set; }''' - profile
* {{color|blue|public string Symbol { get; private set; }}} - symbol
* '''public string Symbol { get; private set; }''' - symbol
* {{color|blue|public int Value { get; private set; }}} – market position(0== if closed, 0< if long and  0> if short).
* '''public int Value { get; private set; }''' – market position(0== if closed, 0< if long and  0> if short).
* {{color|blue|public double AvgPrice { get; private set; }}} – average entry price
* '''public double AvgPrice { get; private set; }''' – average entry price
* {{color|blue|public double OpenPL { get; private set; }}} – current unrealized profit  
* '''public double OpenPL { get; private set; }''' – current unrealized profit  
* {{color|blue|public string ID { get; }}} – identifier, which is {{color|blue|Profile}} + {{color|blue|Account}} + {{color|blue|Symbol}}
* '''public string ID { get; }''' – identifier, which is '''Profile''' + '''Account''' + '''Symbol'''


[[Category:4. Understanding PowerLanguage .NET]]
[[Category:4. Understanding PowerLanguage .NET]]

Revision as of 16:49, 12 September 2024

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