Historical Volatility Percentile + SMA Strategy for TradingView
Historical Volatility Percentile tells you the percentage of the days from the past year (252 trading days) that have lower volatility than the current volatility.
It include simple moving average as a signal line to show you how volatile the stock is at the moment.
Strategy Logic
Long Entry: When price higher than EMA & historical volatility higher than SMA, send LE
Long Exit: Either when SL or Target is hit. If SL/TGT is not hit, and when price lower than EMA & historical volatility higher than SMA, send LX and SE
Short Entry: When price lower than EMA & historical volatility higher than SMA, send SE
Short Exit: Either when SL or Target is hit. If SL/TGT is not hit, and when price higher than EMA & historical volatility higher than SMA, send SX and LE
Historical Volatility Percentile + SMAs Parameters for TradingView Charts
Source: Source for the SMA and volatility calculation
Resolution: Time Frame of the chart to take values from
Length: Length of look back for SMA and volatility
Annual length: Length to annualize volatility for the period mentioned
Quantity: We use it specify the trade quantity
Custom Stop Loss in Points: Movement in chart price against the momentum which will trigger exit
Custom Target in Points: Movement in chart price against the momentum which will trigger exit
TradingView Settings
Step 1: Download the PineScript Algo
Step 2: Open desired chart in TradingView with normal candlestick. Select desired timeframe of the chart.
Go to the Pine Editor section, remove the default code, paste the downloaded code, save the file and add to chart.
Step 3: Once we apply Strategy on the chart, click on settings to optimize parameters for your own trading.
Step 4: Setting Up Alert
Before setting up an alert make sure that you have selected the desired script, time frame, strategy settings. Also make sure you configure API bridge and running. Click in settings add alert and paste {{strategy.order.comment}} in the message box.
Important: do not change any settings during live trading.
NOTE: The pine script works both with webhook alerts (TV Pro plan) and normal popup alerts (TV free plan).
Recent Discussion