MetaStock™ Zone Forum & FAQ Artykuły Linki Elliott Waves EasyLanguage™ Zone

A B C D E F G H I J K L M N O P R S T U V W Y Z #

Timed Exit by Roy Larsen
* To: <metastock@xxxxxxxxxxxxx>
* Subject: Re: Exits
* From: "Roy Larsen" <rlarsen@xxxxxxxxxxxxx>
* Date: Sat, 11 Aug 2001 14:35:14 +1200
* References: <024901c121ee$4d83c960$5d549f40@xxxxx>
* Reply-To: metastock@xxxxxxxxxxxxx
* Sender: owner-metastock@xxxxxxxxxxxxx

Randy

> I am writing a system tester for an idea I had.
> My problem is: I am trying to exit on the fourth day after I enter long.
> On the exit page: I type: BarsSince(Long)==4;
> This will not work. Any ideas?

Try this for a delay timed from the trailing edge of the entry signal. This will function as an indicator provided the entry is also coded as an indicator. To use directly in the System Tester you would need to either still have the entry coded as an indicator or include all the entry code as Signal:=XXXX.

If using the MS System Tester why not use identical code for entry and exit, and use the tester delay facility for Close Long.


Long Entry {only sample}

MACD() > 0
AND
C > Ref(H,-1)
AND
C > Ref(H,-2)
AND
C > Ref(H,-3)

 


Timed Exit TE

{from trailing edge}
Delay:=Input("Exit delay periods",1,50,4);
Signal:=Fml("Long Entry");
Pause:=Alert(Signal,Delay);
Pause=0 AND Alert(Pause,2);

 

 
and this for a delay timed from the leading edge of the entry signal.

 


Timed Exit LE

{from leading edge}
Delay:=Input("Exit delay periods",1,50,4);
Signal:=Fml("Long Entry");
Edge:=Signal AND Alert(Signal=0,2);
Pause:=Alert(Edge,Delay);
Pause=0 AND Alert(Pause,2);

 

Roy

PS: I have deliberately used the Alert() function rather than the Ref() function so as not to extend the indicator undefined period. However you need to be aware that the Alert() function can only be used directly with binary data (0 or 1).

Source / From: TOP
http://purebytes.com/archives/metastock/

Equis and MetaStock® and MetaStock Professional® are registered trademarks of Equis International. Achelis Binary Wave®, The DownLoader®,
Expert Advisor®, OptionScope®, Quotecenter® and Smart Charts® are trademarks of Equis International, a Thomson Reuters company.

TradeStation® Pro, TradeStation® 2000i, OptionStation®, SuperCharts®, PowerEditor® and EasyLanguage®
are registered trademarks of TradeStation Technologies, Inc. Other names and marks referred to are the property of their respective owners.

All information provided on this website is for educational purposes only. Trading involves risk, including possible loss of principal and other losses.

Ten i inne materiały na tej stronie zostały zamieszczone zostały jedynie w celach edukacyjnych, nie ponoszę żadnej odpowiedzialno¶ci za ich stosowanie.

Gra na giełdzie i rynkach walutowych (FOREX) niesie ze sob± ryzyko poważnych strat finansowych!