Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 9/15/2005(UTC) Posts: 24
|
I am experiencing a curious situation when applying moving averages to custom indicators. Specifically, I obtain different results between the following two situations:
1) The custom indicator is applied to the closing price of a security by dragging from the indicator list to the stock chart and placing it into a new window; then applying the moving average by dragging the "Mov" indicator from the indicator list over the custom indicator, causing that MA to be overlaid upon that indicator.
2) Instead, an extra line of code is added to the custom indicator that calculates the very same moving average in order to have it automatically plotted along with that custom indicator. For example, with a custom indicator called "ind", the code is:
mapds := 20;
ind := ...CALCULATIONS...; {Formula for computing "ind"}
maind := Mov(ind, mapds,E);
ind; maind
This produces plots of both the custom indicator and its MA. But applying the Mov indicator as described in 1) above exactly the same parameters (number of periods and type) produces a very different result!
What might be causing this?
Any suggestions to resolve this difficulty will be appreciated.
Ken Metz ("Systematic")
|
|
|
|
Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 9/15/2005(UTC) Posts: 24
|
Never Mind -- I just figured out the source of the problem.
Applying the MA to the custom indicator from the indicator list appears to apply it to the last item to be plotted in the custom indictor. The last line of the previously listed code was:
ind; maind
This caused the MA to be applied to "maind", not to "ind". Thus, it was producing an MA of an MA. The problem is solved by simply reversing the order of variables in the last line of code to:
maind; ind
|
|
|
|
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.