VAMA – Volatility Adaptive Moving Average

VAMA – Volatility Adaptive Moving Average

This VAMA indicator draws an average with a period of p. The value of p is changed depending upon recent market volatility.

You set a percentage and the indicator counts back how many bars are needed to find that the highest high minus the lowest low is greater or equal to the desired percentage of the current price. The value for p is the number of bars needed to find this range.

With this calculation when a market is not very volatile the value of p will be high and the average slower moving and  in a volatile market the value of p will be low and the average faster moving.

You can change the average type drawn by changing the value of ‘type’ from 0 to 6.

  • 0 = Simple
  • 1 = Exponential
  • 2 = Weighted
  • 3 = Wilder
  • 4 =Triangular
  • 5 = End Point
  • 6 = Time Series

Set ‘Percentage’ to whatever percentage of price you want to use to calculate the p value for the average.

You can turn on and off the display of the latest p value change.

Due to the loop the average can be quite slow to draw so I advise using the DEFPARAM CALCULATEONLASTBARS to reduce calculation time.

I advise downloading the ITF file and importing it to get full functionality.

Share this

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. JMat45 • 238 days ago #

    Thanks, Vonasi. Can this be adapted for a Hull moving average too? I’ve been looking for an ‘adaptive’ Hull for some time.

  2. Vonasi • 238 days ago #

    Sure that is possible. I will code it and make a post in the English ProBuilder forum and put a link here to that topic.

  3. Vonasi • 238 days ago #

    Vama v2 with Hull moving average included can be found here:

  4. JMat45 • 237 days ago #

    Thank you, Vonasi.

Register or


avatar avatar avatar avatar avatar
Related users ' posts
luxrun // volatilità Schwager calcolo x = TR (close) y = exponentialaver...
luxrun sorry, add prt code add doesn't work
robertogozzi Don't worry about PRT code, I can't make it work either! Great for pointing that out, it's ...
luxrun One question, Roberto: the two AvgT are variable, could you explain to me what they regulate...
robertogozzi AvgT stands for Average Type, it's a parameter for the AVERAGE keyword (https://www.prorealc...
Vonasi There are actually two ways to calculate standard deviations and I seem to have used the ver...
Vonasi You can open a free end of day account directly with PRT and so play with some of the new fe...
segie Can something similar be done with Supertrends?
Vonasi Not sure I fully understand what you are asking for. Are you asking for MTF Supertrend level...
robertogozzi Yes, you can use any setting that suits you best! As to which one... it depends on the inst...
DaxRider grazie Robnerto
eva.g.forsgren I cant make it work in anyway.
Nicolas Play with the "highpassLength" settings and add more units displayed on your chart.
MrEastwood Interesting indicator! Can anyone get it working for longer "highpasslengths"? I've been tes...
Rory Dryden Thank you. Experimenting with it now.
mlouys Bjr, j ai lu effectivement que le système était long only, mais je crois qu on peut aussi l ...
bertrandpinoy bonsoir Nicolas est il possible de voir cet indicateur évoluer dans un TF bas pour une aide ...
danistuta Hi, thank it works with prorealtime 10.3:-) I'd like test on EUR/USD...could you s...
Jan Just run the code for this pair, make sure you have the right spread filled. What you could...
oxy75 Hello. I understood that we were waiting to choose two values ​​between 0 and 69 for the two...
Stockastiss Can this code be simply transferred into Backtestingcode so one doesnt need to use call ? (i...
Vonasi Sorry for the late reply. Add the code to your strategy and remove line 5 and line 39. Chang...
swedshare You got some potential here. A couple of things I think about: 1, The opening hours in this...
phoentzs Ich habe hier mit Spread 2 gerechnet, also etwa dem Mittelwert zwischen Tag und Nacht. Das G...
phoentzs Hab festgestellt, das US500 fast noch besser funktioniert als der Dax. Was aber auch daran l...
leofi Go visit and watch 2em post
Dritan Hi,I am new on Prorealtime and coding.I downloaded the indi but I have it on a separate wind...
Morrissey38 Buenas tardes Nicolás . Como podría introducir una línea cero a este indicador? . Muchas gra...
Nicolas Change the last line with : RETURN Reflex, 0
Morrissey38 Muchísimas gracias Nicolás , muy amable.
Alps007 Hi Nicolas. Happy New Year. Can you please program me several MACD divergence screeners ...
Arlei Zanin Hello Nicolas, would it be possible to convert the Cloud to Pascal language? Thank you.
ashee i want it in MT4
Sapo Thank you for your indicators. As always it's perfect, I thank you for your help it's preci...
Om Hello, thanks for sharing! Getting a message that Variable P is undefined?
9 months ago
Bard Very interesting approach Vonasi! I'm getting a 404 error when trying to download though?
Vonasi I just tested and I was able to download with no error.
Psari Hi Vonasi, I am a newbie and was wondering whether you could possibly help me with this pro...
manchokcity can we have it in mql4 platform? or how or which platform do we use it?
camporan I don't use MetaTrader so I won't be able to do the translation myself. Sorry!
Alexander9 This can for amibroker ? . Thanks