Price Legs: Average Heights; 'Smart ATR'Price Legs: Average Heights; 'Smart ATR'. Consol Range Gauge
~~ Indicator to show small and large price legs (based on short and long input pivot lengths), and calculating the average heights of these price legs; counting legs from user-input start time ~~
//Premise: Wanted to use this as something like a 'Smart ATR': where the average/typical range of a distinct & dynamic price leg could be calculated based on a user-input time interval (as opposed to standard ATR, which is simply the average range over a consistent repeating period, with no regard to market structure). My instinct is that this would be most useful for consolidated periods & range trading: giving the trader an idea of what the typical size of a price leg might be in the current market state (hence in the title, Consol Range gauge)
//Features & User inputs:
-Start time: confirm input when loading indicator by clicking on the chart. Then drag the vertical line to change start time easily.
-Large Legs (toggle on/off) and user-input pivot lookback/lookforward length (larger => larger legs)
-Small Legs (toggle on/off) and user-input pivot lookback/lookforward length (smaller => smaller legs)
-Display Stats table: toggle on/off: simple view- shows the averages of large (up & down), small (up & down), and combined (for each).
-Extended stats table: toggle on/off option to show the averages of the last 3 legs of each category (up/down/large/small/combined)
-Toggle on/off Time & Price chart text labels of price legs (time in mins/hours/days; price in $ or pips; auto assigned based on asset)
-Table position: user choice.
//Notes & tips:
-Using custom start time along with replay mode, you can select any arbitrary chunk of price for the purpose of backtesting.
-Play around with the pivot lookback lengths to find price legs most suitable to the current market regime (consolidating/trending; high volatility/ low volatility)
-Single bar price legs will never be counted: they must be at least 2 bars from H>>L or L>>H.
//Credits: Thanks to @crypto_juju for the idea of applying statistics to this simple price leg indicator.
Simple View: showing only the full averages (counting from Start time):
View showing ONLY the large legs, with Time & Price labels toggled ON:
Priceleg
Price Legs: Time & Distance. Measuring moves in time & price-Tool to measure price legs in terms of both time and price; gives an idea of frequency of market movements and their typical extent and duration.
-Written for backtesting: seeing times of day where setups are most likely to unfold dynamically; getting an idea of typical and minimum sizes of small/large legs.
-Two sets of editable lookback numbers to measure both small and large legs independently.
-Works across timeframes and assets (units = mins/hours/days dependent on timeframe; units = '$' for indices & futures, 'pips' for FX).
~toggle on/off each set of bull/bear boxes.
~choose lookback/forward length for each set. Increase number for larger legs, decrease for smaller legs.
(for assets outside of the big Indices and FX, you may want to edit the multiplier, pMult, on lines 23-24)
small legs
large legs