How do you create a trade simulation function?
To start the process, click on the Trade Wizard button
.
The Trade Wizard constructs a trading-oriented macro specifically designed for backtesting or trade simulation of past data. Think of it as an extremely detailed macro with great flexibility. However instead of creating a macro, you create a “trade” which is saved in your “trades” folder inside the fdc folder. This “trade” will operate on datasets just as macros function. That is, the dataset identified as “#R” is named to the right of the name of the trade. For example, “buy_and_hold djia from 20010101” will operate the “buy_and_hold” trade on the dataset “djia from 20010101”.
In the Trade Wizard you will be able to specify exact conditions as to how you will buy and sell long and short trades. These can be as simple or as complicated as you can define.
FDC gives you tremendous flexibility. That flexibility comes with a warning: be careful not to create unrealistic trades. For example, FDC permits you to define a trade as buying on the open if the close is greater than the close 5 days previous. But it is illogical to assume that you can buy on today’s open based on information unavailable until later in the day. Thus always remember that “open #R” and “close #R” means today’s open and today’s close. If you mean yesterday’s close, that’s defined as “close #R back 1”.
If your trade simulations turn out to be 95 percent profitable, suspect a definitional problem.
Here is a fairly easy construction:

The above template shows the construction of a Buy Entry in which a Buy will be effected “Market on Open” when yesterday’s close (“close #r back 1”) crosses above the previous day’s 4-day moving high price (“4 movmax hi #r”).
Tabs enable you to enter separate instructions for Buy Exit, Sell Entry and Sell Exit. The Parameters tab enables you to specify how any conflicts will be resolved:

Once you have entered your entries, exits and parameters, click on
. You will then be asked for a name to be given to this new function. It will be saved in the trades folder
of fdc.
Once you have entered the name,
.
Note that this is the basic example. The other illustrations elaborate on the many possibilities.