PureBytes Links
Trading Reference Links
|
Hi John
I thought my reply yesterday would have given you enough information to come up with a simpler formula such as the one that follows. I apologise if I did not give sufficient information.
C>Mov(C,30,E);
Putting your formula aside for a moment let's just work from your stated conditions. I'm not going to try and second-guess what you really meant if it is something different from what you said.
"If the closing price crosses above the 30 week EMA or is already above the EMA, and the EMA has turned upwards, then....."
You can use the knowledge that an EMA ALWAYS heads towards the price to deduce the following points.
1. If C crosses above its 30-period EMA then C must now be higher than the EMA.
2. If C is higher than its 30-period EMA it must have crossed above C at some previous point.
3. If C is higher than its 30-period EMA it must have turned upward when C crossed above the EMA.
I suggest that "C>Mov(C,30,E)" meets all your stated conditions and the extra code you have added is either redundant or contradictory.
The last two lines of code are out of place and would be more appropriate (with one bar less delay) in picking the point at which an SMA turned upwards. Picking the point at which an EMA turns upwards is derived from
Cross(C,Mov(C,30,E)), which is consistent with my earlier statement that "an EMA ALWAYS heads towards the price".
I think it would be helpful for you if you checked my suggestions using the Indicator Builder and a chart or two. Separate out each expression and compare binary plots against what you see happening with the price and moving average. There's no substitute for checking results visually, and taking the time to figure out what appears to not make sense.
Hope this helps more than my previous offering.
Regards
Roy
www.metastocktips.co.nz
----- Original Message -----
From: johnnic1948
To: equismetastock@xxxxxxxxxxxxxxx
Sent: Wednesday, November 08, 2006 10:36 AM
Subject: [EquisMetaStock Group] Re: Coding request
Does anyone have any helpful suggestions?
--- In equismetastock@xxxxxxxxxxxxxxx, "johnnic1948" <johnnic@xxx>
wrote:
>
> Would someone please be kind enough to confirm that the following
> simple code does what I want it to do?
>
> If the closing price crosses above the 30 week EMA or is already
> above the EMA, and the EMA has turned upwards, then.....
>
> The code I have written is:
>
> (Cross(C,Mov(C,30,E)) OR C > Mov(C,30,E))
>
> AND
> (Mov(C,30,E) > Ref(Mov(C,30,E),-1)
>
> AND
> Ref(Mov(C,30,E),-1) > Ref(Mov(C,30,E),-2)
>
> AND
> Ref(Mov(C,30,E),-2) < Ref(Mov(C,30,E),-3));
>
> Even if it is correct, is there a more elegant way of achieving
the
> same end?
>
> Thanks
>
> John
>
[Non-text portions of this message have been removed]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/equismetastock/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/equismetastock/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:equismetastock-digest@xxxxxxxxxxxxxxx
mailto:equismetastock-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|