- Katılım
- 23 Eki 2020
- Mesajlar
- 1,826
Re: Variable period channel - need help with formula * To: metastock@xxxxxxxxxxxxx * Subject: Re: Variable period channel - need help with formula * From: "j seed" <jseed_10@xxxxxxxxxxx> * Date: Wed, 30 Jan 2002 03:04:03 +0000 * Reply-To: metastock@xxxxxxxxxxxxx * Sender: owner-metastock@xxxxxxxxxxxxx > >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 >From: Shashi Aggarwal <shashiag@xxxxxxxxxx> >Reply-To: metastock@xxxxxxxxxxxxx >To: "Metastock Digest (E-mail)" <metastock@xxxxxxxxxxxxxxxxxx> >Subject: Re: Variable period channel - need help with formula >Date: Tue, 29 Jan 2002 14:02:01 -0600 > >Seed, > >I used the "If" argument as you described, but still got the same error >("This variable or expression must contain only constant data"), so that >appears to be a dead end. > >Your 2nd suggestion is interesting; however, since I am not a computer >scientist/programmer, I don't know how to create a DLL. Do you know if >anyone has created a variable-length DLL, or where it might be available >(is there a repository for Metastock DLLs that you are aware of?)? > >Shashi > >------------------------------ > >Date: Mon, 28 Jan 2002 21:37:45 +0000 >From: "j seed" <jseed_10@xxxxxxxxxxx> >Subject: Re: Variable period channel - need help with formula > >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. Shashi, |
|
Variable Period Channel DAYS:= Round(150/ADX(14)); HDDX:=If(DAYS>10,HHV(H,5),If(DAYS>5 AND DAYS<10,HHV(H,10),HHV(H,15))); LDDX:=If(DAYS>10,LLV(L,5),If(DAYS>5 AND DAYS<10,LLV(L,10),LLV(L,15))); HDDX; LDDX; |
Source / From: |