4.6.3 Strategy Performance: Difference between revisions
From MultiCharts
(Created page with " Signals as well as functions and indicators can get key information upon the current strategy state during their calculation through ''StrategyInfo'': ''StrategyInfo.AvgEntr...") |
No edit summary |
||
Line 2: | Line 2: | ||
Signals as well as functions and indicators can get key information upon the current strategy state during their calculation through ''StrategyInfo'': | Signals as well as functions and indicators can get key information upon the current strategy state during their calculation through ''StrategyInfo'': | ||
* {{color|blue|StrategyInfo.AvgEntryPrice}} is the average open price of the position on the chart. If the position is not opened, then 0 is returned; | |||
* {{color|blue|StrategyInfo.MarketPosition}} is the current market position. For example, we are at the short position for 100 contracts, then ''StrategyInfo.MarketPosition'' will return “-100”. For example, if we have a long position for 50 contracts, the {{color|blue|StrategyInfo.MarketPosition}} will return the value “50”. | |||
* {{color|blue|StrategyInfo.ClosedEquity}} – is the current NetProfit of the strategy on this bar. | |||
* {{color|blue|StrategyInfo.OpenEquity}} = current ''NetProfit'' + current ''OpenPL'' of the strategy on this bar. | |||
Following keywords can be used only in signals. | Following keywords can be used only in signals. | ||
Line 14: | Line 14: | ||
More detailed information upon current strategy parameters can be obtained through ''CurrentPosition(IMarketPosition)'': | More detailed information upon current strategy parameters can be obtained through ''CurrentPosition(IMarketPosition)'': | ||
* {{color|blue|CurrentPosition.Value}} – the same as StrategyInfo.MarketPosition. | |||
* {{color|blue|CurrentPosition.Side}} – EMarketPositionSide.Flat – there is no open position, EMarketPositionSide.Long – long position is opened, | |||
* {{color|blue|EMarketPositionSide.Short}} – short position is opened. | |||
* {{color|blue|CurrentPosition.Profit}} = }}CurrentPosition.OpenProfit'' – current ''OpenPL'' upon the open position or 0, if the position is closed. | |||
* {{color|blue|CurrentPosition.ProfitPerContract}} – current OpenPL upon the open position per contract or 0, if the position is closed. | |||
* {{color|blue|CurrentPosition.OpenLots}} – the amount of not closed contracts in the position. | |||
* {{color|blue|CurrentPosition.MaxDrawDown}} – minimum OpenPL for the current position, for the whole period of time, while the position was opened. | |||
* {{color|blue|CurrentPosition.MaxRunUp}} – maximum OpenPL for the current position, for the whole period of time, while the position was opened. | |||
* {{color|blue|CurrentPosition.ClosedTrades[]}} – the list of closed trades (ITrade) in the current position. | |||
* {{color|blue|CurrentPosition.OpenTrades[]}} – the list of open trades (ITrade) in the current position. | |||
''CurSpecOrdersMode'' – current mode of special orders (ESpecOrdersMode.PerContract, ESpecOrdersMode.PerPosition) | ''' {{color|blue|CurSpecOrdersMode}}''' – current mode of special orders (ESpecOrdersMode.PerContract, ESpecOrdersMode.PerPosition) | ||
''PositionSide'' – current position: | '''{{color|blue|PositionSide}}''' – current position: | ||
* | * {{color|blue|EMarketPositionSide.Flat}} – position is not opened, | ||
* | * {{color|blue|EMarketPositionSide.Long}} – long position, | ||
* EMarketPositionSide.Short – short position. | * {{color|blue|EMarketPositionSide.Short}} – short position. | ||
<br> | <br> | ||
In signals, the history of positions is available (IMarketPosition), either opened or closed by the strategy through Positions[](IMarketPosition). | In signals, the history of positions is available (IMarketPosition), either opened or closed by the strategy through '''Positions[](IMarketPosition)'''. | ||
* Position[0] – current position (the same as CurrentPosition), | * Position[0] – current position (the same as CurrentPosition), | ||
* Position[1] – the previous opened position, etc. | * Position[1] – the previous opened position, etc. | ||
Line 40: | Line 40: | ||
Closed positions information is available through the ''IMarketPosition'' interface: | Closed positions information is available through the ''IMarketPosition'' interface: | ||
* {{color|blue|IMarketPosition.Value}} – 0, as there are no open trades in the close position. | |||
* {{color|blue|IMarketPosition.Side}} – EMarketPositionSide.Long – long position. | |||
* {{color|blue|EMarketPositionSide.Short}} – short position. | |||
* {{color|blue|IMarketPosition.Profit}} - total profit upon all the position trades. | |||
* {{color|blue|IMarketPosition.ProfitPerContract}} – profits upon all the position trades per contract. | |||
* {{color|blue|IMarketPosition.OpenLots}} = 0 for the closed positions, as by default, all the contracts were closed. | |||
* {{color|blue|IMarketPosition.MaxDrawDown}} – maximum potential loss for the position, for the whole period, while the position was opened. | |||
* {{color|blue|IMarketPosition.MaxRunUp}} – maximum OpenPL for the position, for the whole period, while the position was opened. | |||
* {{color|blue|IMarketPosition.ClosedTrades[]}} – list of trades (ITrade) in the position. | |||
* {{color|blue|IMarketPosition.OpenTrades[]}} – list of opened trades for the closed position, that is empty. | |||
<div style="background-color: #E5F6FF;">'''Example:''' | <div style="background-color: #E5F6FF;">'''Example:''' | ||
Line 100: | Line 100: | ||
The following main settings of the strategy are available: | The following main settings of the strategy are available: | ||
* {{color|blue|GrossLoss}} – Profit amount upon losing trades | |||
* {{color|blue|GrossProfit}} – Profit amount upon profitable trades | |||
* {{color|blue|NetProfit}} – net profit upon the strategy (GrossProfit+ GrossLoss) | |||
* {{color|blue|NumEvenTrades}} – amount of zero trades with Profit = $0.00. | |||
* {{color|blue|NumLosTrades}} – amount of losing trades with Profit < $0.00. | |||
* {{color|blue|NumWinTrades}} – amount of profitable trades with Profit > 0.00$. | |||
* {{color|blue|TotalBarsEvenTrades}} – amount of bars in zero trades. | |||
* {{color|blue|TotalBarsLosTrades}} – amount of bars in losing trades. | |||
* {{color|blue|TotalBarsWinTrades}} – amount of bars in profitable trades. | |||
* {{color|blue|AvgBarsEvenTrade}} – average number of bars in zero trades. | |||
* {{color|blue|AvgBarsLosTrade}} – average number of bars in losing trades. | |||
* {{color|blue|AvgBarsWinTrade}} – average number of bars in profitable trades. | |||
* {{color|blue|LargestLosTrade}} – Profit of the most losing strategy trade. | |||
* {{color|blue|LargestWinTrade}} – Profit of the most profitable strategy trade. | |||
* {{color|blue|MaxConsecLosers}} – maximum number of losing trades in a row (Profit < 0). | |||
* {{color|blue|MaxConsecWinners}} – maximum number of profitable trades in a row (Profit > 0) | |||
* {{color|blue|MaxDrawDown}} – maximum draw down StrategyInfo.OpenEquity for all previous trade period. | |||
* {{color|blue|MaxLotsHeld}} – maximum number of possessing contracts for all previous trade period. | |||
* {{color|blue|TotalTrades}} – total number of trades for the whole trade period. | |||
* {{color|blue|PercentProfit}} – number of profitable trades with respect to the total number of trades in percent. | |||
Trade information(ITrade) (entry + closing exit): | Trade information(ITrade) (entry + closing exit): | ||
public interface ITrade | '''{{color|blue|public interface ITrade}}''' | ||
{ | * {{color|blue|double CommissionValue { get; }}} – commission of the trade | ||
* {{color|blue|ITradeOrder EntryOrder { get; }}} – the order, that opened the trade - entry | |||
* {{color|blue|ITradeOrder ExitOrder { get; }}}– the order, that closed the trade - exit | |||
* {{color|blue|bool IsLong { get; }}} – Means, that the entry was Buy (true) or SellShort (false) | |||
* {{color|blue|bool IsOpen { get; }}} – Means, that the entry was not closed yet | |||
* {{color|blue|double Profit { get; }}} – OpenPL, if the trade is opend or TradeProfit – if closed. | |||
Trade order information ITradeOrder: | Trade order information ITradeOrder: | ||
'''{{color|blue|public interface ITradeOrder}}''' | |||
* {{color|blue|EOrderAction Action { get; }}} – EOrderAction.Buy, EOrderAction.Sell, EOrderAction.SellShort, EOrderAction.BuyToCover. | |||
* {{color|blue|int BarNumber { get; }}} – number of the bar, on which the order occured (Bars.CurrentBar, on which the order occured) | |||
* {{color|blue|OrderCategory Category { get; }}} – OrderCategory.Market, OrderCategory.Limit, OrderCategory.Stop, OrderCategory.StopLimit | |||
* {{color|blue|int Contracts { get; }}} – number of contracts in the filled order | |||
* {{color|blue|string Name { get; }}} – order name | |||
* {{color|blue|double Price { get; }}} – execution price | |||
* {{color|blue|DateTime Time { get; } }}– time of the bar where the order was executed | |||
[[Category:.NET Programming Giude]] | [[Category:.NET Programming Giude]] |