Error

 Previous Topic Next Topic
 aksh #1 Posted : Wednesday, January 31, 2018 2:40:33 PM(UTC) Rank: MemberGroups: Registered, Registered UsersJoined: 1/20/2007(UTC)Posts: 15Was thanked: 1 time(s) in 1 post(s) Hi all,The "Money Flow Index" formula under "Custom Formula Collection" on page https://www.metastock.com/customer/resources/formulas/?id=40 and given below doesn't match the Equis MetaStock built-in indicator. It doesn't plot properly as an overbought/oversold indicator. It shows spikes when plotted. {Doesn't match the MetaStock built-in indicator} Periods:=Input( "Periods", 2, 252, 14); up:=Sum(If(Typ(),>,Ref(Typ(),-1), V * Typ(), 0), Periods); dn:=Sum(If(Typ(),<,Ref(Typ(),-1), -1 * V * Typ(), 0), Periods); (100 - (100 / (1 + up / dn ))); 80;20I was playing with the above formula, making some changes to it and accidentally discovered the following formula. The following indicator matches the MetaStock built-in indicator exactly. There is however a slight difference in the initial periods where it takes a dip from the overbought to the oversold area. I don't know whether the formula below is given in the MetaStock manual or the formula primer or the metastock forum; I couldn't find it anywhere.{Matches MetaStock built-in indicator} Periods:=Input( "Periods", 2, 252, 14); up:=Sum(If(Typ(),>,Ref(Typ(),-1), V*Typ()-Ref(Typ(),-1), 0), Periods); dn:=Sum(If(Typ(),<,Ref(Typ(),-1), Ref(Typ(),-1) - (-1 * V * Typ()), 0), Periods); (100 - (100 / (1 + up / dn))); 80;20RegardsArun 1 user thanked aksh for this useful post. MS Support on 2/2/2018(UTC)
 Wanna join the discussion?! Login to your Discussions forum accountor Register a new forum account.
 MS Support #2 Posted : Friday, February 2, 2018 9:07:16 PM(UTC) Rank: Advanced MemberGroups: Moderators, Registered, Registered Users, SubscribersJoined: 10/8/2010(UTC)Posts: 1,623Thanks: 51 timesWas thanked: 130 time(s) in 126 post(s) Originally Posted by: aksh Hi all,The "Money Flow Index" formula under "Custom Formula Collection" on page https://www.metastock.com/customer/resources/formulas/?id=40 and given below doesn't match the Equis MetaStock built-in indicator. It doesn't plot properly as an overbought/oversold indicator. It shows spikes when plotted.{Doesn't match the MetaStock built-in indicator} Periods:=Input( "Periods", 2, 252, 14); up:=Sum(If(Typ(),>,Ref(Typ(),-1), V * Typ(), 0), Periods); dn:=Sum(If(Typ(),<,Ref(Typ(),-1), -1 * V * Typ(), 0), Periods); (100 - (100 / (1 + up / dn ))); 80;20I was playing with the above formula, making some changes to it and accidentally discovered the following formula. The following indicator matches the MetaStock built-in indicator exactly. There is however a slight difference in the initial periods where it takes a dip from the overbought to the oversold area. I don't know whether the formula below is given in the MetaStock manual or the formula primer or the metastock forum; I couldn't find it anywhere.{Matches MetaStock built-in indicator} Periods:=Input( "Periods", 2, 252, 14); up:=Sum(If(Typ(),>,Ref(Typ(),-1), V*Typ()-Ref(Typ(),-1), 0), Periods); dn:=Sum(If(Typ(),<,Ref(Typ(),-1), Ref(Typ(),-1) - (-1 * V * Typ()), 0), Periods); (100 - (100 / (1 + up / dn))); 80;20RegardsArun Hi,I don't believe we wrote that particular TASC formula (the Sidebar formulas were typically written by the article author) but I do believe the problem is in the " * -1 " aspect of the "Negative Money Flow". Perhaps the author believed the numerical value needed to be made negative (vs. summing the "negative" or down days) but if you simply remove the * -1 from the original Negative Money Flow formula you should also resolve the problem.Here is a Combined / Modified version of the one on the web that should match the built-in Money Flow Index.Code:``````PERIODS:=Input("Money Flow Periods",2,252,14); PMF:=Sum(If(Typ(),>,Ref(Typ(),-1),V*Typ(),0),PERIODS); NMF:=Sum(If(Typ(),<,Ref(Typ(),-1),V*Typ(),0),PERIODS); MFR:=PMF/NMF; MFIdx:=100-(100/(1+MFR)); MFIdx``````
 aksh #3 Posted : Saturday, February 3, 2018 6:44:24 AM(UTC) Rank: MemberGroups: Registered, Registered UsersJoined: 1/20/2007(UTC)Posts: 15Was thanked: 1 time(s) in 1 post(s) Yes, that is the correct code. Matches the built-in indicator perfectly.  I had subtracted price from price*volume and vice versa, which doesn't make sense. Thanks. Edited by user Saturday, February 3, 2018 6:45:34 AM(UTC)  | Reason: Not specified
 Users browsing this topic
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.