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

[Metastockusers] RE: Maximum excursion code



PureBytes Links

Trading Reference Links

MAE stands for Maximum Adverse Excursion and MFE for Maximum Favorable
Excursion.

Think of MAE as a kind of stop-loss, which is based on the trade rather than
on the equity.
Actually MAE measures the maximum potential loss of the trade
( entry price – lowest price during the trade ).

MFE is a kind of profit target based on the trade rather on the equity. It
is the maximum profit the trade can produce
( highest price during the trade – entry price ).

Other software like Tradestation, have graphs for the visual inspection of
both MAE and MFE, but Metastock has not.
However, both MAE and MFE can be coded in MS and their use may improve a
system’s results (significantly in some cases).
I also provide a trade-oriented Profit Risk stop. For all three I have used
percentages (as I find them more useful) rather than points.

All these are for the system tester. Alhough at first glance it seems
complicated, it is not.
But if you need any explanations, then please let me know.
Note that "myEnterLongCondition" is the condition you have used in the Enter
Long section, whereas "myEnterShortCondition" is the condition you have used
in the Enter Short section.
So, you must replace these words with the actual conditions used for your
entries. Just copy-paste them.
These two (and if so desired, the entry price, too)  are the only changes
you have to make.
Also if you want - as I suggest - to optimize MAE, MFE and ProfitRisk, don't
forget to visit the Optimize section and try entering some values there.
Don't change anything else in the code. Just use your system as you normally
would.
A thing you might want to try, is eliminating some of the OR statements, in
order to check the system's behavior with and without
specific tools. In this case just make them comments {  .... }
In order to try it, I recommend that you do not use any of the equity-based
stops of the Stops section.

Enter Long:

myEnterLongCondition

Close Long:

EnterLongCond:=myEnterLongCondition; {Copy-paste the condition of your Long
entry}
entryPr:=ValueWhen(1,Cross(EnterLongCond,0.5),Close); {the entry price,
which here is Close. You can change it to whatever.}

MFE:=opt1; {or a constant}
MAE:=opt2; {or a constant}
ProfitRisk:=opt3; {or a constant}
MaxH:=HighestSince(1,myEnterLongCond,H);
ProfitLoss:=Abs((L-MaxH)*100/MaxH);

MyCloseLongCondition {the condition you would normally use for exit}
OR ProfitLoss>ProfitRisk
OR (entryPr-L)*100/L>MAE
OR (H-entryPr)*100/entryPr>MFE
{You can comment out any of the OR statements, or all of them if you want to
test with vs. without any of these options.}

Enter Short:

myEnterShortCondition

Close Short:

EnterShortCond:=myEnterShortCondition; {Copy-paste the condition of your
Short entry}
entryPr:=ValueWhen(1,Cross(EnterShortCond,0.5),Close); {the entry price,
which here is Close. You can change it to whatever.}

MFE:=opt1; {or a constant}
MAE:=opt2; {or a constant}
ProfitRisk:=opt3; {or a constant}
MinL:=LowestSince(1, EnterShortCond,L);
ProfitLoss:=Abs((MinL-H)*100/H);

MyCloseShortCondition {the condition you would normally use for exit}
OR ProfitLoss>ProfitRisk
OR (H-entryPr)*100/entryPr>MAE
OR (entryPr-L)*100/L>MFE
{You can comment out any of the OR statements, or all of them if you want to
test with vs. without any of these options.}

I hope I have not made any serious mistakes in the above code, but you can
try it and tell me. Anyway, don’t trade it until you confirm MAE, MFE and
ProfitRisk by a few manual calculations. Also, any suggestions for
improvements are most welcome.

Since MS users do not have the visual help provided by the graphs, they
should normally try different values for MAE, MFE and ProfitRisk in order to
find their optimal settings.
This is why I used opts. By using them, not only do MS users overcome the
visual problem, but - even better - they have these opt values tested
automatically in their system. So, you now have trade-oriented, optimized
stop-loss, profit target and profit risk.

I hope you like the idea.
Feedback please!

Spyros
________________________________________________________________________

Message: 16
   Date: Sun, 24 Nov 2002 07:25:33 -0600
   From: "Lionel Issen" <lissen@xxxxxxxxxxxxxx>
Subject: RE: Maximum excursion code

Yes!

Lionel Issen



-----Original Message-----
From: SR [mailto:raftsp@xxxxxxxxx]
Sent: Sunday, November 24, 2002 7:10 AM
To: Metastockusers@xxxxxxxxxxxxxxx
Subject: [Metastockusers] Maximum excursion code


I wonder if any of you are already using John Sweeney's maximum
excursion
method (MAE and MFE) with metastock.
If yes, then what code do you use?
If no, it can be easily created in MFL.
Anyone interested in this?

Spyros







------------------------ Yahoo! Groups Sponsor ---------------------~-->
·FREE Health Insurance Quotes-eHealthInsurance.com
http://us.click.yahoo.com/1.voSB/RnFFAA/46VHAA/zMEolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
Metastockusers-unsubscribe@xxxxxxxxxxx

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/