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 #

Trailing Stop Indicator III by Adam Hefner
Trailing Stop Indicator Dilemma

. To: <metastock@xxxxxxxxxxxxx>
. Subject: Trailing Stop Indicator Dilemma
. From: "Barry Marx" <bmarx@xxxxxxxxx>
. Date: Wed, 5 May 1999 01:26:01 -0400
. Reply-To: metastock@xxxxxxxxxxxxx
. Sender: owner-metastock@xxxxxxxxxxxxx

I am trying to write an indicator that displays a trailing stop as a fixed percentage of the closing price, but never goes lower, only higher (for long positions).

The following seems to do the job for long positions, giving a 10% fixed stop:

If((C*0.9) >= PREV, (C*0.9), PREV);

Next, I tried to apply the same idea to short positions with:

If((C*1.1) <= PREV, (C*1.1), PREV);

The intention was to plot a stop value that was 10% above the close, but never to be raised higher than the previous day's value.

The second formula plots a line with a constant value of zero, presumably because the initial value of PREV is zero, and the value of C*1.1 is never less than that. I've tried several alternate approaches, but seem to keep coming back to the same problem of needing to use PREV.

I'm stuck, so any ideas would be appreciated. Is this simply another limitation of the language?



Re: Trailing Stop Indicator Dilemma

. To: <metastock@xxxxxxxxxxxxx>
. Subject: Re: Trailing Stop Indicator Dilemma
. From: "VonHef" <VonHef@xxxxxxxxxxxxx>
. Date: Wed, 5 May 1999 07:18:52 -0500
. Organization: Microsoft Corporation
. References: <01be96b7$c3897660$10754d0c@xxxxx>
. Reply-To: metastock@xxxxxxxxxxxxx
. Sender: owner-metastock@xxxxxxxxxxxxx

Hi Barry,
Try this:


Trailing Stop Indicator III by Adam Hefner

{then} Close,
{else} If((C*1.1) <= PREV,
{else} PREV));


This will always use the value of the close on the first bar of the chart.

Best wishes,
Adam Hefner.

Source / From: TOP

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!