开始使用免费开始使用

Profit factor

One of the most vital statistics of any systematic trading strategy is the profit factor. The profit factor is how many dollars you make for each dollar you lose. A profit factor above 1 means your strategy is profitable. A profit factor below 1 means you should head back to the drawing board.

In this exercise, you will explore the profit factor in your strategy by creating an object called tstats that displays the trade statistics for your system. In general, trade statistics are generated by using the tradeStats() command.

本练习是课程的一部分

Financial Trading in R

查看课程

练习说明

  • Use tradeStats() to create an object containing the trade statistics in your portfolio. Save this as tstats.
  • Use the object tstats object along with $ and Profit.Factor to report the profit factor for SPY. Is your strategy profitable?

交互式实操练习

通过完成这段示例代码来试试这个练习。

# Get the tradeStats for your portfolio
tstats <- tradeStats(Portfolios = ___)

# Print the profit factor
___
编辑并运行代码