The purpose of FDC is to help you develop strategies that will improve your trading. After doing some research on your part, you come to the conclusion that you want to test a particular trading strategy. FDC does this very effectively, and you begin by clicking on the Trade Wizard icon.

The Trade Wizard immediately calls up a template for the construction of a trading function that can be used on any dataset.

Above you see the template for the trade function “movtrend20hlc.ftc”, outlining the buy signal. Specifically this function will buy #R (whatever dataset you specify) on the next day’s open when the 20-day moving trends of the high, low, and close are all higher than they were on the preceding day. One manner in which you express that logically is as follows:
(change 20 movtrend hi #R) gt 0
and
(change 20 movtrend lo #R) gt 0
and
(change 20 movtrend cl #R) gt 0
That is, look at the 20-day movtrend of the high of the dataset. If it’s higher than it was yesterday (change from yesterday is greater than zero), that’s bullish. If that condition also exists for the 20-day moving trends of the low and the close, then all three bullish situations give you a buy signal. Note that we have chosen to list it on 3 lines, but it could just as easily have been listen on one line.
Next we construct the sell signal, which for the purposes of illustration is the opposite of the buy signal. That makes this a “reversal system”, in which the trader is always in the market. That is, the trader is either long or short, but never out.

Above you see the template outlining the sell signal, in which you will go short on the next day’s open when the 20-day moving trend has a lower high, a lower low, and a lower close than it had on the preceding day. One manner in which you express that logically is as follows:
(change 20 movtrend hi #R) lt 0
and
(change 20 movtrend lo #R) lt 0
and
(change 20 movtrend cl #R) lt 0
As the buy and sell signals are mirror images of each other, it is not necessary in this case to specify any additional exits from either the buy trade or the short-sell trade. For the same reason, it is also unnecessary to specify how any conflicts should be resolved, as there will not be any conflicts. However you should visit the Parameters tab at the bottom of the template to familiarize yourself with the process.
If this were a new trade, or a modified trade you would save it as such and give it a name.
Next, let’s try trading it. Go back into the Command Window and enter the trade function and the dataset on which it is to operate:

Executing this command produces the following dataset:

What you see above is the data output. Note that at this time, this is only a temporary dataset named “temp1”. You are welcome to save it and rename it, as with the output of any FDC operation. However the most interesting part of the trade output are the tabs at the bottom of the dataset.
Plot1 shows you the daily bar chart of the dataset, with the positions shown as color overlays, and in pane2 the daily total equity.

Plot2 shows the results of each trade, including the maximum excursions of
each trade
(that is the maximum amount by which they were ahead or behind), and a similar
result for
the overall account..

The Summary tab will give you the overall summary, plus give you additional tabs to access summaries for both the long and short trades, and a tab to see the accounting line-entries of each trade.

Once a dataset summarizing a trade has been produced, the individual summary items can be referenced in a command line. Thus you have produced "temp1" as above (or have saved it under a permanent name), the command line
temp1 summary '#netpl'
will produce the net profit or loss for that trade summary. This is particularly useful in connection with automatic execution of commands and sorting of lists - see the section on "Lists and Automatic Execution".
Lastly, the Note tab enables you to record your comments for posterity (assuming that you save the output).
Details, details… Things you must know:
Any trade function you create can be used on any dataset. The example given was chosen for its simplicity. Although it worked very well on the sample data (SPX) over the sample period (March 2002 – May 2003), reversal systems usually have a negative expected value over the long run.
Maximum Excursions:
If you want to see data for maximum positive excursion and maximum negative excursion, you must include a dataset that has opening price data. Note that this is extremely important information that can tremendously assist in your trading.
Entry Signals:
A signal entered in the trade template should be an expression that results in a logical (True-False or 1-0) answer. There are, for example, three "buy entry" tabs, each of which can be programmed with an entry signal that operates independently. Each tab can specify that entries be made by "stop" "limit" or "market" orders, and can contain up to three signals that, operating together, form the buy. A similar thing is true for buy.exits, and for sell entries and exits. Signals are entered using the full capabilities of FDC's user friendly language, including the use of macros.
A gentleman named Henry liked bank stocks and only liked going long the market. Being a fairly conservative individual, he also had the idea that one should establish one’s entry position only after being thoroughly convinced in an uptrend. However he noted that markets came down quicker than when they went up, and that a trading system should reflect that fact.
The system Henry proposed was that the market should be bought when the 5-day simple moving average of the closing price crossed above the 60-day moving average (from below). But the trade should be exited when the 15-day simple moving average crossed below the 30-day moving average.
In the first Buy Entry template, enter: (5 movave cl #R) crossup (60 movave cl #R), and in the first Buy Exit template, enter: (15 movave cl #R) crossdown (30 movave cl #R).
There are no sell entries, as Henry does not want to sell short. However, note that it would be possible for the market to give both a buy entry and a buy exit on the same day. For this reason, you need to specify what FDC should do in the case of a conflict.
To do so, all that is required is that you go to the Parameters tab and select a few buttons. We recommend that you do this for all trades, as many that upon first look appear to be conflict-free, have conflicts.

We then saved the new trade as “henry” and entered HENRY JPM in a command line, thus testing Henry’s system on J.P. Morgan Chase over the period of 1996 through early 2003. Here’s the summary of how Henry did.

He’s right on 50 percent of his trades and his average winning trade profits are about 2 ¼ times greater than his average losses. On the surface, that seems like a "keeper". But before we get too excited about it, let’s take a look at what it means in real dollars.
The trade wizard allows you to add real trading conditions, and it is heartily recommended that you examine the reality. To do so, all you have to do is add a few conditions to your trade routine. What conditions? Well, simple things like:
You need not specify conditions. But if you specify any, specify all so that FDC knows what you are doing. The default values for the questions above are 1, 0, 0 and 0.That is, if you specify nothing, FDC will assume a unit value of 1, zero seed capital, zero commissions and zero slippage. To translate: when you enter henry jpm, FDC enters 1 0 0 0 henry jpm.
Note that the seed capital is a subjective value, and subjectivity can frequently be illogical. For example, you may specify a $100,000 starting capital, when you might have no more than $2,000 invested. Or alternatively you may specify a $2,000 starting capital and have $100,000 riding on each unit of price change. Specifying zero seed capital has the advantage of showing you the positive and negative equity moves from the inception of trading.
So let’s now take a more realistic look at Henry’s trade. Let’s enter:
100 3000 .10 .25 henry jpm
This command effectively tells FDC to run the HENRY trade function on 100 units of JPM, using $3,000 of starting capital, commissions of $10 (on a round-turn per unit basis), and slippage of $25 on each side of a unit transaction.
The reason $3,000 of starting capital was chosen is because that is the closest round number not requiring the investor to go on margin. Now let’s see the trade:

Adding commissions and slippage will usually result in some of the marginally profitable trades becoming losses. This has happened here, but not significanly so. The average win is still about twice the size of the average loss. The $3,000 of starting capital has added another $2,211, with an additional $316 in open trade profitability. On the surface, this trading program is a successful one. However, consider that at one point (March 1999) we were ahead $4,108, and have given about half of that back.
Note that with 20 trades each undergoing slippage of $25 per side and $10 round-turn commission, you would have expected real trading to be $1,200 less than the first running of the trade function (without commission and slippage). However, the slippage calculation is smart in that it will not allow you to buy above the day's high, or to sell below the day's low. It turns out that Henry was correct in not pursuing short trades based on this system, as they further reduced profitability. The proof for that is left to the user.
Using "Internal" variables:
When you look at the trading summary you will notice that the output entries are all identified as "#_____". All of these values are generated by the trade, and can be referred to by name in subsequent FDC operations. For example, you may want to sort and rank the results of 20 trades by their #netpl. Furthermore, you may want to modify your trades by the ongoing information generated within the trade. To see what is available, just click on the Help button at the top left of the Trade Wizard. This is what you will see:

There's a lot there, and you may want to print a copy
For example, one of the items on the list is "#numbars" which identifies the lifespan of the current trade in number of bars (or days).That is, if #numbars shows a value of 9, that means that the current trade is 9 market days old. Some traders like to tighten up on their stops after the trade has been in business for some time. For example, let's say the initial stop was a close through the 30-day moving average. Then for each day a position was held, the number of days in the moving average was reduced by 1, but never allowed to go below 15. Here's how you would create that trade:

Go to the Trade Wizard and select Henry. All we are going to do is add an additional stop loss rule. Select the tab "Buy Exit", and when that appears, select the tab "Second Buy Exit". Click on the stop button, and a small window will open (technically known as an "Edit Line"). In that Edit Line enter:
(15 max (30 - #numbars)) movave (cl #r).
This text means that your stop is based on a moving average of the closing price, which will be the maximum of either 15, or 30 less the number of days the trade has been in play.
One More Example:
Now let’s digress and approach the concept of successful trading from a slightly different angle. Instead of trying to achieve winners, let’s look at trading to avoid losses, or at the least, lessen the losses. Where this is different is that most traders and researchers spend most of their time identifying the best time or spot to enter a trade. That can be done based on either fundamental or technical information. To avoid getting mired in debate as to what is the best “signal”, let’s just choose a favorite trend-following entry.
We will initiate a trade when the “25-day exponential moving average” changes its direction from 2 days before. That 2-day wait eliminates casual flip-flops. Also, note that there is no such thing as a 25-day exponential moving average. Although it’s a misnomer, like “knots per hour”, the terminology has stuck nonetheless. Exponential smoothers are not moving averages at all, and they do not work by “days”, but by smoothing factors. The smoothing factor that produces a lag similar to the lag of a 25-day simple moving average is 0.08. This is explained in the “Tour of Basic FDC Commands” in the manual. Despite our purist viewpoint on “Exponential Moving Averages”, we have nonetheless given-in to mass demand to enable users to specify an N value that relates to the number of days’ lag. Specifically, should you request “N EXPAVE BONDS” in which N is greater than 1, FDC will take N to mean the number of days.
Click on the "Create New Trade" button to begin a fresh trade. Our buy entry signal is going to be:
(2 change (.08 expave cl #R) ) crossup 0
and our sell entry signal is:
(2 change (.08 expave cl #R) ) crossdown 0
If you process that trade (which we have done and saved as “ema25reverse”) and run it on the S&P index from 1996 to 2003 as a reversal system, you will see that it’s a big loser.

However, when you examine the Plot2 tab (showing the individual trade profit excursions) or the trading summary, you can see one of the problems: The trade entries generate good profits, but give too much back. Such action is common with reversal trading systems; they stay long until the market gets weak enough to go short, and vice-versa. The solution is to find a way to exit our signals before they reverse.
Our first consideration is to exit if we are immediately “dead wrong”, like the market collapses right after you buy. That is, if the market in the first two days after you have bought sells below its preceding 4-day low, you would probably conclude that your timing was wrong. After all, you are supposed to be “trend following”. Select the Buy Exit tab, which will then expand to give you three possible buy exit tabs. In the box identified as Buy Exit Method, click on the Stop button and enter the following in the now-visible Stop Entry Price Line:
4 movmin (lo #r back 1)
That expression identifies the previous 4-day moving minimum of the low. Below that in one of the Entry Lines labeled “Additional Conditions”, enter:
#numbars lt 3
which makes the stop price only applicable for the first 2 trading sessions.

The corresponding buy stop is:
4 movmax (hi #r back 1)
which should also have the condition: #numbars lt 3
Okay, that protects our trade for the first 2 days. Hopefully after 2 days our trade will be moving solidly into the black. Now what can we do to avoid leaving too much of that profit “on the table?” Quite simply, we can quit when we start giving too much back.
If you made 100 points in a trade, would you stay in the trade if it slid back down by more than 25 points? Would you have been happy to take out 75 percent of the profit and call the trade quits?
That’s easy to do in FDC. One of the internal trade variables generated is #mpx, or the maximum profit excursion for each trade. So just exit the trade when it drops by 25 percent of the maximum profit excursion. But let’s wait for 3 days to give our new trade some time to work. The maximum profit is at the highest high occurring since the inception of the trade, which FDC expresses as #hihi. Select the Second Buy Exit tab, click on the Stop button and enter:
#hihi – (.25 * #mpx)
and enter the condition: (#numdays ge 3)
Thus any time your trade is 3 days old or more, your stop exit price will be the highest high of the trade, less 25 percent of the maximum profit in the trade to date. Note that here we used #numdays, which is simply a synonym of #numbars. Also, note that #mpx is calculated at the end of each bar (or day). That is, during the day Wednesday, the #mpx value is as of the close of Tuesday. Within a given day, you will not know the extent of the market moves until the close. Don’t forget to enter the following stop as a Second Sell Exit:
#lolo + (.25 * #mpx)
and the condition: #numdays ge 3

This trade (saved as “amultiexitema”) now has 3 possible exits: (1) a 4-day breakout against us in the first 2 days, (2) anytime after the second day we give up more than 25 percent of our profit in a particular trade, and (3) should the entry signal give us a reversal without either (1) or (2) being given. Note that none of the above required “heavy programming”. All you had to do was think and express your thoughts logically, using the same simple language that works for all aspects of FDC.
Here’s the result when processed on the S&P 500 from 1996 through early 2003:

Was this the most profitable trading program ever? No, it’s still a loser. But we have managed to reduce losses from –655 to –145 with some simple, easily programmed rules. We just approached the concept philosophically, and put it in play. Note that there was no “optimization”. In fact, we started out with a trading system that was a big loser. That is, we did not repeatedly run this trading program to determine the most profitable cutoff point. The concept was simple: If you’re wrong, get out; if you’re right, don’t give it all back.
This example also illustrated multiple stops and the use of four internally generated values: the number of days in the trade, the highest high and lowest low for the trade and the maximum profit in the trade.