< All Topics

Specifiying Multiple Contracts or Shares

When MultiWalk optmizes your strategy and performs a walkforward, it assumes 1 contract or share.  It creates a special variable to manage the number of contracts or shares: MultiWalkNumContracts.  In order to specify more contracts or shares:

  1. Use MultiWalkNumContracts in your buy/sellshort statements.
  2. When you put the walkforward strategy on a chart:
  1. Specify slippage and commissions as “per share/contract” .
  2. Change the number of shares/contracts using the input variable iMultiWalkNumContracts.  Notice the preceeding “i” that distinguishes this as an input variable. This is necessary for MultiWalk’s use.
Using MultiWalkNumContracts in your strategy code.

MultiWalk will create the variable MultiWalkNumContracts in your code, so you so not (and must not) declare it.  It will be declared for you. You use MultiWalkNumContracts in your entry buy/sellshort statements but NOT in your sell/buytocover exit statements.  Consider the following example:


We do not specify the MultiWalkNumContracts in the exit statements since we want TradeStation to exit all contract/shares, whether they were all filled or not.  This assumes you are not using pyramiding entries and exits.  Kevin Davey’s default is to enter all and exit all positions for every trade.

Changing Quantity Of Contracts/Shares

Remember that MultiWalk will create two versions of your strategy:

  1. The MultiWalk version (used to backtest your strategy)
  2. The Walkforward version (used to trade your strategy on a chart)

MultiWalkNumContracts is declared for you in both.

Changing Quantity In MultiWalk Strategy Version

The MultiWalk version declares MultiWalkNumContracts like this:

You can modify this to be a different quantity, but if you have already run your MultiWalk project, you will need to re-run the project and force MultiWalk to perform a full optimization again.

Changing Quantity In Walkforward Strategy Version

The Walkforward version declares MultiWalkNumContracts like this:

There is no need to make any changes to the above walkforward code.  You would simply modify the quantity of shares/contracts when you put the strategy on a chart:

Table of Contents