Editors' picksOPEN-SOURCE SCRIPT

LUBE

This is a chart meant for 30m BTCUSD but could be used for many other assets, and there are inputs to play with.

I decided on the strange title "LUBE" because I was measuring how many of the previous 500 bars had the current price level already been in. I wanted to discover when the price was in a new zone or an area that it hadn't spent much time in recently... the LUBE zone.

Think of the blue line as showing you the current level friction. If the blue line is high, price is quagmired and not moving quickly. Price could trend sideways for a while before breaking out. A high blue line is a high traffic zone for trading. When the blue line dips low, it's encountering a price zone the asset has not been observed in recently, and this could mean price could break out and move more freely and quickly when it does. We get a trade entry signal if the blue line dips below the bottom white line. The bottom white line is currently set to -10. Think about the lowest the blue line has been recently as 0, and the highest as 100. It is set by default (for BTCUSD 30m chart) to -10 meaning the blue line has to dip a little (-10%) below the lowest it has experienced recently to initiate a trade. This is the LUBE zone. The bottom white line shows that level. Again this is a level lower than the lowest amount of friction experienced in price action for the last 100 bars, but offset by 5 bars showing where that level was at 5 bars ago. We want to dip below that to initiate a trade.

The direction to trade in is determined by a very quick moving weighted moving average (variable name is "fir") to see if the recent trend is up or down. To end a trade, an arbitrary number between 0 and 100 is picked telling us when we are experiencing enough friction again to end the trade. I have it preset to 50 (think of it as 50/100 or half way between the white bars. At a 50% friction level it's time to get out of the trade.

Some shortcomings are missing the bulk of big moves, and experiencing whipsaws where price action zips up and then comes straight back down. Overall the backtest looks sweet enough to use on 2x leverage, experiencing a 17.78% max drawdown at the time of publishing. I wouldn't push the leverage any higher.

To get alerts change the word "strategy" to "study" and delete lines 60-67.

Bot traders using alerts: beware the alert conditions. If a trade goes directly from long to short (which happens rarely), without closing a trade first, it might not act properly. If you use bots to trade, for "LONG" please close any old trades first before putting in instructions to open a leveraged long. To go "SHORT" please remember to close any old trade first as well, and things *should* work out just fine.

Good luck, have fun, and feel free to mess up and butcher this code to your own liking. I'm not responsible if anything bad that happens to you if you use this trading system, or for any bugs you may encounter.
Volatility

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer