[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MAE/MFE (was:Re: System Exits)



PureBytes Links

Trading Reference Links

I believe this code isn't truly MAE/MFE, since the equity calculation it
uses (OpenEquity function) is based on the closes of bars, rather than
extremes. At least that's what it does when I run it. Does anyone have a
simple way to do it so it calculates the actual maximum? I know it can be
done using print statements in your system code, but is there a simpler
way? Too bad Omega dropped this from System Writer.

Thanks.

Gaius Marius wrote:

> :In the omega arhive (see below ) Craig (Nelson?) posted on Fri, 04 Oct
> :96 "My Favorite Stop Method"  (see below).
> :Anyone got the code for the "MAE"?
>
> ----------------------------------------------------------
> Maximum Adverse Excursion  and Maximum Favorable Excursion
> by Pierre Orphelin
>
> {Indicator; MAE/MFE}
> vars:mp(0),eqt(0),eprix(0),mae(0),mfe(0),memmae(0),memmfe(0),temp(0);
> mp=I_MarketPosition;
> eqt=I_OpenEquity;
>
> if mp<>mp[1] and absvalue(mp[1])=1 then begin
>  eprix=eqt;
>  mae=0;
>  mfe=0;
>  if mae[1]<memmae then memmae=mae[1];
>  if mfe[1]>memmfe then memmfe=mfe[1];
>  end else begin
>  temp=eqt-eprix;
>  if temp>mfe then mfe=temp;
>  if temp<mae then mae=temp;
>  end;
> plot1(-memmae,"MAE");
> plot2(memmfe,"MFE");
>
> plot3(-mae,"mae");
> plot4(mfe,"mfe");
>