Wick/Tail Candle MeasurementsThis indicator runs on trading view. It was programmed with pine script v5.
Once the indicator is running you can scroll your chart to any year or date on the chart, then for the input select the date your interested in knowing the length of the tails and wicks from a bar and their lengths are measured in points.
To move the measurement, you can select the vertical bar built into the indicator AFTER clicking the green label and moving it around using the vertical bar *only*. You must click the vertical bar in the middle of the label to move the indicator calculation to another bar. You can also just select the date using the input as mentioned. This indicator calculates just one bar at a time.
measurements are from bar OPEN to bar HIGH for measured WICKS regardless of the bar being long or short and from bar OPEN to bar LOW for measured TAILS also regardless of the bar being long or short.
This indicator calculates tails and wicks including the bar body in the calculations. Basically showing you how much the market moved in a certain direction for the entire duration of that Doji candle.
Its designed to measure completed bars on the daily futures charts. (Dow Jones, ES&P500, Nasdaq, Russell 2000, etc) Although it may work well on other markets. The indicator could easily be tweaked in order to work well with other markets. It is not designed for forex markets currently.
Measure
Pip CrosshairsThis is a simple tool designed to help you visualize your stop loss and take profit levels before entering a trade. The tool plots two lines on the chart - a green dotted line for take profit and a red dotted line for stop loss (similar to the price line) - with a simulated default spread of one pip factored in. The indicator has the option to toggle between long and short positions.
Please note that the spread used in the tool is not based on your actual spread and should be adjusted accordingly. As, to the best of my knowledge Pine Script does not have the ability to automatically include spread in an indicator, so you will need to input your spread manually. (if you can please let me know cause that would be a game changer).
Overall, should help save you a bit of time by not having to manually measure stop loss and take profit levels for each trade.
Happy hunting :)
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
Candlestick Pattern Criteria and Analysis Indicator█ OVERVIEW
Define, then locate the presence of a candle that fits a specific criteria. Run a basic calculation on what happens after such a candle occurs.
Here, I’m not giving you an edge, but I’m giving you a clear way to find one.
IMPORTANT NOTE: PLEASE READ:
THE INDICATOR WILL ALWAYS INITIALLY LOAD WITH A RUNTIME ERROR. WHEN INITIALLY LOADED THERE NO CRITERIA SELECTED.
If you do not select a criteria or run a search for a criteria that doesn’t exist, you will get a runtime error. If you want to force the chart to load anyway, enable the debug panel at the bottom of the settings menu.
Who this is for:
- People who want to engage in TradingView for tedious and challenging data analysis related to candlestick measurement and occurrence rate and signal bar relationships with subsequent bars. People who don’t know but want to figure out what a strong bullish bar or a strong bearish bar is.
Who this is not for:
- People who want to be told by an indicator what is good or bad or buy or sell. Also, not for people that don’t have any clear idea on what they think is a strong bullish bar or a strong bearish bar and aren’t willing to put in the work.
Recommendation: Use on the candle resolution that accurately reflects your typical holding period. If you typically hold a trade for 3 weeks, use 3W candles. If you hold a trade for 3 minutes, use 3m candles.
Tldr; Read the tool tips and everything above this line. Let me know any issues that arise or questions you have.
█ CONCEPTS
Many trading styles indicate that a certain candle construct implies a bearish or bullish future for price. That said, it is also common to add to that idea that the context matters. Of course, this is how you end up with all manner of candlestick patterns accounting for thousands of pages of literature. No matter the context though, we can distill a discretionary trader's decision to take a trade based on one very basic premise: “A trader decides to take a trade on the basis of the rightmost candle's construction and what he/she believes that candle construct implies about the future price.” This indicator vets that trader’s theory in the most basic way possible. It finds the instances of any candle construction and takes a look at what happens on the next bar. This current bar is our “Signal Bar.”
█ GUIDE
I said that we vet the theory in the most basic way possible. But, in truth, this indicator is very complex as a result of there being thousands of ways to define a ‘strong’ candle. And you get to define things on a very granular level with this indicator.
Features:
1. Candle Highlighting
When the user’s criteria is met, the candle is highlighted on the chart.
The following candle is highlighted based on whether it breaks out, breaks down, or is an inside bar.
2. User-Defined Criteria
Criteria that you define include:
Candle Type: Bull bars, Bear bars, or both
Candle Attributes
Average Size based on Standard Deviation or Average of all potential bars in price history
Search within a specific price range
Search within a specific time range
Clarify time range using defined sessions and with or without weekends
3. Strike Lines on Candle
Often you want to know how price reacts when it gets back to a certain candle. Also it might be true that candle types cluster in a price region. This can be identified visually by adding lines that extend right on candles that fit the criteria.
4. User-Defined Context
Labeled “Alternative Criteria,” this facet of the script allows the user to take the context provided from another indicator and import it into the indicator to use as a overriding criteria. To account for the fact that the external indicator must be imported as a float value, true (criteria of external indicator is met) must be imported as 1 and false (criteria of external indicator is not met) as 0. Basically a binary Boolean. This can be used to create context, such as in the case of a traditional fractal, or can be used to pair with other signals.
If you know how to code in Pinescript, you can save a copy and simply add your own code to the section indicated in the code and set your bull and bear variables accordingly and the code should compile just fine with no further editing needed.
Included with the script to maximize out-of-the-box functionality, there is preloaded as alternative criteria a code snippet. The criteria is met on the bull side when the current candle close breaks out above the prior candle high. The bear criteria is met when the close breaks below the prior candle. When Alternate Criteria is run by itself, this is the only criteria set and bars are highlighted when it is true. You can qualify these candles by adding additional attributes that you think would fit well.
Using Alternative Criteria, you are essentially setting a filter for the rest of the criteria.
5. Extensive Read Out in the Data Window (right side bar pop out window).
As you can see in the thumbnail, there is pasted a copy of the Data Window Dialogue. I am doubtful I can get the thumbnail to load up perfectly aligned. Its hard to get all these data points in here. It may be better suited for a table at this point. Let me know what you think.
The primary, but not exclusive, purpose of what is in the Data Window is to talk about how often your criteria happens and what happens on the next bar. There are a lot of pieces to this.
Red = Values pertaining to the size of the current bar only
Blue = Values pertaining or related to the total number of signals
Green = Values pertaining to the signal bars themselves, including their measurements
Purple = Values pertaining to bullish bars that happen after the signal bar
Fuchsia = Values pertaining to bearish bars that happen after the signal bar
Lime = Last four rows which are your percentage occurrence vs total signals percentages
The best way I can explain how to understand parts you don’t understand otherwise in the data window is search the title of the row in the code using ‘ctrl+f’ and look at it and see if it makes more sense.
█ [b}Available Candle Attributes
Candle attributes can be used in any combination. They include:
[*}Bodies
[*}High/Low Range
[*}Upper Wick
[*}Lower Wick
[*}Average Size
[*}Alternative Criteria
Criteria will evaluate each attribute independently. If none is set for a particular attribute it is bypassed.
Criteria Quantity can be in Ticks, Points, or Percentage. For percentage keep in mind if using anything involving the candle range will not work well with percentage.
Criteria Operators are “Greater Than,” “Less Than,” and “Threshold.” Threshold means within a range of two numbers.
█ Problems with this methodology and opportunities for future development:
#1 This kind of work is hard.
If you know what you’re doing you might be able to find success changing out the inputs for loops and logging results in arrays or matrices, but to manually go through and test various criteria is a lot of work. However, it is rewarding. At the time of publication in early Oct 2022, you will quickly find that you get MUCH more follow through on bear bars than bull bars. That should be obvious because we’re in the middle of a bear market, but you can still work with the parameters and contextual inputs to determine what maximizes your probability. I’ve found configurations that yield 70% probability across the full series of bars. That’s an edge. That means that 70% of the time, when this criteria is met, the next bar puts you in profit.
#2 The script is VERY heavy.
Takes an eternity to load. But, give it a break, it’s doing a heck of a lot! There is 10 unique arrays in here and a loop that is a bit heavy but gives us the debug window.
#3 If you don’t have a clear idea its hard to know where to start.
There are a lot of levers to pull on in this script. Knowing which ones are useful and meaningful is very challenging. Combine that with long load times… its not great.
#4 Your brain is the only thing that can optimize your results because the criteria come from your mind.
Machine learning would be much more useful here, but for now, you are the machine. Learn.
#5 You can’t save your settings.
So, when you find a good combo, you’ll have to write it down elsewhere for future reference. It would be nice if we could save templates on custom indicators like we can on some of the built in drawing tools, but I’ve had no success in that. So, I recommend screenshotting your settings and saving them in Notion.so or some other solid record keeping database. Then you can go back and retrieve those settings.
#6 no way to export these results into conditions that can be copy/pasted into another script.
Copy/Paste of labels or tables would be the best feature ever at this point. Because you could take the criteria and put it in a label, copy it and drop it into another strategy script or something. But… men can dream.
█ Opportunities to PineCoders Learn:
1. In this script I’m importing libraries, showing some of my libraries functionality. Hopefully that gives you some ideas on how to use them too.
The price displacement library (which I love!)
Creative and conventional ways of using debug()
how to display arrays and matrices on charts
I didn’t call in the library that holds the backtesting function. But, also demonstrating, you can always pull the library up and just copy/paste the function out of there and into your script. That’s fine to do a lot of the time.
2. I am using REALLY complicated logic in this script (at least for me). I included extensive descriptions of this ? : logic in the text of the script. I also did my best to bracket () my logic groups to demonstrate how they fit together, both for you and my future self.
3. The breakout, built-in, “alternative criteria” is actually a small bit of genius built in there if you want to take the time to understand that block of code and think about some of the larger implications of the method deployed.
As always, a big thank you to TradingView and the Pinescript community, the Pinescript pros who have mentored me, and all of you who I am privileged to help in their Pinescripting journey.
"Those who stay will become champions" - Bo Schembechler
Candle Fill % MeterFor use with Hollow Candles
Fills Candles based on either the value of the RSI or coppock scaled to fit properly between the open and close. Makes for a compact visual with lot's of information given. Toggle bells and whistles in settings such as arrows to indicate the direction of the value being measured, dividing levels, fill from candle open all the time instead of the bottom up and more.
FunctionCosineSimilarityLibrary "FunctionCosineSimilarity"
Cosine Similarity method.
function(sample_a, sample_b) Measure the similarity of 2 vectors.
Parameters:
sample_a : float array, values.
sample_b : float array, values.
Returns: float.
diss(cosim) Dissimilarity helper function.
Parameters:
cosim : float, cosine similarity value (0 > 1)
Returns: float
Moving average percent measureit's just an average moving multiplied by a percentage. this is good for measuring the acceleration of price movements
Trend Indicator B-V2 (Momentum measuring)"Trend Indicator A-V2" and "Trend Indicator B-V2" are updated and improved versions of my initial trend indicators. Totally rethinking the code, adding highs and lows in the calculations, including some more customisation through colour schemes.
In practice, this indicator uses EMAs and Heikin Ashi to provide an overall idea of the trend.
The "Trend Indicator A-V2" is an overlay showing “Smoothed Heikin Ashi” .
The "Trend Indicator B-V2" uses the same values in a different way to measure the momentum of the trend and identify potential trend rejections.
Please, take into account that it is a lagging indicator.
Zahorchak MeasureCreator: Michael G. Zahorchak.
References:
The Art of Low Risk Investing by Michael G. Zahorchak, 1977. Unfortunately, it's all but impossible to find a copy these days.
The Complete Guide to Market Breadth Indicators by Gregory L. Morris, 2006. A fantastic resource for those interested in Technical Analysis or creating their own trend based system.
Two articles by Greg Morris on the Zahorchak Measure. I can't link to them under the House Rules, but they are easily searchable.
The Zahorchak Measure (ZM) is designed to give you a market bias (either uptrend or downtrend) which you can use to determine a trade bias for ETF's or stocks.
ZM works by taking multiple moving averages of the NYSE Composite, a moving average of the NYSE advance decline line, and examining the relationship between those elements. Broadly, the market is considered to be in a uptrend when ZM is above zero, and a downtrend when below. However, there are many ways to interpret the indicator.
The version created by Greg Morris is more akin to a binary indicator in that ZM jumps from number to number. This version is smoothed to create an oscillator as it reduces whipsaws (at the expense of lag). You can set the EMA Length to 1 to go back to the original.
Some notes:
Michael Zahorchak called it the "Zahorchak Method", whereas Greg Morris uses the term "Measure". I'm not totally clear on the change, but Mr. Morris made some changes (covered below), so that may explain the altered name.
The original indicator used moving averages of 5, 15, and 40 weeks. I have converted these to daily numbers as that's the time frame I most commonly trade. You can convert the numbers back by dividing by 5.
The original indicator used the Dow Industrials for the moving averages, however Greg Morris switched to the NYSE Composite due to the advance decline line being based on the NYSE.
Greg Morris removed the 5 period moving average of the NYSE Composite, as it created increased volatility at market tops and bottoms. I tested ZM with the 5 period MA added back in, and I believe removing it creates a superior indicator.
I've added both Multi Time Frame functionality, and the ability to alter moving average lengths. Play around and see what you can come up with.
ZM oscillates between -10 and +10. There are some interesting levels creating between these two numbers (apart from the obvious zero level) - see what you can come up with.
All credit goes to Michael Zahorchak and Greg Morris for the indicator creation. I have simply reproduced their work for the TradingView community as this great indicator wasn't available.
Any queries let me know in the comments or PM me.
DD.
[RS]Function - Minkowski_distancecopy pasted description..
Minkowski distance is a metric in a normed vector space. Minkowski distance is used for distance similarity of vector. Given two or more vectors, find distance similarity of these vectors.