Page 1 of 1

Vintage MACO Replica

Posted: Thu Jun 08, 2006 9:04 am
by heyen
We all know the theory of Simple, Double or Triple Moving Averages.

How about a system that uses only 1 MA and nothing else?

I had trouble modelling a MA CO Model for a future, so i tried a MA Xover with its lagging self. And voila, it did work.

But results improved when using a fast DEMA crossing over its same period EMA thats lagging behind.

This is an intraday trading model.

In case you would like the AmiBroker code:


/* #########################
Lagging MA Crossover Model
Author: Thomas Heyen
Amibroker Professional Code
#########################*/


MarketHours = TimeNum()>=093000 AND TimeNum()<=154400;
MarketClose= TimeNum()>=154444 AND TimeNum()<=240000;
PositionSize = MarginDeposit = 1; // Do not reinvest Profits in backtest

//TF = Optimize("TF",15,15,900,15); // Test 15sec to 15min Bars
/* Timeframe is 2 Minutes */
TimeFrameSet(120);

smooth = Optimize("smooth",20,2,40,1); //20 for DEMA X EMA
Lag = Optimize("lag",24,2,40,1); //24 for

fast = DEMA(C,smooth);
slow = Ref(EMA(C,smooth),-Lag);

Buy = Cross(fast,slow) AND MArkethours;
Sell = Cross(slow,fast) OR MArketclose OR slow == fast;
Cover = Cross(fast,slow) OR MArketclose OR slow == fast;
Short = Cross(slow,fast) AND MArkethours;

PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorGreen);
PlotShapes(IIf(Short,shapeDownArrow,shapeNone),colorRed);

// Plot Trading Ribbon
Color = IIf( BarsSince(Sell)>BarsSince(Buy), colorGreen, IIf( BarsSince(Cover)>BarsSince(Short), colorRed, colorGrey50 ));
Plot( 1, "", Color, styleArea | styleOwnScale | styleNoLabel, -0.1, 15 );

TimeFrameRestore();

Posted: Thu Jun 08, 2006 9:11 am
by michal.kreslik
Wow, the 3D output graphs from AmiBroker do really look cool!

Another way to use only one MA is to focus on the direction changes within that one MA.

Direction changes

Posted: Thu Jun 08, 2006 9:36 am
by heyen
Michal,

your suggestion fits to the "MA NOX"-Idea in the other thread.
I have to get deeper ino this - an uptrend accelleration should
weigh more than a plain reversal. Good point.

But i also think of TRO's multi MA slot mashine.
Maybe if we compare directional change of multi time frame MA's
we could spot interesting correlations.

The 3D graphs of a 2-variable optimization helps to spot if a strategy
is sound. If a certain combination spikes through the breakeven plain
then its not likely to have a good model. But if we have hill we can
accept changes in conditions and still stay profitable.

AmiBroker is my best investment for the past months!

Re: Direction changes

Posted: Thu Jun 08, 2006 9:54 am
by michal.kreslik
heyen wrote:The 3D graphs of a 2-variable optimization helps to spot if a strategy
is sound. If a certain combination spikes through the breakeven plain
then its not likely to have a good model. But if we have hill we can
accept changes in conditions and still stay profitable.


Sure, this is called the nearest neighbor parameter selection. Genetic algorithms, for example, always produce such a gradually shaped fitness landscape.

The problem with 3D graphs is that they can only visualize 3 parameters at a time.