Inverse Return To Mean System

DRAFT ONLY - SUBJECT TO CHANGE

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//P_InverseRTM  
//A SYSTEM BASED ON THE INVERSE OF A REVERSION TO MEAN  
//The one bar ROC of three moving averages is used to test for a bull trend 
 
ShortTermMA = ROC(MA(C,30),1);
MediumTermMA = ROC(MA(C,50),1);
LongTermMA = ROC(MA(C,100),1);  
 
Condition1 = ShortTermMA > 0 AND MediumTermMA > 0 AND LongTermMA > 0;  
 
Buy = Condition1;
Sell = 0;  
 
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, High ) );

This plots an up arrow for every bar where the 3 MA’s are moving up.

IRTM001 

Another way to do the same thing (the bull condition is meet a little earlier).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//P_InverseRTM  
//A SYSTEM BASED ON THE INVERSE OF A REVERSION TO MEAN  
//The one bar ROC of three moving averages is used to test for a bull trend  
 
//ShortTermMA = ROC(MA(C,30),1);
//MediumTermMA = ROC(MA(C,50),1);
//LongTermMA = ROC(MA(C,100),1);  
 
ShortTermMA = MA(C,30);
MediumTermMA = MA(C,50);
LongTermMA = MA(C,100);  
 
Condition1 = ShortTermMA > MediumTermMA AND MediumTermMA > LongTermMA;  
 
Buy = Condition1;
Sell = 0;  
 
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, High ) );

IRTM002

Add a condition to screen for reversal bars (using the second MA method).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//P_InverseRTM  
//A SYSTEM BASED ON THE INVERSE OF A REVERSION TO MEAN  
//The one bar ROC of three moving averages is used to test for a bull trend  
 
//ShortTermMAChange = ROC(MA(C,30),1);
//MediumTermMAChange = ROC(MA(C,50),1);
//LongTermMAChange = ROC(MA(C,100),1);  
 
ShortTermMA = MA(C,30);
MediumTermMA = MA(C,50);
LongTermMA = MA(C,100);  
 
ReverseTrend = Ref(L,-1) > Ref(ShortTermMA,-1) AND L < ShortTermMA;  
 
Condition1 = ShortTermMA > MediumTermMA AND MediumTermMA > LongTermMA;
Condition2 = ReverseTrend == 1;  
 
Buy = Condition2;// AND Condition2;
Sell = 0;  
 
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, High ) );

IRTM003

The first buy signal (marked by the green up arrow) meets the system criteria but the second violates the 50 MA rule and the third breaks the MA bias rule.

Changing back to the first MA method:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//P_InverseRTM  
//A SYSTEM BASED ON THE INVERSE OF A REVERSION TO MEAN  
//The one bar ROC of three moving averages is used to test for a bull trend  
 
ShortTermMAChange = ROC(MA(C,30),1);
MediumTermMAChange = ROC(MA(C,50),1);
LongTermMAChange = ROC(MA(C,100),1);  
 
ShortTermMA = MA(C,30);
MediumTermMA = MA(C,50);
LongTermMA = MA(C,100);  
 
ReverseTrend = Ref(L,-1) > Ref(ShortTermMA,-1) AND L < ShortTermMA;  
 
//Condition1 = ShortTermMA > MediumTermMA AND MediumTermMA > LongTermMA;
Condition1 = ShortTermMAChange > 0 AND MediumTermMAChange > 0 AND LongTermMAChange > 0;  
Condition2 = ReverseTrend;  
 
Buy = Condition1 AND Condition2;
Sell = 0;  
 
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, High ) );

This restores the MA bias as per the rules.

IRTM004 

Adding a third condition excludes trend reversals that cross the 50 MA (on the close).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//P_InverseRTM  
//A SYSTEM BASED ON THE INVERSE OF A REVERSION TO MEAN  
//The one bar ROC of three moving averages is used to test for a bull trend  
 
ShortTermMAChange = ROC(MA(C,30),1);
MediumTermMAChange = ROC(MA(C,50),1);
LongTermMAChange = ROC(MA(C,100),1);  
 
ShortTermMA = MA(C,30);
MediumTermMA = MA(C,50);
LongTermMA = MA(C,100);  
 
ReverseTrend = Ref(L,-1) > Ref(ShortTermMA,-1) AND L < ShortTermMA;  
 
//Condition1 = ShortTermMA > MediumTermMA AND MediumTermMA > LongTermMA;
Condition1 = ShortTermMAChange > 0 AND MediumTermMAChange > 0 AND LongTermMAChange > 0;
Condition2 = ReverseTrend;
Condition3 = C > MediumTermMA;  
 
Buy = Condition1 AND Condition2 AND Condition3;
Sell = 0;  
 
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, High ) );

IRTM005

That ’screens’ the charts for bars that meet the trade conditions (raw signal) - to turn it into a system it needs specific entry and exit rules (stops) - followed by testing and the addition of money management rules.

Moving up the chart, and looking at a longer period, the ’system’ produced two wins and one loss in 9 months of ‘trading’ one stock from the S&P500 (that isn’t a typical outcome and the author picked a favorable part of the chart.

IRTM006

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5 out of 5)
Loading ... Loading ...

No comments yet. Be the first.

Leave a reply