Rank: Advanced Member
Groups: Registered, Registered Users Joined: 10/16/2009(UTC) Posts: 33 Location: Redcliffe, QLD Australia
Thanks: 4 times Was thanked: 1 time(s) in 1 post(s)
|
Then how can I place arrows on the chart using the expert?
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Hi viking
You need to define "turning point" before trying to code "turning point" int the MetaStock Formula language. I can't see or recall your previous post so can only comment on your last request and the comment "i.e. when it is horizontal".
In reality an MACD plot will never be perfectly horizontal (exactly the same MACD value for at least two bars). This is because of the EMA smoothing that's used to develop MACD (every EMA includes fragments of ALL historical data available, so the chances of getting two identical values for consecutive bars is extremely remote).
The usual way to identify a peak in any signal is is to test whether the previous value is greater than the value of both two bars ago and the current bar. For a trough the middle value must be less than both the "before" and "after" bar,
{Peak MACD}
M:=MACD();
PeakM:=Ref(M,-1) > Max(Ref(M,-2) , M);
PeakM;
{Trough MACD}
M:=MACD();
TroughM:=Ref(M,-1) < Min(Ref(M,-2) , M);
TroughM;
These two simple indicators could be called by your expert by the Fml() function, or you could include the code in your expert. If this doesn't provide the information you need then please give us clear definitions of what you're trying to achieve.
Roy (mstt)
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 10/16/2009(UTC) Posts: 33 Location: Redcliffe, QLD Australia
Thanks: 4 times Was thanked: 1 time(s) in 1 post(s)
|
Hi mstt
By turning point I mean when the gradient is zero (horizontal). This can occur at a peak, a trough or point of inflection.
I was toying with the idea that the rate of change is zero. Just wondering if you can measure rate of change over 1 period or do I need two periods minimum?
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 10/16/2009(UTC) Posts: 33 Location: Redcliffe, QLD Australia
Thanks: 4 times Was thanked: 1 time(s) in 1 post(s)
|
As far as I understand, a Peak or Trough can only be determined after they occur. The turning point has a slope=0, or ROC=0. That is the bar I want to identify. Sometimes it will turn but on other times it will continue in the same direction. But that's trading, not always predictable I.E. Win big, Lose small.
|
|
|
|
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.