Back

Returns on Trades

How can we access the profit or loss for individuals trades? For example, if I have 200 trades, I would like to see which ones were lossers or winners.

Update Backtest








Eldar you can download the trades that your algorithm has made as a CSV file for post-processing analysis.

But I see that is not trivial to classify a closing trade as 'win' or 'lose' if the trade is not fully closing the portfolio position, if this is not the case so excel should be enough to get the trades classified.

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Like Gustavo said, we provide the trades so you can formulate your own statistics.

However, if you want to use the way we match trades to determine winners and losers, please consider adding this code snippet in the algorithm:

public override void OnEndOfAlgorithm()
{
foreach (var trade in TradeBuilder.ClosedTrades)
{
Log(trade.Symbol + " " +
trade.EntryTime + " " +
trade.ExitTime + " " +
trade.ProfitLoss);
}
}

In the end of algorithm, you can print out the closed trades are they are defined in the TraderBuilder object. A Trade object contains the following information:

Trade.Symbol
.EntryTime
.EntryPrice
.Direction
.Quantity
.ExitTime
.ExitPrice
.ProfitLoss
.TotalFees
.MAE // Maximum Adverse Excursion
.MFE // Maximum Favorable Excursion
.Duration
.EndTradeDrawdown

 

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Thanks Gustavo and Alexandre
0

Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed