Trade

Trade is a programming language developed by Ed Gilbert.  You can download Trade from his website, and it is free.

It is a very powerful language, and in just a few lines you can develop code to calculate a market timing system, generate indicators which are not in the Fasttrack database, and even develop trading systems.

I am not an expert in Trade, but I have become reasonably proficient in the language.  There is a lot of trade code at Dexter French's website, and in addition to the Trade manual at Ed Gilbert's website, there is a trade tutorial available through the FT Monitor

With all that information around, I really do not have anything to add.  I will, however, give a some examples of some trade code to illustrate what you can do with it.

The EMAFAST system

This was written by Dave Serbin, and it creates a simple signal and then trades in an out of VWEGX based on that signal.

Here is the code:

;emafast.ini ;by Dave Serbin, 10/28/01
;This is a verysimplemarket timing signal called emafast which is
;based on the exponential moving average (ema) crossovers of
;fusmx (Fremont US Microcap) and vwegx (Van Waggoner Emerging Growth).
;The signal is on a buy when both emas on a buy, and on a sell
;when both emas are on a sell. Note the ema parameters for the buy and sell
;states are different.

[Expression]
fusemb.Buy = Signal(Ema(fusmx,3) - Ema(fusmx,21))
fusemb.Sell = Signal(Ema(fusmx,3) - Ema(fusmx,13))
WriteFile(fusemb, fusemb, "21/3 & 13/3 ema crossovers of fusmx")
vwemb.Buy = Signal(Ema(vwegx, 5) - Ema(vwegx, 21))
vwemb.Sell = Signal(Ema(vwegx, 3) - Ema(vwegx, 34))
WriteFile(vwemb, vwemb, "21/5 & 34/3 ema crossovers of vwegx")
emafast.Buy = vwemb And fusemb
emafast.Sell = vwemb And fusemb
WriteFile(emafast, emafast, "Combo of vwegx and fusmx")

[SignalPairTrade]
Fund = vwegx
Index = fdrxx;cfimx
Signal = emafast
FnuFile = vwegb

[Expression]
fund = vwegb
mdays = Sum(fund/fund)
peak = Max(fund, mdays)
cdd = (peak - fund)/peak
mdd = Last(Max(cdd, mdays))
Print(cdd*100, "Current Drawdown of vwegx\ntraded with emafast signal")
Print(emafast, "emafast(Combo of fusmx and vwegx ema crossovers)")

The first [Expression] block calculates the signal based on Ema crossovers.  The following [SignalPairTrade] block shows what would have happened if you had traded in and out of VWEGX according to that rule.  Then the last block provides a summary.

If you execute this code on January 19, 2002, you get these results.

NOTE:  This is very simple code and us useful for understanding how to program in Trade.  The actual signal has been revised and improved.  See my Signals Page for FUBAR5 and MICROC2X, which were inspired by this simple code.

McClellan Oscillator and Summation

There are some additional programs and utilities written by Steve Munger, and available through his website.  A very important utility is tradefr.  This allows you to have command line arguments for your trade code.  You execute tradefr against the code, and it does the command line substitution and then executes trade.

For example, the following code calculates the McClellan Oscillator and Summation of any Fasttrack fund family:  It also generates two signals: one based on a smoothed Stochastic indicator and the other based on an exponential moving average indicator.

[Expression]

|0|AD = FamAD(|0|)
|0|CO = (Ema(|0|AD,19) - Ema(|0|AD,39))
|0|CS = Sum(|0|CO)
|0|AS = Signal(|0|CS - Ema(|0|CS,13))
|0|ST = Ema (100*(|0|CS - Min(|0|CS, 14))/(Max(|0|CS, 14) - Min(|0|CS, 14)), 3)
|0|SS = Signal (|0|ST - 80)
WriteFile(|0|AD,|0|AD,"|0| AdvDec")
WriteFile(|0|CO,|0|CO,"|0| McCOsc")
WriteFile(|0|CS,|0|CS,"|0| McCSum")
WriteFile(|0|AS,|0|AS,"|0| Average Signal")
WriteFile(|0|SS,|0|SS,"|0| Stochastics Signal")

Since |0| represents the first argument, the command line

tradefr mccsig.ini GR

executes the code with "GR" replacing the |0|.  If "GR" is the name of a family, the the result of the execution will be the creation of the various files that are the arguments of the WriteFile routine.

Trade has one significant disadvantage.  It will not access the stock databases provided by Fasttrack.  It only access the mutual fund database, together with any .fnu files you have created.  A .fnu file is just a text file that you can create through Trade or other means.  Fasttrack will display this just like any fund it you want to display it.

Again, Steve Munger has provided a solution.  He has a program called STK2FNU which will take all of the stocks in a stock family and create .fnu files for each one of them.  If you put these in a family, then you could calculate the McClellan Summation of that family using the code above.