Step One More Average

Step One More Average

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".


//PRC_step one more average | indicator
//Nicolas @
//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
  averagePeriod = round(((signal/noise)*(maxPeriod-minPeriod))+minPeriod)



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


//step function
Sensitivity = max(Sensitivity,1*pointsize)
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
if (pprice<workStepsmin[1]) then
 workSteptrend = -1
if (workSteptrend =  1) then
 if (workStepsmin < workStepsmin[1]) then
 result = workStepsmin+size*stepMulti
 color = 1

if (workSteptrend = -1) then
 if (workStepsmax > workStepsmax[1]) then
 result = workStepsmax-size*stepMulti
 color = -1

RETURN result coloured by color as "OMA step"


Risk disclosure:

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 : How to import ITF files into ProRealTime platform?

New! PRC is also now on YouTube, subscribe to our channel for exclusive content and tutorials

  1. SoloContado • 121 days ago #

    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


    • Nicolas • 121 days ago #

      Because of no data available at the start of calculations. Add this at line 15 : if barindex>length then

      and add an ‘endif’ at end of the code just before the Return function line. 

  2. srajtri • 51 days ago #

    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



    • Nicolas • 51 days ago #

      Please post any question on forums, thanks.

Register or


avatar avatar avatar avatar avatar avatar avatar
Related users ' posts
Nicolas Any group of shares you like!
mal Hi Nicolas, whar for a broker do you use for Future-Tarading with pro real time?
Nicolas Prorealtime trading with interactive broker, more information follow this link: https://trad...
Stenozar Hi Nicolas, does it work with DAX? which indicator you prefer to trade Dax? thanks a lot fo...
Riccardo Benedetti Thanks a lot nicolas for this indicator. good job. I love the great work done simple. Thanks...
Riccardo Benedetti ciao nicolas mi piacerebbe provare a fare un backest di una strategia con questo indicatore ...
Sofitech Ce code n'est valable que sur la V10.3 ? sur le 10.2 il y a une erreur de syntaxe dans le fi...
Nicolas Oui en effet, c'est un indicateur "10.3" à cause uniquement de la mise en forme des courbes ...
piarou Objet : PRC_QEMA | indicator Bonjour, Bizarrement : • les deux paramètres sont en remarqu...
Nicolas En effet, c'est le cas si on copie/colle le code. Ces 2 variables sont inscrites en externes...
4 months ago
Holt EMA
Holt EMA
David Nicolas I've looked at it again and there's a problem.  As an example here's a simple cross...
Nicolas You'll need to preload bars to get the good calculations of you indicators. I did not test i...
David Nicolas I tried DEFPARAM Preloadbars = 5000 And still the same drawn output of entries/exit...
Ernesto1 J'ai essayé avec deux différents I ,  a =  3 périodes et un 3 x 5 = 15 périodes.Ie comme si ...
Wilko Nicolas, anytime I have an idea, I just search for it on ProRealCode and usually you have do...
Nicolas Of course! please add a query in probuilder forum and we'll work together on this indicator ...
luigi Ciao Nicolas. Approfitto di questo spazio per chiederti se puoi aiutarmi. Avrei bisogno di u...
Nicolas Si prega di utilizzare i forum per chiedere richieste di codice per favore.
Wilko Hi Nicolas!, Thanks for providing code for the FRAMA! If I have understood correctly, one s... HELP, WHY DONT I NOT GOT THE INDICATOR IN CHART. JUST UNDER?????????????
Nicolas Use the wrench on the upper left side of your price chart to add correctly indicator on PRICE.
bluetime6 Hello Doctrading.   Can you ask you for something? Can you code a screener screen po...
gianlox I added a simple momentum indicator (MACD). I think much better results:   achat = 0v...
gianlox achat = 0 vente = 0 MACD12M = MACDline[12,26,9](close) MACD12S = ExponentialAverage[9](MA...
IGOSNELL Thanks but unfortunately can't read German. If you can show that your strategies can work on...
Nicolas Thank you for contribution. Please consider that advertising is tolerate as long as you cont...  Hi, I cant make it work. And if you doing so much money. Why do you have to sell it? It don...
finplus Bonsoir, j'ai de nouveau aujourd'hui lancé la stratégie en réel sur mon compte IG sur la pai...
AleX 0 improvments, I tried a lot of modified version but no one was working. I think that only w...
Fabio Anthony Terrenzio this strategy works only in a well defined trend
Nicolas Ok Doc, beware of intraday, it's a battlefield full of random noises :) Maybe we can work to...
phili711 Bonjour Si la moyenne 100 est au dessus de la moyenne 20 le trend est baissier zlors pourqu...
Nicolas La comparaison se fait entre la valeur de la moyenne actuelle et telle qu'elle était il y a ...
Nicolas You have certainly apply the indicator twice on the price chart. If you want to hide one of ...
fabriziomerlo Buongiorno Nicolas,  come faccio a trasformare questo interessantissimo indicatore in uno s...
Nicolas Si desidera testare una croce sopra di 2 media mobile? Si prega di fare un argomento nel for...