Session Ready
Exercise

Understanding initialization settings - III

Let's continue the setup of your strategy. First, you will set a trade size of 100,000 USD in an object called tradesize which determines the amount you wager on each trade. Second, you will set your initial equity to 100,000 USD in an object called initeq.

Quantstrat requires three different objects to work: an account, a portfolio, and a strategy. An account is comprised of portfolios, and a portfolio is comprised of strategies. For your first strategy, there will only be one account, one portfolio, and one strategy. Let's call them "firststrat" for "first strategy".

Finally, before proceeding, you must remove any existing strategies using the strategy removal command rm.strat() which takes in a string of the name of a strategy.

The quantstrat and quantmod packages have been loaded for you.

Instructions
100 XP
  • Define both tradesize and initeq as integer objects representing $100,000.
  • Set strategy.st, portfolio.st, and account.st to "firststrat".
  • Remove the existing strategy strategy.st using rm.strat().