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

Re: Variable period channel - need help with formula



PureBytes Links

Trading Reference Links

Shashi,

Welcome to the "Metastock Coding Nightmare World"!

Metastock will not allow variables that are dynamic in the way that you have 
described..."thus, when ADX is high, the channel length will be short & vice 
versa".

The work arounds would be:

1. Use "If" statements to define the value of the channel length at various 
ADX levels.

2. Use a variable length DLL. These are not widely available but do exist.

Let us know how it turns out.

J.


>From: Shashi Aggarwal <shashiag@xxxxxxxxxx>
>Reply-To: metastock@xxxxxxxxxxxxx
>To: "Metastock Digest (E-mail)" <metastock@xxxxxxxxxxxxxxxxxx>
>Subject: Variable period channel - need help with formula
>Date: Sun, 27 Jan 2002 12:58:13 -0600
>
>I was trying to create a variable-period channel indicator, as follows:
>
>Days:= Round(150/ADX(14));
>HHV(H,Days);
>LLV(L,Days);
>
>[Note: The round function is merely to round up or round down the resulting
>fraction to the nearest integer].
>
>However, I get this error message: "This variable or expression must 
>contain
>only constant data" (referring to the variable 'Days' in the HHV & LLV
>arguments). [Note: the error message is also there when I substitute
>PriceChannelHigh(Days) for HHV(H,Days) and PriceChannelLow(Days) for
>LLV(L,Days)].
>
>One workaround I came up with is to modify the Days argument, as follows:
>
>Days:= LastValue(Round(150/ADX(14)));
>HHV(H,Days);
>LLV(L,Days);
>
>However, while this makes the error message go away, it results in a price
>channel that is based on the last value of 150/ADX(14) and this is constant
>across the entire chart. This, of course, defeats the purpose of the
>indicator as I want the channel length to vary with the 14-day ADX across
>the entire chart - thus, when ADX is high, the channel length will be short
>& vice versa.
>
>Can anyone suggest a solution? Thanks.
>
>Shashi
>




_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com