Indicator built upon a special moving average formula that adapt its period automatically accordingly to the market behaviour and noises. This moving average is called the OMA (One More Average), the formula come from an MT4 version found on internet.
Converted from MT4 because of a request on forum.
This version of the one more average indicator embed a step variation of the result of the calculation. The sensitivity and step size can be modified in order to adapt how the moving average respond to the step function, which is comparing how the moving average evolved between difference of actual and past data with current average true range.
The adaptive period can be more or less adaptive by changing the “speed” parameter (0.1 step). The adaptive behaviour of the formula can be shutdown with “Adaptive=0”.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
//PRC_step one more average | indicator //12.12.2016 //Nicolas @ www.prorealcode.com //Sharing ProRealTime knowledge //converted and adapted from MT4 version //Length = 25 //Speed = 3.0 //Adaptive = true; //Sensitivity = 0.5 // Sensivity Factor //StepSize = 50 // Step Size period Length = Max(Length,1) Speed = Max(Speed,-1.5) price = average[1](customclose) //adaptive period averagePeriod = Length if adaptive=1 and averagePeriod > 1 then minPeriod = averagePeriod/2.0 maxPeriod = minPeriod*5.0 endPeriod = round(maxPeriod) signal = Abs((price-stored[endPeriod])) noise = 0.00000000001 for k=1 to endPeriod do noise=noise+Abs(price-stored[k]) averagePeriod = round(((signal/noise)*(maxPeriod-minPeriod))+minPeriod) next endif tconst=Speed alpha = (2.0+tconst)/(1.0+tconst+averagePeriod) e1 = e1 + alpha*(price-e1) e2 = e2 + alpha*(e1-e2) v1 = 1.5 * e1 - 0.5 * e2 e3 = e3 + alpha*(v1 -e3) e4 = e4 + alpha*(e3-e4) v2 = 1.5 * e3 - 0.5 * e4 e5 = e5 + alpha*(v2 -e5) e6 = e6 + alpha*(e5-e6) v3 = 1.5 * e5 - 0.5 * e6 stored=price //step function Sensitivity = max(Sensitivity,1*pointsize) ATRStepSize=averagetruerange[StepSize] Step = max(ATRStepSize,1*pointsize) size = sensitivity*Step phigh = v3 plow = v3[7] stepMulti = 1.0 workStepsmax = phigh+2.0*size*stepMulti workStepsmin = plow-2.0*size*stepMulti workSteptrend = workSteptrend[1] pprice = customclose if (pprice>workStepsmax[1]) then workSteptrend = 1 endif if (pprice<workStepsmin[1]) then workSteptrend = -1 endif if (workSteptrend = 1) then if (workStepsmin < workStepsmin[1]) then workStepsmin=workStepsmin[1] endif result = workStepsmin+size*stepMulti color = 1 endif if (workSteptrend = -1) then if (workStepsmax > workStepsmax[1]) then workStepsmax=workStepsmax[1] endif result = workStepsmax-size*stepMulti color = -1 endif RETURN result coloured by color as "OMA step" |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Hello Nicolas,
thanks a lot for your many contributions in this post. I have a problem with the imported file: when I import it into the Price chart, I just get a flat line at the “0” level, no average is plotted.
I have 10.3 version of PRT.
Any suggestion would be wellcome.
Best regards,
Jorge Hernando
Because of no data available at the start of calculations. Change line 20 with : if adaptive=1 and averagePeriod > 1 and barindex>(length/2)*5 then
and add an ‘endif’ at end of the code just before the Return function line.
Hi Nicolas,
thanks for your updates and am very new in trading would you guide me to back test this indicator and give me some refrences to understand coding techniques.
thanks & regards
Selva
Please post any question on forums, thanks.
Bonjour Nicolas.
J’utilise la version 11 et moi aussi j’ai une ligne horizontale malgré l’ajout du test “if barindex>length”.
Existe-t-il une incompatibilité entre la version de PRT 2016 et 2021?
Cordialement.
il faut modifier la ligne 20 avec:
if adaptive=1 and averagePeriod > 1 and barindex>(length/2)*5 then