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

RE: [Metastockusers] RE: MS System Tester Question



PureBytes Links

Trading Reference Links

Spyros:

Thank you for your help concerning my MS system tester question.
I am able to use the software that you sent me.

Thanks again.

Bob

Original Message:
-----------------
From: SR raftsp@xxxxxxxxx
Date: Sun, 9 Feb 2003 15:17:16 +0200
To: Metastockusers@xxxxxxxxxxxxxxx
Subject: [Metastockusers] RE: MS System Tester Question


Bob,

a while ago I posted a message about J. Sweeney's
maximum adverse excursion (MAE) and maximum favorable excursion
(MFE). The first acts as a trade-based stop-loss
(what you are asking for, I think) and the second as a profit target stop.
The code is this:

Excursion for Close Long

Cond:= LongEntryCondition; {copy from Enter Long}
entryPr:=ValueWhen(1,Cross(Cond,0.5),C);
MFE:=opt1; {optimize or use any fixed value}
MAE:=opt2; {optimize or use any fixed value}

LongExitCondition OR
(entryPr-L)*100/L>MAE OR
(H-entryPr)*100/entryPr>MFE


Excursion for Close Short

Cond:=ShortEntryCondition;{copy from Enter Short}
entryPr:=ValueWhen(1,Cross(Cond,0.5),C);
MFE:=opt1; {optimize or use any fixed value}
MAE:=opt2; {optimize or use any fixed value}

ShortExitCondition OR
(H-entryPr)*100/entryPr>MAE OR
(entryPr-L)*100/L>MFE

The above uses percentages but can be simplified to calculate points.
You will be stopped out as soon as your MAE (loss) has exceeded the value
you have
provided, or as soon as your MFE (profit) has exceeded the corresponding
value.
If you don't need MFE, you can comment out all the statements that refer to
it.

LongEntryCondition is the condition you use to Enter Long. You can
copy-paste
the code from that section.
LongExitCondition is your normal Close Long condition.
ShortEntryCondition is the condition you use to Enter Short. You can
copy-paste
the code from there.
ShortExitCondition is your normal Close Short condition.

For example your movs crossover system could look like:

Enter Long

cross(mov(C,5,S),mov(C,10,S))

Close Long

Cond:= cross(mov(C,5,S),mov(C,10,S)); {copy from Enter Long}
entryPr:=ValueWhen(1,Cross(Cond,0.5),C);
{MFE:=opt1;} {optimize or use any fixed value}
MAE:=opt2; {optimize or use any fixed value}

cross(mov(C,10,S),mov(C,5,S)) OR
(entryPr-L)*100/L>MAE {OR
(H-entryPr)*100/entryPr>MFE}

Enter Short

cross(mov(C,10,S),mov(C,5,S))

Close Short

Cond:=cross(mov(C,10,S),mov(C,5,S));{copy from Enter Short}
entryPr:=ValueWhen(1,Cross(Cond,0.5),C);
{MFE:=opt1;} {optimize or use any fixed value}
MAE:=opt2; {optimize or use any fixed value}

cross(mov(C,5,S),mov(C,10,S)) OR
(H-entryPr)*100/entryPr>MAE {OR
(entryPr-L)*100/L>MFE}


As you see I have commented out the MFE related statements,
so that only MAE is active. You could delete them but but
leaving them commented is a more practical approach.
To use points rather than percentages you can simply change
statements like this:
(H-entryPr)*100/entryPr>MAE
to this:
H-entryPr>MAE

Notice that these formulas calculate the loss and profit
using the High and Low prices (Maximum Excursion), but you could
watch for changes of Close prices as well. Just use Close in
High's and Low's places.
Also these formulas work fine with Entry conditions which are guaranteed
to occur only once before a normal Exit or Stop signal is encountered
(like with our movs crossing example). But if multiple entry signals occur
then a position formula should also be used.

Spyros

----------------------------------------------

Message: 9
   Date: Sat, 8 Feb 2003 17:47:43 -0500
   From: "bob1@xxxxxxxxxxxx" <bob1@xxxxxxxxxxxx>
Subject: MS System Tester Question

All:

I have a Metastock System Tester question.  Is there a way
to make an entry in the close long and close short boxes
to cut a loss.  If the formula in the open long or open short
box generates a signal, is there a way to "cut your losses"
with a formula in the close long and close short boxes.

An example is using crossing moving averages.  If the market
goes against you, rather than waiting for the moving averages
to cross again to close a long or short position, can you add
an OR condition to limit your loss to a specified number of
points?

I hope that my question is clear.
Thank you.

Bob

--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .







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/ 



--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .



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/