Rechercher sur le site

moyenne mobile auto adaptative

Aller au dernier message
Posté par : joe coe le 09 May 2007, 00:45
salut à vous,

J'ouvre cette file désepéré par le peu de choses sur la question sur les sites francophones.

pour tout dire, je suis tombé sur ce code PRT :

Moyenne mobile Adaptative de Kaufman
ONCE ama = UNDEFINED

signal = ABS(MOMENTUM[p])
noise = SUMMATION[p](ABS(MOMENTUM[1]))

IF noise>0 THEN
er = signal / noise
ELSE
er=1
ENDIF

fastsc = 2 / (2+ 1)
slowsc = 2 / (30 + 1)

factor = SQUARE(er * (fastsc - slowsc) + slowsc)

IF BARINDEX = p THEN
ama = CLOSE
ELSIF BARINDEX > p THEN
ama = ama + factor * (CLOSE - ama)
ENDIF

RETURN ama

Je trouve le code plus que douteux particulièrement quand je vois ça :
fastsc = 2 / (2+ 1)
slowsc = 2 / (30 + 1)


Aussi j'en appelle à vous....
Je suis le maître de mon destin,Je suis le capitaine de mon âme.
Posté par : jcd le 09 May 2007, 09:12
Adaptive Moving Average System by Perry Kaufman
The adaptive moving average that was discussed in the interview with Perry Kaufman in the 1998 STOCKS & COMMODITIES Bonus Issue (the article originally appeared in March 1995) is an excellent alternative to standard moving average calculations. In this month's Traders' Tips, I will present two Easy Language studies and an Easy Language system that are based on the adaptive moving average.

The adaptive moving average calculation that is used in the studies and system in TradeStation or SuperCharts is performed primarily by a function referred to as "AMA." Another function referred to as "AMAF" is used to calculate the adaptive moving average filter. As always, the functions should be created prior to the development of the studies/system.

AMA

Inputs: Period(Numeric);
Vars: Noise(0), Signal(0), Diff(0), efRatio(0), Smooth(1), Fastest(.6667), Slowest(.0645), AdaptMA(0);
Diff = AbsValue(Close - Close[1]);
IF CurrentBar <= Period Then AdaptMA = Close;
IF CurrentBar > Period Then Begin
Signal = AbsValue(Close - Close[Period]);
Noise = Summation(Diff, Period);
efRatio = Signal / Noise;
Smooth = Power(efRatio * (Fastest - Slowest) + Slowest, 2);
AdaptMA = AdaptMA[1] + Smooth * (Close - AdaptMA[1]);
End;
AMA = AdaptMA;

AMAF

Inputs: Period(Numeric), Pcnt(Numeric);
Vars: Noise(0), Signal(0), Diff(0), efRatio(0), Smooth(1), Fastest(.6667), Slowest(.0645), AdaptMA(0), AMAFltr(0);
Diff = AbsValue(Close - Close[1]);
IF CurrentBar <= Period Then AdaptMA = Close;
IF CurrentBar > Period Then Begin
Signal = AbsValue(Close - Close[Period]);
Noise = Summation(Diff, Period);
efRatio = Signal / Noise;
Smooth = Power(efRatio * (Fastest - Slowest) + Slowest, 2);
AdaptMA = AdaptMA[1] + Smooth * (Close - AdaptMA[1]);
AMAFltr = StdDev(AdaptMA-AdaptMA[1], Period) * Pcnt;
End;
AMAF = AMAFltr;

The "MovAvg Adaptive Fltr" system below is based on the rules set forth for entries based on the filtered adaptive moving average calculation.

Adaptive Moving Average Fltr System

Inputs: Period(10), Pcnt(.15);
Vars: AMAVal(0), AMAFVal(0), AMALs(0), AMAHs(0);
AMAVal = AMA(Period);
AMAFVAl = AMAF(Period, Pcnt);
IF CurrentBar = 1 Then Begin
AMALs = AMAVal;
AMAHs = AMAVal;
End Else Begin
IF AMAVal < AMAVal[1] Then
AMALs = AMAVal;
IF AMAVal > AMAVal[1] Then
AMAHs = AMAVal;
IF AMAVal - AMALs Crosses Above AMAFVal Then
Buy This Bar on Close;
IF AMAHs - AMAVal Crosses Above AMAFVal Then
Sell This Bar on Close;
End;

The second indicator, "Mov Avg Adaptive Fltr," takes the filtering concept and applies it to an indicator. Based on the filtered adaptive moving average (AMAF) parameters, this indicator will plot a vertical blue or red line, depending on the condition that is met. The values reflected by the vertical lines reflect the value of the AMA filter calculation. Some suggested format settings are given after the indicator code.

Adaptive Moving Average Fltr System

Inputs: Period(10), Pcnt(.15);
Vars: AMAVal(0), AMAFVal(0), AMALs(0), AMAHs(0);
AMAVal = AMA(Period);
AMAFVAl = AMAF(Period, Pcnt);
IF CurrentBar = 1 Then Begin
AMALs = AMAVal;
AMAHs = AMAVal;
End Else Begin
IF AMAVal < AMAVal[1] Then
AMALs = AMAVal;
IF AMAVal > AMAVal[1] Then
AMAHs = AMAVal;
IF AMAVal - AMALs Crosses Above AMAFVal Then
Buy This Bar on Close;
IF AMAHs - AMAVal Crosses Above AMAFVal Then
Sell This Bar on Close;
End;
JC
Posté par : joe coe le 09 May 2007, 15:12
jcd a écrit:
Adaptive Moving Average System by Perry Kaufman
The adaptive moving average that was discussed in the interview with Perry Kaufman in the 1998 STOCKS & COMMODITIES Bonus Issue (the article originally appeared in March 1995) is an excellent alternative to standard moving average calculations. In this month's Traders' Tips, I will present two Easy Language studies and an Easy Language system that are based on the adaptive moving average.

The adaptive moving average calculation that is used in the studies and system in TradeStation or SuperCharts is performed primarily by a function referred to as "AMA." Another function referred to as "AMAF" is used to calculate the adaptive moving average filter. As always, the functions should be created prior to the development of the studies/system.

AMA

Inputs: Period(Numeric);
Vars: Noise(0), Signal(0), Diff(0), efRatio(0), Smooth(1), Fastest(.6667), Slowest(.0645), AdaptMA(0);
Diff = AbsValue(Close - Close[1]);
IF CurrentBar <= Period Then AdaptMA = Close;
IF CurrentBar > Period Then Begin
Signal = AbsValue(Close - Close[Period]);
Noise = Summation(Diff, Period);
efRatio = Signal / Noise;
Smooth = Power(efRatio * (Fastest - Slowest) + Slowest, 2);
AdaptMA = AdaptMA[1] + Smooth * (Close - AdaptMA[1]);
End;
AMA = AdaptMA;

AMAF

Inputs: Period(Numeric), Pcnt(Numeric);
Vars: Noise(0), Signal(0), Diff(0), efRatio(0), Smooth(1), Fastest(.6667), Slowest(.0645), AdaptMA(0), AMAFltr(0);
Diff = AbsValue(Close - Close[1]);
IF CurrentBar <= Period Then AdaptMA = Close;
IF CurrentBar > Period Then Begin
Signal = AbsValue(Close - Close[Period]);
Noise = Summation(Diff, Period);
efRatio = Signal / Noise;
Smooth = Power(efRatio * (Fastest - Slowest) + Slowest, 2);
AdaptMA = AdaptMA[1] + Smooth * (Close - AdaptMA[1]);
AMAFltr = StdDev(AdaptMA-AdaptMA[1], Period) * Pcnt;
End;
AMAF = AMAFltr;

The "MovAvg Adaptive Fltr" system below is based on the rules set forth for entries based on the filtered adaptive moving average calculation.

Adaptive Moving Average Fltr System

Inputs: Period(10), Pcnt(.15);
Vars: AMAVal(0), AMAFVal(0), AMALs(0), AMAHs(0);
AMAVal = AMA(Period);
AMAFVAl = AMAF(Period, Pcnt);
IF CurrentBar = 1 Then Begin
AMALs = AMAVal;
AMAHs = AMAVal;
End Else Begin
IF AMAVal < AMAVal[1] Then
AMALs = AMAVal;
IF AMAVal > AMAVal[1] Then
AMAHs = AMAVal;
IF AMAVal - AMALs Crosses Above AMAFVal Then
Buy This Bar on Close;
IF AMAHs - AMAVal Crosses Above AMAFVal Then
Sell This Bar on Close;
End;

The second indicator, "Mov Avg Adaptive Fltr," takes the filtering concept and applies it to an indicator. Based on the filtered adaptive moving average (AMAF) parameters, this indicator will plot a vertical blue or red line, depending on the condition that is met. The values reflected by the vertical lines reflect the value of the AMA filter calculation. Some suggested format settings are given after the indicator code.

Adaptive Moving Average Fltr System

Inputs: Period(10), Pcnt(.15);
Vars: AMAVal(0), AMAFVal(0), AMALs(0), AMAHs(0);
AMAVal = AMA(Period);
AMAFVAl = AMAF(Period, Pcnt);
IF CurrentBar = 1 Then Begin
AMALs = AMAVal;
AMAHs = AMAVal;
End Else Begin
IF AMAVal < AMAVal[1] Then
AMALs = AMAVal;
IF AMAVal > AMAVal[1] Then
AMAHs = AMAVal;
IF AMAVal - AMALs Crosses Above AMAFVal Then
Buy This Bar on Close;
IF AMAHs - AMAVal Crosses Above AMAFVal Then
Sell This Bar on Close;
End;

comme toujours

merci
Je suis le maître de mon destin,Je suis le capitaine de mon âme.
Posté par : Sequoia le 09 May 2007, 15:29
Vous pouvez en dire un peu plus sur cette MM esotérique pour les profanes ?

Merci.
"Si tu veux un ami, achète-toi un chien" Gordon Gekko (Wall Street) TradeArt / MoneyArt http://www.cedricmnich.com
Posté par : joe coe le 09 May 2007, 17:52
Sequoia a écrit:
Vous pouvez en dire un peu plus sur cette MM esotérique pour les profanes ?

Merci.

pour l'instant non

j'ai le nom, j'ai le code, il me reste à regardé tout ça de prêt...

Je commence à me repencher sur les indicateurs

Mais vous pouvez commencer sans moi d'autant que mon planning est pour le moins difficile à tenir en général
Je suis le maître de mon destin,Je suis le capitaine de mon âme.
Posté par : jcd le 10 May 2007, 08:10
Bonjour,

Cette moyenne est assez complexe à développer et je n'ai jamais travaillé ce sujet n'ayant pas assimilé l'intérêt de cet outil. Il existe déjà bon nombre de moyennes mobiles

Dans son bouquin Kaufmann y consacre 25 pages donc ce qui est ci dessous n'est qu'un tout petit résumé

Cette moyenne est recommandé sur au plus 10 périodes
c'est une MME
il y a une constante ayant pour objectif de permettre l'élimination du bruit de fond

ET voici ce résume de l'auteur

The Adaptive Moving Average

The smoothing constant c is calculated every day and used in the exponential
moving average formula. This becomes an Adaptive Moving Average:

Adaptive Moving Average:

AMA = AMA[1] + smoothconstant x (price - AMA[1))

The complete calculation of the AMA can be found in Box8-2. This trendline
has special features:

It uses a smaH number of days (always fixed at 10 in this book) to
assign a trend range from very fast to very slow.

The AMA trendline appears ta stop when markets have no direction.

When priees make a signifieant move, the AMA trendline catches up,
resulting in a very small lag .

Only one parameter may be changed. The Efficiency Ratio can be
based on a IO-day calculation, and that time period may be used for
all markets. The filter size (discussed later) allows sorne flexibility for
different trading speeds.

The AMA was based on analysis rather than testing.

cela est dans un bouquin de 1995 mais l'article de S&C est beaucoup plus ancien et disponible sur le site S&C moyennant quelques $ US et au format pdf
JC
bourse