작업 종료됨
![](https://c.mql5.com/i/avatar/avatar_na2.png)
![](https://c.mql5.com/i/avatar/avatar_na2.png)
명시
In an indicator window, I want an line graph showing the deviation of price from a rapid moving average, i.e. closing price – moving average of closing price, normalized to a percentage as explained below.
I would like a copy of the code in MQL4 for my own purposes. I’d like to retain exclusive copyright to the work.
INPUTS
A. select either simple moving average (SMA) or exponential moving average (EMA)
· 1=sma, 2=ema, default 1
B. number of bars in the moving average
· minimum 2, default 10 bars
C. (requirement deleted)
D. number of bars in the normalization period
· minimum 2, default 50 bars
E. toggle color bars below the curve
· false=off, true=on (default)
· If “true”, there should be color bars below the deviation curve, blue = increase in deviation, red = decrease in deviation (i.e. line graph up/down). See attached image for a rough example.
F. levels for indicator gridlines
· default -60%, 0, +60%
If negative levels cannot be achieved (I haven’t seen them), translate -100%,+100% to 0%,100%.
NORMALIZATION
The deviation should be normalized as a percentage of the maximum absolute deviation over the normalization period,
e.g. if the maximum absolute deviation over the last 50 bars (or see input D) is 40 pips, then we represent a deviation of +30 pips as +75% and a deviation of -10 pips as -25%
The indicator scale should show -100% to +100%, with default levels at +60%, 0%, and -60% (or see input F).
The “About” screen in the properties window should explain the input parameters. Please use this text:
Copyright Timothy Horton, Toronto 2022
· moving average method: 1=sma, 2=ema
· moving average period: minimum 2 bars
· normalization period: minimum 2 bars
· show color bars: false=off, true=on