June 29, 2021 at 6:30 am #65117Keith
- Topics: 3
- Replies: 0
- Posts: 3
Could you investigate adding this moving average to Optuma as other packages use it and I have been told it is very useful. There is plenty of information via Google. Thanks KM
Arnaud Legoux Moving Average (ALMA) removes small price fluctuations and enhances the trend by applying a moving average twice, once from left to right, and once from right to left. At the end of this process the phase shift (price lag) commonly associated with moving averages is significantly reduced. Zero-phase digital filtering reduces noise in the signal. Conventional filtering reduces noise in the signal, but adds a delay.
study(“Double ALMA”, overlay=true)
almaLen = input(48, title=”ALMA Length”, minval=1)
almaOffSet = input(0.15, type=float, title=”ALMA Offset”, minval=0.0, maxval=1.0)
almaSigma = input(6, title=”ALMA Sigma”, minval=1)
fastALMALen = input(10, title=”Fast ALMA Length”, minval=1)
fastALMAOffSet = input(0.75, type=float, title=”Fast ALMA Offset”, minval=0.0, maxval=1.0)
fastALMASigma = input(6, title=”Fast ALMA Sigma”, minval=1)
src = input(title=”Source”, type=source, defval=close)
// FAST AND SLOW AL MOVING AVGS:
alma = alma(src,almaLen, almaOffSet, almaSigma)
fastALMA = alma(src, fastALMALen, fastALMAOffSet, fastALMASigma)
//Upper and lower bands at +/- 1.25 standard deviations.
stDev = 1.25 * stdev(alma, almaLen * 2)
upperBand = alma + stDev
lowerBand = alma – stDev
// ENTRY AND EXIT CONDITIONS:
//Bullish when slow ALMA increasing.
bullish = alma >= alma ? 1 : 0
//Bearish when slow ALMA decreasing.
bearish = alma < alma ? 1 : 0
//True when fast ALMA crosses up over the lower stand. dev. band.
crossUpLower = fastALMA < lowerBand and fastALMA >= lowerBand
//True when fast ALMA crosses down under the upper stand. dev. band.
crossDownUpper = fastALMA > upperBand and fastALMA <= upperBand
//Enter Long when bearish and crossUpLower is true.
enterLong = bearish == 1 and crossUpLower
//Exit Long when Bullish and crossDownUpper is true.
exitLong = bullish == 1 and crossDownUpper
//Prevents Repeat Signals.
lastBuy = barssince(enterLong == 1)
lastSell = barssince(exitLong == 1)
buyer = lastBuy > lastSell
seller = lastSell > lastBuy
entrySig = buyer and enterLong == 1
exitSig = seller and exitLong == 1
bgcolor(entrySig ? lime : na, transp=0)July 1, 2021 at 9:18 am #65129Mathew
- Topics: 40
- Replies: 1,958
- Posts: 1,998
We’ll have a look but there are no guarantees it will make the next update.
All the best
- You must be logged in to reply to this topic.