PureBytes Links
Trading Reference Links
|
Dans un courrier daté du 27/09/98 04:17:06 , Lincoln Fiske écrit :
<<
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.
>>
Right.
The code was written to use the OpenEquity function, but it was easy to
modify:
Knowing the Equity on close value and the High Low of the bar allows to
display the MAE& MFE based on the bars values.
The code below should meet your needs.
There are lot of things that can be done in EL and that are not provided with
the software...
Sincerely,
Pierre Orphelin
{================<=Code starts here=========================
Maximum Adverse Excursion / Maximum Favorable Excursion
- TradeStation code using price extremes -
Code by Pierre Orphelin [1998].
http://www.sirtrade.com
Based on John Sweeney's MAE MFE concepts.
Maxbarsback set to 1.
Scaling set to "screen".
======================================================}
vars:mp(0),eqt(0),eprix(0),mae(0),mfe(0),memmae(0),memmfe(0),temp1(0),temp2(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
value1=eqt-eprix+(h-c)*BigPointValue;
value2=eqt-eprix+(c-l)*BigPointValue;
temp1=maxlist(value1,value2);
temp2=minlist(value1,value2);
if temp1>mfe then mfe=temp1;
if temp2<mae then mae=temp2;
end;
plot1(-memmae,"MAE");
plot2(memmfe,"MFE");
plot3(-mae,"mae");
plot4(mfe,"mfe");
{====================END of code==============================}
|