Decoding Wedge PatternsThere is a strong bias about chart patterns and their interpretation in the technical analysis space. It is a very common belief that a rising wedge forms bearish sentiment and a falling wedge forms bullish sentiment. Is that really true and how much we can rely on such bias?
In order to understand this, we need to dig a little bit about how such concepts could have come into the picture. The best I could get on the internet is an article from Investopedia that explains few technical reasons and constraints of using these patterns.
Through the Lens of Diagonal Waves
But, when I was studying the concepts of waves, this is what I found from one of the sources I referred to about diagonal waves:
ewtaf.com
Details are summarised and explained in the below diagram
The summary here is, Diagonal waves of contracting types are the same as that of Contracting Wedge patterns. And the diagonal waves of Expanding types represent expanding wedge chart patterns.
Diagonal Waves can appear as sub-waves in multiple parts of the entire Elliott Wave. And here are our scenarios
Leading Diagonals
Leading diagonals are diagonal waves that can appear towards the start of a trend. This can be
Wave 1 of an Impulse Wave - This is the start of a new trend. Avoid trading these wedges as they can be short pullbacks. Or better look for pullback and trading opportunities in the direction of the wedge.
Wave A of a Zigzag Wave - This can lead to a possible bull trap or bear trap. The corrective wave is likely to continue after a small pullback
Ending Diagonals
Both expanding and contracting types can be ending diagonals. Can appear as
Wave 5 of an Impulse Wave - Meaning the trend is coming towards possible exhaustion.
Wave C of zigzag or flat - Correction or pullback is coming to an end and the trend is likely to continue
Wolfe Wave
Wolfe wave is a rule built on top of wedge patterns to identify time-bound targets. The idea of generating targets and stops based on the Wolfe Wave is as shown below:
Further, here are a few indicators developed in Pinescript that can help do them automatically.
Wolfe Scanner
Wolfe Strategy
Takeaways
Here are a few things we learnt from our study.
When you are looking for wedge patterns on the chart, look for wedge formations created by 5 pivots. You can learn more about this from this post Fitting Patterns To Your Bias?
Before trading a wedge pattern, try to identify if the pattern fits in a bigger scheme of things. Check if they are towards the end/start of a trend or pullback
Concepts such as Wolfe Wave can help setup rules for trading wedge patterns for pullbacks.
Trendoscope
Overview of Reversal Chart Pattern IndicatorHello Everyone,
In this video, we discussed briefly about
Different Reversal Chart Patterns
Zigzag and Patterns Ecosystem of Libraries and Indicators developed in Pinescropt
Recursive Reversal Chart Pattern Indicator
Adding the snapshot for reference
Link to the Indicator:
Search for Zigzag and Pattern Ecosystem libraries and indicators in my profile if you like the subject :)
How to create auto trading bots for zero costHello Everyone,
Following are the things we discussed
🎲 Minimal Components of Auto Trading System:
Source where signals are generated
Exchange/Broker where orders are placed
Integration component which bridges both
🎲 In this example
Source - is our tradingview system and a sample script which generate alerts. Do not use this script for trading as it is only created for demonstration.
Exchange - We are going to use BingX exchange for this example as we only have this implementation in our integration system.
Integration System - www.pipedream.com is used for integration. This is cloud based integration product which is very flexible. Platform also allows users to contribute towards the product. Hence, it is very easy for us to develop integration to any broker or exchange which has API support.
🎲 Limitations
BingX APIs are fairly new and hence there are not much features. There is no option to place stop order.
It has option to place only limit/market orders
Stop loss is not possible via API
🎲 Steps:
🎯BingX
- Create account and enable perpetual futures trading
- Setup google authenticator and add valid email and phone.
- Create API - it will ask for Google authenticator code and email and phone OTPs.
- Store api key and secret key in safe place.
🎯Tradingview
- Create a script which can send stop, target, ticker information as signal.
- Study the existing idea about customising alerts for better understanding on how to achieve this.
🎯Pipedream
- Create account and setup BingX as source (needs API Key and Secret Key derived from BingX)
- Create Webhook trigger and capture webhook URL.
- Provide this URL in alerts to generate alert messages which are sent to webhook by default.
- Once alert is sent, load the alert in pipedream source and built rest of the workflow including calculate leveraged position and bracket order trades.
- Once tested, deploy the workflow so that workflow will keep listening to incoming alerts to generate trades.
Please note: the discrepancy in leverage calculation caused due to two things:
Lower timeframe used for generating faster alerts. Since the volatility is small, gaps can be huge.
The workflow did not run at once. Hence the delay caused rest of the issues resulting in miscalculations.
These problems however will not come when orders are placed via alerts and executed automatically.
Know Your PitchforksPitchfork is drawn when price forms ABC pattern. Pitchfork draws a series of parallel lines in the direction of trend which can be used for support and resistance.
There are many methods of drawing pitchfork. In all cases, a line joining BC will make the base of pitchfork and fork lines are drawn from different points of the base. All the fork lines will be parallel. But, the handle of the base defines the direction of fork lines. Classification of pitchfork is mainly based on the starting and ending points of the handle.
🎲 Regular Types
Here, end of the handle is always fixed and it will be the mid point of B and C.
🎯 Andrews Pitchfork
Handle starts from A and joins the base at mid of B and C.
Forks are drawn based on fib ratios from the handle
🎯 Schiff Pitchfork
Handle starts from Bar of A and price of middle of AB and joins the base at mid of B and C
Forks are drawn based on fib ratios from the handle
🎯 Modified Schiff Pitchfork
Handle starts from mid of A and B and joins the base at mid of B and C
Forks are drawn based on fib ratios from the handle
🎲 Inside Types
Here, C will act as end of the handle which joins the Base BC .
🎯 Andrews Pitchfork (Inside)
Handle starts from A and joins the base at C
Forks are drawn based on fib ratios from the handle
🎯 Schiff Pitchfork (Inside)
Handle starts from Bar of A and price of (A+B)/2 and joins the base at C
Forks are drawn based on fib ratios from the handle
🎯 Modified Schiff Pitchfork (Inside)
Handle starts from mid of A and B and joins the base at C
Forks are drawn based on fib ratios from the handle
Feel free to explore the open source indicator Recursive Auto-Pitchfork
Using scatterplot to understand the impact of RSI eventHello Everyone,
In this video we have discussed following things.
Scatter plot and implementation in Pine using heat map representation on tables.
Different quadrants and what it means.
RSI use case implemented in the indicator - RSI Impact Heat Map
How to use different settings and how to interpret the derived output.
General belief is when RSI crosses over 70, it is considered as overbought and people expect price to drop and when RSI crosses under 30, it is considered oversold and people expect price to move up. But, using this indicator, we can measure and plot the outcome of these events as scatter plot and use that to understand if these sentiments about overbought/oversold is right.
This can also be used with any entry condition. I look forward to developing a generic library for this so that other developers can make use of this to test their own criteria.
Thanks for watching this video. Let me know if you have any questions :)
Tradingview Telegram Webhook Bot with Chart Snapshot (Revised)Hello Everyone,
In this video, we will try to go through revised implementation of Tradingview-Telegram-Bot which can be used to send alert messages from tradingview to telegram along with current chart snapshot.
🎲 Base
Initial version of the same idea are as below:
How-to-create-simple-web-hook-to-send-alerts-to-Telegram
How-to-capture-chart-snapshot-in-tradingview-telegram-alert-bot
🎲 Prerequisite
Before proceeding with the current video, please watch the first video - How-to-create-simple-web-hook-to-send-alerts-to-Telegram which covers lots of basic things such as
Creating Telegram Bot using botfather and capturing required information such as TOKEN and CHANNEL
Basic usage of replit - a cloud based hosting service which lets us define our webhooks with little to no cost.
Postman - tool which is required to test the webhooks created
Other information such as keeping the bot alive via cronjob, using the webhooks in tradingview alert widget etc.
🎲 Setup
Clone/fork replit repo
Set mandatory environment variables CHANNEL and TOKEN
Set optional environment variables username/password or sessionid
Run the bot and start using webhooks
🎲 Usage
Webhook URL will be of the format.
https://Tradingview-Telegram-Bot. .repl.co/webhook?
🎲 Important Query parameters
jsonRequest - can be set as true/false. Default is false. If set to true, the payload should be a standard json. Output to telegram will be sent in tabular format. If not set or if set to false, output to telegram will be clear text.
tblfmt - table format to be used when jsonRequest is set to true. Default is plain. The values are exactly same as the ones required for tabulate package.
chart - Send the chart id if required to send chart snapshot along with alert message. For this to work - chart needs to be either a shared chart or environment variables for tvusername and tvpassword should be set to the user who has access to given chart.
ticker - Chart ticker. You no longer need to use different chart for different tickers. You can have a common chart and pass ticker to it so that chart will automatically switch to given ticker before taking screenshot
delivery - Taking chart snapshot takes time. This also delays the delivery of alert message. To avoid this, we can use this option - delivery=asap so that alert message will be sent as soon as possible and chart is sent later. If this parameter is not set, then both the messages will be delivered together.
🎲 Repository URLs
Tradingview-Telegram-Bot-Github
Tradingview-Telegram-Bot-Replit
Fitting patterns to your bias? I saw a post in twitter which marked a particular converging triangle on BTCUSDT chart on 4H timeframe (As shown below) and implying more bearishness ahead. But, is it really correct analysis?
Risk of drawing patterns manually is that we can fit any pattern to price action based on our bias. To overcome this, we need to follow a standard method to draw patterns on chart. Below is my algorithm for drawing patterns.
Draw zigzag on chart
Find and draw a trend line joining 2 or more pivot lows where price has not breached the trend line towards downside.
Find and draw a trend line joining 2 or more pivot highs where price has not breached the trend line towards upside.
While drawing, trend lines can touch the pivot candle at any point. But, candles should not lie outside trend line.
Take fake outs into consideration to make minor adjustments.
At least one among the above trend line should join 3 or more pivots. Another one can have just two pivots.
Do you see clear pattern after following these steps? If yes, then you found your pattern and also a skill to define them objectively without bias.
How to draw trend lines in objective (algorithmic) wayHello everyone,
In this video, we explore how to draw trend lines in more subjective and algorithmic way.
Problem with drawing trend lines manually are
Subjective and may be influenced by personal factors
Easy to fit on historical data based on our biases.
Chances of overfitting to confirm our biases/ideas.
We can avoid these drawbacks by using an algorithmic method to achieve the same.
I have also developed several scripts which can help achieve this automatically. Users can refer to them for learning and practicing. Few of them are:
Auto TrendLines
Wedge and Flag Finder (Multi - zigzag)
Trendline Pairs (Deep Search)
Coming back to process of drawing trend lines manually, here are the steps.
Use and apply any zigzag indicator on the chart. In the demonstration, we have used Recursive Zigzag
Draw lines which joins more than 2 pivot lows for lower trendline and more than 2 pivot highs for higher trend line.
Make sure from starting pivot to ending pivot, price has not broken trendline convincingly, there can be rejections (touches) or fakeouts (just one or two bars outside trend line)
Higher number of candles touching the trendline, higher the strength of trend line.
If both higher and lower trend lines can be established, we can identify it as pattern - which can be triangles, wedges, channels etc.
Use different levels and lengths of zigzag to find different combinations. And then zero down to best possible pattern or use them in confluence.
Hope it was helpful and please let me know if you have any questions.
Wyckoff distribution pattern - bull case!!Been thinking of building an algorithm for Wyckoff distribution detection. But, for now, just expressing my thoughts via this idea.
While zigzag can be basic building block, using modified channels may help further in avoiding fakeouts. In this example, we can also see that OBV and RSI has divergence. Let's see if this results in a fakeout or continue to complete wyckoff distribution pattern.
HOW-TO: Auto Harmonic Pattern - BacktesterHi All,
Here is a short video on how to use Auto-Harmonic-Pattern-Backtester-Trendoscope for building strategies using harmonic patterns.
CAUTION: THIS IS NOT A STRATEGY AND SHOULD NOT BE FOLLOWED BLINDLY. WE ENCOURAGE USERS TO UTILISE THIS AS BACKTESTING TOOL FOR BUILDING THEIR STRATEGY BASED ON HARMONIC PATTERNS
Notes about Strategy Properties
Qty is percentage based and non leveraged. Since pattern size is not uniform, risk per trade is not uniform per trade as well.
Default pyramiding is set to 4 - which means not all patterns will have trade if number of open trades is already 4
Key Settings
Can be either long or short mode but not not both. This is due to pine limitations.
Entry, Stop and Target settings along with Base are important in defining your strategy.
External filters plays a major role in adding external elements to the strategy. This also enables users to build their own filters. More details in this video
Strategy based alerts are different than custom alerts defined in settings. Custom alerts will fire for every pattern whereas strategy alerts will only fire upon generated trade signals. More details about Alert customisation is explained here .
When setting alerts, please turn off displays - pattern drawing and tables. And also limit backtest to minimal bars.
Please let me know if you have further questions.
Using Harmonic Pattern with Trend Following SystemHarmonic Pattern as system is known for finding possible reversal zones and hence assist in swing trading. But, most effective way of using harmonic patterns is in trend following. This can yield really amazing results when played with proper risk management.
Conditions
In trending market
Established trend followed by pattern
Trade Settings
Enter on breaking out of pattern with 100% recovery
Exit can be placed at farther distance or can also use trailing stop after certain profit.
Need to be cautious on short trades as expectation of high risk reward may end up in negative territory. (Lowest price can be 0)
Advantages
Very high risk reward. Even with less number of wins, can get very high reward.
Less slippage and commission
Simple to trade and takes less human effort.
Disadvantages
Lower win ratio. (Does not impact profit)
Longer trades need more patience
HOW-TO: Wolfe Strategy [Trendoscope]Just made this short video to explain the concepts of Wolfe Strategy which I recently published.
Wolfe wave is popular concept among option traders. However, I have made some tweaks in this strategy to standard wolfe pattern trade rules.
Entry price based on breakout
No moving target - using flat target.
Entry is done based on risk reward
Not time bound
Intelligently decides whether to place stop order or limit order
Few possible future improvements
Make bidirectional trades possible
Better filters to chose long and short trades or when to trade
Lot can be improved on Wolfe scanner to identify more patterns
Exit strategy - can introduce optional trailing
Thanks for listening. Hope you enjoyed and learnt something from this :)
Relation between Win Ratio and Risk RewardHello Everyone,
In this video, I have tried explaining the relationship between win ratio and risk reward.
🎲 Two sides of the coin
People often asked me if a strategy win rate is less than 50% then why do we need to follow it? And also we can see in social media - lots of people claiming 90%+ win ratio for their strategy.
There is also another set of people who are more infatuated with how much percent profit they can get out of strategy. In social media, we can see people bragging about 1000% + profit trades.
The question here is, is it really possible to achieve this consistently or is the expectation to achieve such success reliable?
Simple answer for this is yes, it is possible to achieve both 99% win rate and 1000%+ profitability. But, it is almost impossible to achieve both together. Thing we need to understand is,
We can have 99% win rate and still lose money!!
We can have 1000% profitable trades and still lose money!!
How??
That's because people claiming both these things do not talk about other side of the coin.
Example 1 : Option Selling for premium
Selling options is very popular trading strategy which can often have very high win rates. But, the risk reward for this is very low.
You may get premium of $1 where you will be risking $100 on every trade. With that, you will lose money even if you have 99% win rate.
99 X $1 = 99 profit
1 X $100 = 100 loss
----------------------
$1 Loss
----------------------
Example 2 : High Leverage Trades
When you are trading with high leverage, profits and losses are magnified. This may lead to lots of losses and also some trades with huge profit.
Lets say you are targeting 1000% win per trade with 100X leverage. This means, your position is liquidated upon 1% price drop or less. So, your threshold for withstanding drawdown in a trade is less. To make 1000% profit, you the price need to go up by 10%
Risk = $1
Leverage = 100X
Buy price = 100
Your position will liquidate if price hits 99. So, by just 1% drop.
To achieve 1000% profit, price need to go up by 10%
This means, your expectations of profit per trade is very high. This also mean, you are most likely to have more failed trades than wins. So, lets say you will end up with Win ratio of 5% with this expectation. The equation can look something like this.
5 X $10 = 50 profit
95 X $1 = 95 loss
-----------------------
$45 loss
-----------------------
🎲 The balance
What we learn from above examples is that there is no meaning of considering only Win Ratio or only Risk Reward while trying to build your strategy. What you need to consider is the combination of both together.
Here is a formula to understand how much win ratio do you need to breakeven with given risk reward.
Win Ratio = 1/(Risk Reward+1)
Similarly here is a formula to understand how much Risk Reward you should target to breakeven with given win ratio.
Risk Reward = 1/(Win Ratio -1)
Here is google sheet containing the formula applied on various values. docs.google.com
You can use this formula to understand overall profitability while building or evaluating strategies.
Hope this is helpful. Thanks very much.
RepaintingHello All,
In this video - we discussed about what is repainting, different types of repainting, how we can identify them and some resources for programmers to avoid them programmatically.
Here are some quick resources for programmers:
www.tradingview.com
Please let me if there are further questions
HOW-TO: Auto Harmonic Patterns - UltimateX (Revised)Hello Everyone,
Here is a video on detailed settings guide to invite only script -
In this video, we discuss about:
* Few important settings and how to use them
* Few references to other tutorials for extended help
Also please refer to linked ideas about:
* How to customise alerts in Auto Harmonic scripts
* How to use external filters
Let me know if you have any questions.
HOW-TO : Auto Chart Patterns UltimateHello All,
I have made this video which covers briefly on following points for Auto-Chart-Patterns-Ultimate-Trendoscope
1. Indicator components
2. Detailed settings
3. Few key features
4. Info about trading different patterns included
I could not cover alerts in the video due to time constraints. But, alerts is same as that of HOW-TO-Customize-Alerts-in-Auto-Harmonic-Scripts
Let me know if you have any question. For trial access and subscription please look at the script page - 'Author's Instructions' section.
HOW-TO: Using Data Gathered in Divergence BacktesterHello Everyone,
Here is a small video describing the idea on studying divergence data based on divergence backtester script.
To understand further, you can study some of my older scripts on divergence. You can find them under my profile: www.tradingview.com
Filter only open source scripts so that you will see only free to use scripts with code available. This is not a fully fledged strategy. But, just means for studying the impact of divergence data on price action. Please let me know if you have any questions.
Using Zigzag to find patternsZigzag is my favourite technical indicator. Usage of zigzag is often misunderstood. People try to find tops and bottoms and complain that it repaints. Well, zigzag is supposed to repaint its last pivot and it should not be used finding tops and bottoms to enter and exit at the right time. Then, how do we use zigzags?
Main application of zigzag for me is pattern recognition. Just put zigzag on your chart and observe how easy it will become to identify patterns.
The chart below shows double bottom - confirmed by divergence on lower pivots and continuation on higher pivots (price, strength and volume are all making higher high). Having said that, we need to keep in mind the expectations of double bottom pattern and settle for appropriate risk reward.
How to create fully customisable alerts in pinescriptHi All,
As discussed in the video, below are the steps to define fully customisable alert templates and alerts in pine script. This is a generic idea which can be implemented for any script.
Step 1. What all parameters(keys) need to be sent in alerts.
Step 2. Create a default alert template
Step 3. Create a user input where users can alter the default alert template
Step 4. Define your alert condition.
Step 5. Calculate the values for all the keys
Step 6. In the template, replace all keys with values and send alert
Sample script developed during the video.
//@version=5
indicator("Fully Customizable Alerts", overlay=true)
import HeWhoMustNotBeNamed/RecursiveAlerts/2 as ra
//Step 1. What all parameters(keys) need to be sent in alerts.
keys = array.from("{entry}", "{stop}", "{target1}", "{target2}")
//Step 2. Create a default alert template
template = '{
\t"entry" : {entry},
\t"stop" : {stop},
\t"target1" : {target1},
\t"target2" : {target2}
}'
//Step 3. Create a user input where users can alter the default alert template
inputTemplate = input.text_area(template, 'Alert Template')
//Step 4. Define your alert condition.
ma = ta.sma(close, 20)
condition = ta.crossover(close, ma)
atr = ta.atr(14)
if(condition)
//Step 5. Calculate the values for all the keys
entry = high + atr
stop = low - atr
risk = entry - stop
target1 = entry + risk
target2 = entry + 2*risk
//Step 6. In the template, replace all keys with values and send alert
values = array.from(str .tostring(entry), str .tostring(stop), str .tostring(target1), str .tostring(target2))
alertMessage = ra.updateAlertTemplate(inputTemplate, keys, values)
alert(alertMessage, alert.freq_once_per_bar)
plot(ma, "Moving Average")
Risk/Reward & probability calculation based on historical statsThere are two contracting triangles on the chart. Both broken downside. Now, lets see the historical results of trades based on contracting triangles on bearish side for BTC on daily chart
Based on this,
Probability of price reaching 25300 before hitting 42700 is 30-33%
Risk reward for the bearish side is 0.64
Probability of price reaching 18903 before 50736 is 58-60%
Risk reward for the bearish side is again 0.65
Hence, the inverse of it will be stats for long side.
Probability of price reaching 42700 before hitting 25300 is 67-70%
Risk reward for the bullish side is 1/0.64 = 1.56
Probability of price reaching 50736 before hitting 18903 is 58-60%
Risk reward for the bullish side is 1/0.65 = 1.53
Full chart below:
Which side you are going to chose for short term speculation :)
HOW-TO: Customize Alerts in Auto Harmonic ScriptsMaking this video on setting alert in the invite only scripts
Auto-Harmonic-Pattern-Ultimate-Trendoscope
Auto-Harmonic-Projection-Ultimate-Trendoscope
Auto-TrendLines-and-Support-Resistance-Ultimate-Trendoscope
For value placeholders, please visit the description and updates done in 11th and 12th Feb for Harmonic Pattern scripts. And 20th Feb for Auto Trendline script.
Fundamental analysis on FBVery similar to yesterday's post on PYPL. Similar methodology and tools used.
Disclaimer: I do not hold FB and may not hold going forward as well. Massive price drop on earnings prompted me to dig a little more and do this analysis. All the methods are derived from free and open source scripts aimed at finding statistical and fundamental edge.
Point of this analysis is to understand if the massive price drop is justified or if this is an overreaction based on fundamentals and stats.
🎲 Earnings
Reported revenue and profit for this quarter is not too far from the estimated guidance. 🟡
Guidance for future earnings and revenue is weak. 25% drop in Q1 earnings estimates whereas 15% drop in Q1 revenue estimates. 🔴
Last year Q1 had similar drop where EPS dropped by 16% and revenue dropped by 10%. Hence, this drop may be season. 🟡
🎲 Financial stability
There is no doubt that financial position of FB is still very strong with low levels of debt and strong overall returns and margin. 🟢
🎲 Growth Projections
Based on the history, growth isn't concerning point too. However net income and book value seems to be stagnating and rate of increase of earnings and revenue seems to be dropping. This may not be concern for companies such as FB which are too big. 🟡
🎲 Drawdown from ATH
Present drawdown from ATH is around 36% and according to stats, this drop is 90th percentile. Meaning stock has had such a drawdown for only 10% of its trading time in the history. This may mean bargain for those who are willing to invest on the basis of value. 🟢
🎲 Comparison with fundamentals
Drop in fundamentals does not look too alarming. 🟢
Please note that range mentioned is percentile range. Book value per share is at 3.6 percentile even though it is not too far from peak. This is because not often FB's book value dropped in the overall history - which itself is quite impressive.
Let me know your views in the comment people!!






















