Volatility Switch indicator

Volatility Switch indicator

The Volatility Switch (VOLSWITCH) indicator, by Ron McEwan, estimates current volatility in respect to historical data, thus indicating whether the market is trending or in mean reversion mode. Range is normalized to 0 - 1.

When Volatility Switch rises above the 0.5 level, volatility in the market is increasing, thus the price action can be expected to become choppier with abrupt moves. When the indicator falls below the 0.5 level from recent high readings, volatility decreases, which may be considered a sign of trend formation.

Trading strategy as suggested by Ron McEwan is:
- If VOLSWITCH is less than 0.5, volatility decreases, which may be considered a sign of trend formation
- If VOLSWITCH is greater than 0.5, market is in high volatility mode. Can be choppy. Use RSI to look for OB/OS levels.

 

// parameter
//period=21

dr= roc[1](close)/average[2](close)

vola21=std[period](dr)
vswitch21=((vola21[1] <= vola21 ) + (vola21[2] <= vola21 ) +   (vola21[3] <= vola21 ) + (vola21[4] <= vola21 ) +  (vola21[5] <= vola21 ) + (vola21[6] <= vola21 ) + (vola21[7] <= vola21 ) +  (vola21[8] <= vola21 ) +  (vola21[9] <= vola21 ) + (vola21[10] <= vola21 ) + (vola21[11] <= vola21 ) +  (vola21[12] <= vola21 ) + (vola21[13] <= vola21 ) +  (vola21[14] <= vola21 ) +  (vola21[15] <= vola21 ) + (vola21[16] <= vola21 ) +  (vola21[17] <= vola21 ) +  (vola21[18] <= vola21 ) + (vola21[19] <= vola21 ) +  (vola21[20] <= vola21 ) + 1) / 21

RETURN 0.5 as "median", vswitch21 as "Volatility Switch"

converted from LazyBear Pinescript code from TV.

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. Dimi.A • 152 days ago #

    Perfect for counter-trend scalping. I like this!

avatar
Register or

Likes

avatar avatar avatar avatar
Related users ' posts
GraHal   Your code is so 'disciplined and well laid out' ... a pleasure to work with! Is bel...
victormork @GraHal shall we move this to the forum thread advised above?
Maz Thanks guys. Please see forum post for more details. I encourage you guys to play / pull it ...
Dagge99 Why are you the only one sharing unfinished strategys that doesn't perform well? To help us ...
Nicolas What are you calling a finished strategy? This one has been coded by a request on forums, si...
clanli Hi Nicolas Thanks for a fantistic piece of code. I tried the following with really good res...
Nicolas Ligne 44 à modifier par r=0 Ligne 55 à modifier par g = 0 J'ai simplement codé en dur les ...
winkx Bonjour Nicolas, Je vous remercie L'indicateur est très intéressant Après c'est une quest...
Nicolas Les goûts et les couleurs...
Francesco78 Thank you Nicolas,  I have copied your nice indicator, but it shows in the lower part of th...
Abz  hi , you need to add the indicator from the "price" menu in chart
Francesco Thank you Abz!
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...
Renato Di Lorenzo Agree; thanks.
rpreviteri Hi Nicolas, thanks a  loto for sharing your knowliedge, Wasn't the original momentum pinball...
air Thank you!  
zilliq Merci Nicolas, Personnellement, il y a tellement de dépassement de "Lexplosion line" que je...
Nicolas Merci, je le constate aussi. Ce sont les paramètres par défaut que l'on retrouve ailleurs su...
Pelle Nævestad Thanks Nicolas, this is a keeper!
leyoy Bonjour, je viens de l'installer sur 10.3 ... comment faire apparaitre les flèches sur l'ind...
Nicolas Les flèches apparaissent d'elles-mêmes selon les signaux de l'indicateur.
leyoy Elles viennent d'apparaitre après redémarrage. Merci Nicolas. Du coup, les signaux sont à pr...
jctrader Bonjour . CAC 40    1988 = 1000   today = 4900  soit 490%  en buy and hold  .... + 370% av...
Nicolas Aucune immobilisation du capital. Quel est le drawdown du buy & hold ? Je ne l'ai pas ca...
jctrader ok pour le codage mais le choix "indice" n'est pas le bon : moins de 5%/an pour le meilleur ...
DonDollar ...and I do not see any opened positions...strange...
DonDollar I found the answer by myself for the second question. But still no idea about the False and ...
Nicolas The line 12 of the code is the answer of your question. Before launching a new trade, the co...
Nicolas I do not have any error Alfredo, even while testing on 150000 bars in the past. By the way, ...
alfredo thank for the council, when i do start the strategie on Italy at 1h some mornings happen tha...
Nicolas I think it's because of price gaps and/or quote interrupt. Anyway, be aware that this strate...
Dimi.A Thanks mate, how about 0.001? Or is that too sensitive?
Nicolas Depends of which pair you are trading and the actual volatility. Since it is not calculated ...
Sofitech Bonjour. J'aimerais savoir s'il est possible de "truquer" un peu l'indicateur pour qu'il don...

Top