Following a discussion in Shodson's journal ( ), I tried to code with MultiCharts a system which would only trade when its equity curve is above the moving average of the said equity curve. More details below.
Warning: the code is far from perfect and may even contain mistakes. It's just experimental. In other words: it is... for fun!
1. Instrument is Corn (ZC) daily from 1970.
2. The system is a (unprofitable) crossover of moving averages.
The signal is coded in EC_Signal.
Here is its equity curve, when all trades are taken (obtained with Filter = false; more on this below):
3. The function EC_AllTradesProfit returns a value which emulates the (built-in) equity curve of the signal calculated by MultiCharts. (Actually, there are very slight differences that I have not managed to fix.) It is displayed in red below the chart by the indicator EC_Indicator:
You can visually compare MC's built-in equity curve (in 2. above) and the result of EC_AllTradesProfit (in red in the indicator panel just above). They are supposed to be the same.
4. When Filter is set to TRUE in the signal, the trades will be taken only when EC_AllTradesProfit (i.e. the equity curve when all trades are taken) is greater than its moving average (150 days). The built-in MC equity curve becomes this one (a bit better):
5. This equity curve is emulated by the function EC_FilteredTradesProfit, in Green in the indicator panel below. It is supposed to be the same as the equity curve presented in 4. just above.
Reminder: in red, the equity curve with all trades taken.
And in dot blue, its moving average.