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 #

N-day Breakout
In a message dated 2/26/00 6:47:50 AM Central Standard Time,
jcob3@xxxxxxxxxxx writes:

Help needed for formula wizards.

I have coded the entry for the n-day breakout system from Perry Kaufmann's "Trading Systems and Methods" as:


HIGH>nhigh AND CLOSE > Ref(CLOSE,-1)

I would like to be able to vary "n" using a volatility multiplier like this one taken from Chande's "The New Technical Trader",


so that, ultimately "n" will equal


So far so good, but when I try to implement this into the ENTER LONG Formula
I get the following error message.

"This variable or expression must contain only constant data.", referring to the "n" in the "nhigh" formula.

HIGH>nhigh AND CLOSE > Ref(CLOSE,-1)

After pondering this I thought that maybe it was because the "n" needed to be a whole number for this particular formula; after all, it must be difficult to select a highest high value for a fractional day. Therefore, I altered the formula thusly:


I was willing to accept that the program would round every decimal down. Unfortunately, I received the same error. This makes little sense to me since I can simply put n:= opt1
for as many days as I want and the formula works just fine.

Any help with this little conundrum will be greatly appreciated.


Re: n-day breakout system

· To: metastock@xxxxxxxxxxxxx
· Subject: Re: n-day breakout system
· From: Kevin243@xxxxxxx
· Date: Sat, 26 Feb 2000 18:41:39 EST
· Reply-To: metastock@xxxxxxxxxxxxx
· Sender: owner-metastock@xxxxxxxxxxxxx

In functions like HHV, etc. Metastock language requires a constant for the length of the function. You need to look at the LASTVALUE() function for using as a constant in the HHV function. Try the following code.

N-day Breakout

HIGH>nhigh AND CLOSE > Ref(CLOSE,-1)


Hope this works for you. There are some quirks with using LASTVALUE, but I can't remember what they are. Maybe some one else on the list can help identify the quirks.

Kevin Campbell


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!