logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
davidnjina  
#1 Posted : Thursday, October 13, 2005 11:32:20 PM(UTC)
davidnjina

Rank: Newbie

Groups: Registered, Registered Users
Joined: 10/13/2005(UTC)
Posts: 3

Hi everyone, thanks in advance for your help. I am trying to come up with a constant that capture 95%-96% of all prices in the range defined by Upper Price Channel = MA + Constant Lower Price Channel = MA - Constant My question isn't how to code the above, but how to make it automatically calculate it. For example, I want to code the following procedures: 1. default contant = 10 2. Calculate how much is capptured with the default constant. 3. If < then 95% then increase constant by 1 and rerun. If between 95% and 96% then stop. If > 96% then decrease constant by 1 and rerun. 4. If < then 95% before and > 96% now (or vice versa), then use increament of 0.5 (or -0.5), otherwise it will stop when between 95% and 96%. 5. Plot Upper and Lower Channels using the calculated constant. My Question is is there 'do while' or other iterative procedures in metastock. I didn't see them in the primer. David
Jose  
#2 Posted : Friday, October 14, 2005 4:16:54 AM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
Unfortunately there is no loop function available in MetaStock, but you could achieve a similar result by using the LastValue() function to count the number of 95% band outliers, and if this is more than 5%, adjust the constant. Run half a dozen or so code iterations within the formula, and you'll come fairly close to your aim. Note that this method uses hindsight, as there is no way of creating bands that cover 95% of price without looking back in price history. jose '-)
davidnjina  
#3 Posted : Friday, October 14, 2005 9:16:52 PM(UTC)
davidnjina

Rank: Newbie

Groups: Registered, Registered Users
Joined: 10/13/2005(UTC)
Posts: 3

Jose, Thank you for your insight. By the way, very impressive resume you got on your website. :) I am also interested in the MACD-H Divergence Kit, but the price seem to be out of my reach. I may have to manually look for MACD-H divergences till I can afford your kit. :) By the way, do you give a discount? I came across Alex Elder's book in the last month and read probably three times already. I like what I read and my first attempt is to come up with price channels that I feel comfortable with. Anyway, I tried your approach to run about a dozen or so code iterations and estimate the coefficients using those outcomes. This is perfectly okay because we are not looking for exact number here. I ran into trouble due to a fact that I can't just copy and paste endless pages of codes into MS. I had to breakdown into smaller chunks. What's the limitation on the length of formula? I was playing with your codes for auto-envelope indicator. Great codes. Thank you for sharing. I based mine off of yours. :) I noticed that your channel size was based on HHV and LLV fuctions and when price turns around sharply but with little volatility your channels looks too wide. There isn't an objective standard for measuring how wide is too wide (is there?) so don't take any offense at my comments. I just wanted to have your feedback on my thoughts. :) One thing that you misunderstood was that I didn't want to count the number of bars to cover the 95%. I was actually looking at the whole price range (H to L). For example, if upper and lower channels were greater and less than high and low, respectively then 100% of that price range will be included. I think I was successful coming up with percent of price ranges between the upper and lower channels (given a coefficient). I then run about a dozen iterative procedures (as you describe, but I am not using lastvalue fuction), and then use linear interpolation to come up with a coefficient that seem to work I ran explorer on 164 stocks that I am watching and there was a single error. I think that's a good start. :) The calculation takes bit long. One thing I notice is that when I run the expert advise with estimate for tomorrow's upper and lower channel lines, (based on today's level plus 11-day moving exponential average of 1-day ROC of channel lines - do you have better ideas here?), I get answers different than when I use the same fuctions to run in explorer. Is there anything (limitation wise) that will cause my explorer using same formula to give you different answers? I am seeing for example values of estimated tomorrow upper and lower channels differ between the expert advice and the explorer even though I am calling the exact same functions. I'll come up with more questions when you reply. Again, thanks for your help. David
Jose  
#4 Posted : Friday, October 14, 2005 9:49:54 PM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
David, I don't have all the answers, but here are some:
davidnjina wrote:
I am also interested in the MACD-H Divergence Kit, but the price seem to be out of my reach. I may have to manually look for MACD-H divergences till I can afford your kit. :) By the way, do you give a discount?
I sometimes give a discount to established clients for tools such as the MACDH Divergence kit, but I try not to advertise this.
davidnjina wrote:
... into MS. I had to breakdown into smaller chunks. What's the limitation on the length of formula?
2499 characters for indicators, less for the System Tester. One way around this MetaStock limitation is to split the formula into several parts, and reference them in a final indicator: Fml("part 1")+Fml("part 2")+Fml("part 3")+...
davidnjina wrote:
I was playing with your codes for auto-envelope indicator. Great codes. Thank you for sharing. I based mine off of yours. :) I noticed that your channel size was based on HHV and LLV fuctions and when price turns around sharply but with little volatility your channels looks too wide.
I've based that code on Dr Elder's definition, without the hindsight-based LastValue() function as used in Dr Elder's MetaStock kit.
davidnjina wrote:
There isn't an objective standard for measuring how wide is too wide (is there?)
It really depends on the individual trader's risk profile.
davidnjina wrote:
so don't take any offense at my comments. I just wanted to have your feedback on my thoughts. :)
Oopsey, there goes the discount... :?
davidnjina wrote:
I get answers different than when I use the same fuctions to run in explorer.
This happens when the number of exploration periods loaded differs from the chart's loaded periods. Make sure they are both identical - try this: MetaStock -> Tools -> The Explorer -> Options -> Load 2600 records -> Ok -> Explore. jose '-)
davidnjina  
#5 Posted : Friday, October 14, 2005 10:56:58 PM(UTC)
davidnjina

Rank: Newbie

Groups: Registered, Registered Users
Joined: 10/13/2005(UTC)
Posts: 3

Thank you. Loading 2600 records into explorer works but the calculation is a crawl now. :) I ran the exploration on 164 stocks and it took almost two minutes to finish but I can live with that. David
Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.