#
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Home
Forex Forum
+ Add Script
Metastock
Expert Advisors
Explorations
Indicators
Trading Systems
Metatrader
MQL Experts
MQL Indicators
MQ4 Experts
MQ4 Indicators
MQ4 Scripts
Tradestation
Functions
Indicators
PaintBars
ShowMe
Trading Systems
Amibroker
Commentaries
Explorations
Functions
Indicators
Trading Systems
Contact us
Newsletter
Group: Metatrader MQL Indicators
Title: Momentum Vote
Description:
Improved Momentum Indicator, multiple time periods
/*[[ Name := MomentumVote Author := Copyright © 2004, Michael K Separate Window := Yes First Color := White First Draw Type := Histogram First Symbol := 217 Use Second Data := Yes Second Color := Lime Second Draw Type := Histogram Second Symbol := 218 ]]*/ Input: MaxBars(2000), NumVotes(14), FilterMaLen(2), Normalise(0), ratio(1) ; /* Momentum_Vote I always considered the Momentum indicator a little too arbitary - How do you choose a length of say 4 over length of 6? This indicator takes momentum of various lengths and combines them in order to (hopefully!) produce an improved momentum indicator. MaxBars: Number of bars to plot NumVotes: Number of Momentum periods to include FilterMaLen: Takes votes and applies smoothing Normalise: If non zero, adds +-1 normalisation to votes output Ratio: 0-2, 1==all given same vote, >1 larger mom given more weight, <1 short mom given more weight Obviously, trading is risky and this indicator should be used at your own risk. :) */ Variable : shift(0), votes(0), cnt(0), tmp(0), v1(0), curRatio(0), fRatio(0), maVotes(0); Variable : e1(0), e2(0), mb(0), outVotes(0); SetLoopCount(0); mb = min(bars-1, MaxBars); e1 = 2/(1+FilterMaLen); e2 = 1-e1; fratio = sqrt(ratio); // loop from first bar to current bar (with shift=0) For shift=mb Downto 0 Begin votes=0; v1=1; curRatio=1; for cnt = 0 to NumVotes Begin if ( iMomEx(v1,PRICE_TYPICAL,shift) > 100) then votes=votes+curRatio else votes=votes-curRatio; v1=v1+2; curRatio=curRatio*fratio; end; // add Ma component mavotes = (e1*votes)+(e2*mavotes); if (normalise>0) then begin /* perform nonliner mapping of range to +- 1 */ outVotes=2*normalise*mavotes/NumVotes; outVotes=(exp(2*outVotes)-1)/(exp(2*outVotes)+1); end else outVotes=mavotes; SetIndexValue(shift, outVotes); End;
Author/Source:
Michael K
Forex Directory
|
Forex Trading Systems
|
Privacy
|
Disclaimer
|
Contact