Harmonic Patterns ProHello All,
We need to make things better & better to solve the puzzle and I try to do my best on this way for the community. now I am here with my Harmonic Patterns Pro script.
Harmonic Pattern recognition is the basic and primary ability any trader develops in technical analysis. Harmonic pattern recognition takes extensive practice and repetitive exposure. in general chart patterns are categorized into “continuous” and “reversal” patterns. Harmonic patterns construct geometric pattern structures using Fibonacci sequences. These harmonic structures identified as specified harmonic patterns provide unique opportunities for traders, such as potential price movements and key turning or trend reversal points. This script is developed to find following patterns by using the options you set. I have to say that this is not a strategy and you should not use this script blindly, instead, I strongly recommend you to create your own strategy using this script with other tools/indicators, such moving averages, Support/Resistance levels, volume indicators, sentiment indicators etc.
- Following Harmonic Patterns are available in this version:
-->Gartley
-->Butterfly
-->Bat
-->Crab
-->Shark
-->Cypher
-->Alternate Bat
-->Deep Crab
-->5-0
-->3-Drive
-->AB=CD
-->Descending Triangle
-->Ascending Triangle
-->Symmetrical Triangle
-->Double Top
-->Double Bottom
How the script works and finds harmonic patterns:
- It uses zigzag like other harmonic pattern script but there is a difference. this scripts searches up to 200 bars, finds/creates up to 200 XABCD using zigzag waves and searches predefined harmonic patterns
- It can find multiple harmonic patterns on a candles with different sizes and lengths
- Each pattern is shown using its own color (you can set 8 different colors)
- it shows Entry, Target1, Target2 and Stop-loss levels for each found Patterns
- It shows pattern validation zones for each found pattern
- it has all-in-one alerts. you set the alerts you want in the indicator options and you create only 1 alert for each symbol.
- it has prediction future and it can show many predicted patterns at the same time, each predicted patterns validations zones are shown separately
- While on real-time bar it searches and shows patterns for the visible area
it has followng alerts: . these in all-in-one alerts. it means that you choose the alerts in the options and enables any of them and then create only one for each symbol. and you get eany alert you choose. (" Any alert() function call "). in this version "Any alert() function call" alert is only alert you can use, if I get some requests I can try to other alerts as well.
New Pattern Found
Pattern Updated
Entered Position
Reached Target
Stop-loss
Validation zone is calculated using XABC points any pattern by using Y-Axis error rate. so if you increase Y-Axis error rate then the script can find much more Harmonic patterns.
X-Axis Error Rate is used for a few pattern such AB=CD for the distance of AB wave and CD wave.
The script can show Recommended Entry, Target 1, Target 2 and stop-loss levels for each active patterns. of course you can use these levels or you can set your own levels. you can see the screenshot below.
The script can show statistics panel. when statistic panel is enabled then no pattern is shown on the chart, the script shows ONLY statistics panel. This was done because of complexity of the script.
If you enables Prediction then pattern checks all possible XABC formations in the last 200 bars and finds/shows predicted patterns if there is any.
if you "replaying" then the script searches patterns only for last bar (if any update on zigzag on last bar), not for historical ones. you should take care while you use "Replay" feature of Tradingview
Now lets see the options:
Minimum ZigZag Period: this is minimum Zigzag Period to create new Zigzag wave. default value is 10 and minimum value is 4
Y-Axis Error Rate %: this is the error rate to create validation zones for each pattern, there is almost no perfect pattern, so we try to create a zone using error rate
X-Axis Error Rate % : this is used for a few pattern (such AB=CD) to check wave lengths on time basis
Minimum Pattern Length: This is Minimum Length for the Patterns to be searched. in Number of Bars
Maximum Pattern Length : This is Maximum Lengths for the Patterns to be searched. in Number of Bars
Max Number of XABCD to search: Maximum Number of ABCD to search pattern on each move, there are many possible XABCDs on the chart, this limitation is the number for how many of them will be searched
Find Patterns for: is the option about taking position. there are three options: "Long and Short", "Only Long", "Only Short"
Max Patterns on Each Bar: Maximum Number of Patterns that can be found on each bar, by default it's 3
Keep Pattern Until: you have two option "Target1" and "Target2". when a pattern found and if it reach any of these targets it is accepted as it's reached target and removed. this is also used inthe statictics panel!
Show Recommended Entries & Targets: if enabled then the script can show "Recommended" Entry, target1, target2 and stop-loss leves. you can use these levels or you can use your own calculation for each pattern
Entry = % of Target 2 : Entry Level for each pattern is calculated using the distance between D positon of the pattern and target 2. by default it's 16%, you can set it as you wish
Entry&Target Line Style: you can set line style for entry/target/stop-loss levels
Show Pattern Validation Zones: as explained above, for each pattern validation zone is created using error rate (Y-axis error rate). you can see it for each pattern
Source for Invalidation: this source is used for validation zones. there is two options: Close or High/Low. this source is used while invalidated the pattern. by default it used "close" price as source
Line Style: this is line style for validation zones, solid, dashed or dotted
Pattern Prediction/Possible Patterns: if you enable this option then the script calculates/searches possbile patterns and shows their levels in a label if there is one or more
Show Label & Zone: this is about how you want to see predictions, there are two choices: "Show Only Label", "Show Label & Zone"
Show Statistics Panel : if you enable this option then the script starts searching all harmonic patterns from the first bar for the last bar and keeps statistics for all of them and the shows in a table. you can see screenshot below
Panel Position: you can set panel location of statistics panel using this option
Show Rates Between Waves: if you enable this option then rate between the waves are shown. by default it's enabled
Keep Last Pattern on the Chart : if you enable this option then even if pattern is invalidated/reach target/stop-loss it stays on the chart until new pattern is found. by default it's enabled
Line Style : line style for the last pattern on the chart
Patterns to Search: you have options to enable/disable the patterns listed above to find&show, you can enable/disable any pattern in the list. by default all patterns are enabled except AB=CD pattern
in the ALERTS menu you have many options to enable/disable the alerts you want. Alerts contain Symbol name, Pattern name, Direction as Long/Short, Recommended Entry, Targets, SL levels.
- New Pattern Found
- Pattern Updated
- Entered Position
- Reached Target
- Stop-loss
Show Zig Zag: if you want to see Zig Zag then you should enable this option, and you can set the colors for the Zig zag. by default it's disabled.
and some other options for coloring and line styles of the patterns..
This is how XABCD points found using zigzag waves, I tried to explain it in the video below:
Validation zones and Entry, Target1, Target2 and Stop-loss levels:
Each pattern has its own color, you can see which levels, letters, lines etc belongs to which pattern:
Pattern prediction: you can enable it and change its background color:
How Statistics panel looks like. if there is active pattern then it's shown in different color in the table
This screenshot shows how the script finds and shows multiple patterns on a candle:
And some examples for triangles and Double top/bottom patterns:
Symmetrical triangle:
Ascending triangle:
Double bottom
and many others..
While using different time frames the script can find same patterns, in the following screenshots you can see how same patterns found on 5 and 10 min chart. of course this depends on the Zigzag Period
in this video, the idea and the indicator options is explained:
I can say that this is very complex script and it takes very long time to develop. I used my all programming ability and Pine ability to develop it. I hope you like it and make a lot of profit.
DISCLAIMER: No sharing, copying, reselling, modifying, or any other forms of use are authorized for the documents, script / strategy, and the information published with them. This informational planning script / strategy is strictly for individual use and educational purposes only. This is not financial or investment advice. Investments are always made at your own risk and are based on your personal judgement. I am not responsible for any losses you may incur. Please invest wisely.
Enjoy!
Lonesometheblue
Currency PairsHello All,
This script shows comparisons between major currencies for the specified time frame. it checks the change since the last bar and set the background and text color.
You can change time frame and background & text colors. you can also change the location of the table as you wish.
in the following example, the script was added to the chart two times, "4 hours" and "Day" time frames used. also changed the colors.
Enjoy!
Cup FinderHello All,
This script finds the Cups and you can use it while analysing the symbols. it creates circle and channel for the potential Cups and checks the number of bars included by the channel, if included bars is equal or greater than the value you set then it shows the cup.
The Options:
"Number for Bars to search" : Maximum length of a Cup
"Channel Width of the Cup" : Tate by the channel width of highest/lowest levels in last 300 bars, by default it's 5%
"Check for Breakout" : if there is Cup then it checks Close or High/Low is used a source for breaokuts, usuful while cheking historical bars
"Contained Bar Rate %" : after channel is created the script checks number of bars included by the channel of the Cup, you can set rate of included bars by this option
"S how Channels of Cups ": if you enable this option then you can see the channels around the Cups and set it as you wish
and there are some other options for labeling/removing old Cups and for coloring
Here you can see how channel looks like:
Cup with different colors:
P.S. This is an experimental work and sorry for no explanation in the script.
in the future if I have time I will try to write a script for Cup&Handle
This script is also an example to calculate and draw circles :)
Enjoy!
Breakout FinderHelo All,
I got many requests for a Breakout script and here it's. This script searches the breakouts/breakdowns and draw square if there is one.
The options:
"Period" is used to find Pivot Points
"Max Breakout Length" is the maximum length to search breakouts
"Threshold Rate %" is channel width of the breakout area. calculated using highest/lowest of last 300 bars.
"Minimum Number of Tests" is the minimum number of tests that the Price tried to break the S/R level
and some options for coloring and linestyle
Lets see some examples:
in this example "Minimum Number of Tests" is 2 so the Price must have tested to break resistance area 2 times and then it breaks it as seen in the screenshot:
in following example Threshold rate is %10, so the channel width is very big:
as you can see in followinf screenshot you can choose different colors and line styles:
Alerts added ;)
Enjoy!
Indicator PanelHello All,
This script shows Indicator panel in a Table. Table.new() is a new feature and released today! Thanks a lot to Pine Team to add this new great feature! This new feature is a game changer!
The script shows indicator values for each symbol and changes background color of each cell by using current and last values of the indicators for each symbol. if current value is greater than last value then backgroung color is green, if lower than last value then red, if they are equals then gray.
You can choose the indicators to display. Number of columns in the table is dynamic and is changed by number of the indicators.
You can choose 5 different Symbols, 6 Indicators and 2 Simple or Exponential Moving averages, you can set type of moving averages and the lengths. You can also set the lengths for each Indicators.
Indicators:
- RSI
- MACD ( MACD and Signal and Histogram )
- DMI ( +DI and -DI + and ADX )
- CCI
- MFI
- Momentum
- MA with Length 50 (length can be set)
- MA with Length 200 (length can be set)
In this example RSI, MACD and MA 200 were chosen, you can see how table size changes dynamically:
Enjoy!
LTB Zigzag CirclesHello All,
Today I am here with a new idea and script, " LTB Zigzag Circles ". The idea is to create Circles using last 2 zigzag waves and to catch the breakouts earlier than horizontal lines. if a circle is broken then the script shows entry for Long/Short positions. and if broken circle reappears again then the position is closed. You can change Zigzag period as you wish and see the different results.
Here you can see how the script calculates and draws the Circles:
Below you can see how the script draws part of the circle on each bar:
Optionally the script can show levels:
P.S. I haven't tested it as a strategy, Result and Performance may change by Zigzag period, you need to find best Zigzag period according to your strategy. By the way, my Zigzag Circles idea can be improved, if you have any recommendation let me know please ;)
Enjoy!
Tick Data DetailedHello All,
After Tick Chart and Tick Chart RSI scripts, this is Tick Data Detailed script. Like other tick scrips this one only works on real-time bars too. it creates two tables: the table at the right shows the detailed data for Current Bar and the table at the left shows the detailed data for all calculated bars (cumulative). the script checks the volume on each tick and add the tick and volume to the specified level (you can set/change levels)
The volume is multiplied by close price to calculate real volume .There are 7 levels/zones and the default levels are:
0 - 10.000
10.000 - 20.000
20.000 - 50.000
50.000 - 100.000
100.000 - 200.000
200.000 - 400.000
> 400.000
With this info, you will get number of ticks and total volumes on each levels. The idea to separate this levels is in order to know which type of traders trade at that moment. for example volume of whale moves are probably greater than 400.000 or at least 100.000. Or volume of small traders is less than 10.000 or between 20.000-50.000.
You will get info if there is anomaly on each candle as well. what is anomaly definition? Current candle is green but Sell volume is greater than Buy volume or current candle is red but Buy volume is greater than Sell volume . it is shown as (!). you should think/search why/how this anomaly occurs. You can see screenshot about it below.
also "TOTAL" text color changes automatically. if Buy volume is greater than Sell volume then its color becomes Green, if Sell volume is greater than Buy volume then its color becomes Red (or any color you set)
Optionally you can change background and text colors as shown in the example below.
Explanation:
How anomaly is shown:
You can enable coloring background and set the colors as you wish:
And Thanks to @Duyck for letting me use the special characters from his great script.
Enjoy!
Support Resistance ChannelsHello All,
For Long time I was planning to make Support/Resistance Channels script, finally I had time and here it is.
How this script works?
- it finds and keeps Pivot Points
- when it found a new Pivot Point it clears older S/R channels then;
- for each pivot point it searches all pivot points in its own channel with dynamic width
- while creating the S/R channel it calculates its strength
- then sorts all S/R channels by strength
- it shows the strongest S/R channels, before doing this it checks old location in the list and adjust them for better visibility
- if any S/R channel was broken on last move then it gives alert and put shape below/above the candle
- The colors of the S/R channels are adjusted automatically
You can set/change following settings:
- Pivot Period
- Source : High/Low or Close/Open can be used
- Maximum Channel Width %: this is the maximum channel width rate, this is calculated using Highest/Lowest levels in last 300 bars
- Number of S/R to show : this is the number of Strongest S/R to show
- Loopback Period: While calculating S/R levels it checks Pivot Points in LoopBack Period
- Show S/R on last # Bars: To see S/R levels only on last N bars
- Start Date: the script starts calculating Pivot Point from this date, the reason I put this option is for visuality. Explained below
- You can set colors/transparency
- and You can enable/disable shapes for broken S/R levels
Examples:
You can change colors as you wish:
here " Show S/R on last # Bars " set 100:
Sometimes visuality may corrupt because of old S/R levels, to solve it you need to set "Start Date" in the options to start the script in visual part (last 292 bars)
here in first screenshot it doesn't look good (shrink), then on second screenshot I set the "Start Date" it looks better, if you change time frame don't forget to set it again :)
Enjoy!
Tick Chart RSIHello All,
This is Tick Chart RSI script and it calculates & shows RSI for Tick Chart. What is Tick chart? Tick Chart is created using ticks and each candlestick in Tick Chart shows the price variation of X consecutive ticks (X : Number of Ticks Per Candle). For example if you set "Number of Ticks Per Candle" = 100 then each candlestick is created using 100 ticks. so, Tick Charts are NOT time-based charts (like Renko or Point & Figure Charts). Tick is the price change in minimum time interval defined in the platform. There are several advantages of Tick Charts. You can find many articles about Tick Charts on the net.
Tick Chart and Tick Chart RSI only work on realtime bars.
You can set " Number of Ticks Per Candle " and the colors. You can also set any of the candles OHLC values as source for RSI.
While using Tick Chart RSI I recommend you to add Tick Chart as well.
P.S. Tick Chart RSI script can be developed using different methods. in this script, all RSI values are calculated on each tick because RSI is calculated for only real-time bars, and also calculated for limited number of bars
Tick Chart and Tick Chart RSI:
Tick Chart RSI:
Enjoy!
Tick ChartHello All,
Tick Chart is created using ticks and each candlestick in Tick Chart shows the price variation of X consecutive ticks ( X : Number of Ticks Per Candle ). for example if you set Number of Ticks Per Candle = 100 then each candlestick is created using 100 ticks. so, Tick Charts are NOT time-based charts (like Renko or Point & Figure Charts). Tick is the price change in minimum time interval defined in the platform. There are several advantages of Tick Charts. You can find many articles about Tick Charts on the net.
Tick Chart only works on realtime bars.
You can set " Number of Ticks Per Candle " and " Number of Candles" using options. You can change color of body, wicks abd volume bars as well.
The script shows current, minimum, maximum and average volumes. it also shows OHLC values on the last candle.
Tick Chart using different number of ticks
Volume info:
Enjoy!
Volume Info from Lower Time FramesHello Traders,
We are now able to get info from lower time frames, Many Thanks to Pine Team .This script gets volume info from lower time frames and give alert if there is extreme volumes on last X lower time frame candles (if last X volumes are higher than volume moving average). so that if you set alerts on different securities then you will be able get alert if there is extreme volume moves and you can check the chart immediately.
The options:
Timeframe in Seconds : you can set lower time frames in seconds. by default it's 5 seconds. if you set it 60 then it will show 1min volumes, if you set it 1 then it will show 1 seconds volumes
MA Length : The script draws simple moving average using this length info. by default it's 20.
Number of Bars to Check for Alert : by default it's 5. meaning that if last 5 candles is greater than moving average and if you set alert then you get the alert "Extreme Volume"
Other options are for colors and line width.
As you can see in following example, chart time frame is 1 hour and the script shows volume info of 5 seconds candles:
Enjoy!
Monte Carlo Simulation - Random WalkHello All,
Monte Carlo Simulation is a model used to predict the probability of different outcomes when the intervention of random variables is present. it is used by professionals in such widely disparate fields as finance, project management etc. You can find many articles about Monte Carlo Simulation on the net.
In this script I tried to make Monte Carlo Simulation and "Random Walk". it calculates results over and over, each time using a different set of random values that is created using historical data (500 times by default) and show min-max and some random paths. number of "random walks" is calculated by using number of bars to predict, so if you change "Number of Bars to Predict" then number of random walks may change. Total number of the lines must be less than 500.
"Number of Simulations " is 500 by default, more simulation better results. but if you increase it a lot then you may get "loop takes too long error"
"Number of Bars to Predict" can be between 10-100
"Number of Bars to use as Data Source" is the number of historical bars to use in simulations
Thanks to Ricardo Santos (@RicardoSantos) for letting me use his Random Number Generator Function.
P.S. I am not mathematician and I tried to make it as far as I understood the method. so if you see any issue let me know please.
Some examples:
Number of Bars to Predict = 100:
Number of Bars to Predict = 10:
if you enable "Keep Past Min-Max Levels" option then min-max levels will stay on the chart
Enjoy!
Tic Tac Toe (For Fun)Hello All,
I think all of you know the game "Tic Tac Toe" :) This time I tried to make this game, and also I tried to share an example to develop a game script in Pine. Just for fun ;)
Tic Tac Toe Game Rules:
1. The game is played on a grid that's 3 squares by 3 squares.
2. You are "O", the computer is X. Players take turns putting their marks in empty squares.
3. if a player makes 3 of her marks in a row (up, down, across, or diagonally) the he is the winner.
4. When all 9 squares are full, the game is over (draw)
So, how to play the game?
- The player/you can play "O", meaning your mark is "O", so Xs for the script. please note that: The script plays with ONLY X
- There is naming for all squears, A1, A2, A3, B1, B2, B3, C1, C2, C3. you will see all these squares in the options.
- also You can set who will play first => "Human" or "Computer"
if it's your turn to move then you will see "You Move" text, as seen in the following screenshot. for example you want to put "O" to "A1" then using options set A1 as O
How the script play?
it uses MinMax algorithm with constant depth = 4. And yes we don't have option to make recursive functions in Pine at the moment so I made four functions for each depth. this idea can be used in your scripts if you need such an algorithm. if you have no idea about MinMax algorithm you can find a lot of articles on the net :)
The script plays its move automatically if its turn to play. you will just need to set the option that computer played (A1, C3, etc)
if it's computer turn to play then it calculates and show the move it wants to play like "My Move : B3 <= X" then using options you need to set B3 as X
Also it checks if the board is valid or not:
I have tested it but if you see any bug let me know please
Enjoy!
Multi Time Frame Candles with Volume Info / 3DHello Traders,
This is my second Multi Time Frame Candles script but with this new one, you will have some new features such volume info, remaining time to close of higher time frame candle and also developed using new features of Pine such array of lines. also I tried to make it 3D for better visualization ;) also it shows new highs/lows / breakouts.
I tried to make many things optional, so you can change almost everything using options.
What you can change using options:
- Higher time frame
- Number of Candles
- Candle Colors Up/Down
- Wick Color
- Volume colors Up/Down
- Text color of Remaining Time
- Shadow Color
- Background color
- Start bar of the candles (so you can see many higher times frame candles in same window)
- 3D effect, by default it's enables but you can disable 3D view
Lets see some examples:
Remaining time:
Breakouts:
You can combine different higher time frames:
if you don't want 3D view then combining different higher time frames:
You can change background color:
Enjoy!
Volume-Supported Linear Regression TrendHello Traders,
Linear Regression gives us some abilities to calculate the trend and if we combine it with volume then we may get very good results. Because if there is no volume support at up/downtrends then the trend may have a reversal soon. we also need to check the trend in different periods. With all this info, I developed Volume-Supported Linear Regression Trend script. The script checks linear regression of price and volume and then calculates trend direction and strength.
You have option to set Source, Short-Term Period and Long-Term Period. you can set them as you wish.
By default:
Close is used as "Source"
Short-Term Period is 20
Long-Term Period is 50
in following screenshot I tried to explain short term trend (for uptrend). Volume supports the trend? any volume pressure on trend? possible reversal? same idea while there is downtrend.
in following screenshot I tried to explain long term trend:
You can also check Positive/Negative Divergences to figure out possible reversals (to automate it, you can use Divergence for Many Indicators v4 , it has ability to check divergences on external indicators)
Enjoy!
ZigZag Multi Time Frame with Fibonacci RetracementHello Traders,
This is ZigZag Multi Time Frame with Fibonacci Retracement script. It calculates the ZigZag using Higher Time Frame, draw Fibonacci Retracement lines and put labels accordingly. I already published Zigzag with Fibonacci Levels script but this one is Multi Time Frame and I didn't want to change/update it.
You can set ZigZag Period and Resolution as you wish. Zigzag is calculated using higher time frames (ex: 1day) so you better choose small numbers as Zigzag Period, such 2, 3 etc. you should choose higher time frame wisely, meaning that you should not set 1Day while chart resolution is 1min ;)
It draws Fibonacci levels between 0%-100% and If the price goes higher/lower than 100% level than the script draws Fibonacci Levels accordingly. This means it draws Fibonacci levels until this levels get higher/lower than the price.
"Show Zig Zag" is not enabled by default, you can enable it if you want to see ZigZag as well.
You have options to set Text Color, Line Color, Zigzag Up Color and Zigzag Down Color.
You can set the location of the Fibonnaci Levels -> Left or Right
You also have option to enable/disable following Fibonnaci Levels:
---> 0.236
---> 0.382
---> 0.500
---> 0.618
---> 0.786
I added "Colorful Fibonacci Levels" for fun. if you enable it then Fibonacci line colors will be different randomly on each move, see it for yourself :)
Some Screenshots:
if you enable "Show Zigzag Option":
how the script adjust levels automatically:
if you set Label Location as "Right":
if you enable "Colorful Fibonacci Levels" then Line colors will be changed on each move randomly ;)
Enjoy!
Point and Figure Chart - LiveHello Traders,
This is "Point and Figure Chart (PnF)" script that run in separated window in real time. The separated PnF chart window is timeless, so no relation with the time on the chart. PnF chart consist of "X" and "O" columns. While "X" columns represents rising prices, "O" column represents a falling price. If you have no idea about what PnF charting is then you should search for "Point and Figure Charting" on the net and get some info before using this script.
Now lets talk about details. PnF Chart requires at least two variables to be set => Box size and Reversal. Box size represents the size of each X/O in PnF chart and the reversal is used to calculate new X/O or reversal. for example if currrent column is X column then for new "X", "box size * 1" move is needed and for new "O" column or reversal, "box size * revelsal" move is needed. in the script I use lines as X/O columns.
In the options you can set "Box Size Assingment Method". you have 3 options Traditional, ATR, Percentage . what are they?
Traditional: user-defined box size, means you can set the box size as you wish, using the option . if you use this option then you should set it accordingly.
ATR : that's dynamic box size scaling and on each columns it's calculated once, you can set length for ATR
Percentage: that's also dynamic box size scaling according to closing price when new column appeared. if you use this option then you should set it accordingly.
Reversal: The reversal is typically 3 but you can change it as you wish
"Change Bar Color by PnF Trend": if you enable this option then bar color changes by PnF columns, by default it's not enabled
"Change Column Color When Breakout Occurs": PnF color changes if Double Top/Bottom breakout accours. enabled by default and you can set the colors as you wish using the options
"Change Bar Color When Breakout Occurs": bar colors changed if Double Top/Bottom breakout accours. enabled by default and you can set the colors as you wish using the options
the script checks only Double Top/Bottom breakouts at the moment. there are many other breakouts such Triple/Quadruple, Ascending/Descending Triple Top/Bottom breakouts, Catapult etc.
Also the script shows new X/O level and reversal Levels in PnF window. An example:
If you enable "Change Bar Color by PnF Trend" option:
An example if you disable the option "Change Column Color When Breakout Occurs
You may want to see my another/older "Point and Point Chart" script as well. you can find it in my profile/published scripts and in the Public Library. I use same PnF calculation algorithm in both scripts.
Enjoy!
Divergence for Many Indicators v4Hello Traders,
Here is my new year gift for the community, Digergence for Many Indicators v4 . I tried to make it modular and readable as much as I can. Thanks to Pine Team for improving Pine Platform all the time!
How it works?
- On each candle it checks divergences between current and any of last 16 Pivot Points for the indicators.
- it search divergence on choisen indicators => RSI , MACD , MACD Histogram, Stochastic , CCI , Momentum, OBV, VWMACD, CMF and any External Indicator !
- it checks following divergences for 16 pivot points that is in last 100 bars for each Indicator.
--> Regular Positive Digergences
--> Regular Negative Digergences
--> Hidden Positive Digergences
--> Hidden Negative Digergences
- for positive divergences first it checks if closing price is higher than last closing price and indicator value is higher than perious value, then start searching divergence
- for negative divergences first it checks if closing price is lower than last closing price and indicator value is lower than perious value, then start searching divergence
Some Options:
Pivot Period: you set Pivot Period as you wish. you can see Pivot Points using "Show Pivot Points" option
Source for Pivot Points: you can use Close or High/Low as source
Divergence Type: you can choose Divergence type to be shown => "Regular", "Hidden", "Regular/Hidden"
Show Indicator Names: you have different options to show indicator names => "Full", "First Letter", "Don't Show"
Show Divergence Number: option to see number of indicators which has Divergence
Show Only Last Divergence : if you enable this option then it shows only last Positive and Negative Divergences
you can include any External Indicator to see if there is divergence
- enable "Check External Indicator"
- and then choose External indicator name in the list, "External Indicator"
- External indicator name is shown as Extrn
- related external indicator must be added before enabling this option
Coloring, line width and line style options for different type of divergences.
Following Alerts added:
- Positive Regular Divergence Detected
- Negative Regular Divergence Detected
- Positive Hidden Divergence Detected
- Negative Hidden Divergence Detected
Now lets see some examples:
Hidden Divergences:
Regular and Hidden Divergences together:
Showing first letters of indicators:
You can see only the number of indicators which has divergence:
You can see only divergence lines without indicators names and numbers:
option to used different label/line/text colors:
You have option to see only last divergences:
You can change Pivot Period, in following example Pivot Period = 15:
You can use Close or High/Low as Source for Divergence
You can include external indicators and get divergences on it:
Wish you all a happy new year!
Enjoy!
Linear Regression ChannelHello Traders,
There are several nice Linear Regression Channel scripts in the Public Library. and I tried to make one with some extra features too. This one can check if the Price breaks the channel and it shows where is was broken. Also it checks the momentum of the channel and shows it's increasing/decreasing/equal in a label, shape of the label also changes. The line colors change according to direction.
using the options, you can;
- Set the Source (Close, HL2 etc)
- Set the Channel length
- Set Deviation
- Change Up/Down Line colors
- Show/hide broken channels
- Change line width
meaning of arrows:
⇑ : Uptrend and moment incresing
⇗ : Uptrend and moment decreasing
⇓ : Downtrend and moment incresing
⇘ : Downtrend and moment decreasing
⇒ : No trend
An example for how color of lines, arrow direction and shape of label change.
Enjoy!
ZigZag with Fibonacci LevelsHello Traders,
This is " ZigZag with Fibonacci Levels " script. It finds the ZigZag, draw Fibonacci lines and put labels accordingly. I get many requests for this script, so here it is.
You can set ZigZag period as you wish. Bigger numbers (such 20, 30) may give better perspective and result.
It draws Fibonacci levels between 0%-100% and If the price goes higher/lower than 100% level than the script draws Fibonacci Levels accordingly. This means it draws Fibonacci levels until this levels get higher/lower than the price.
As an example:
if you don't want to see ZigZag Lines then you have option to disable it and see only Fibonacci levels:
You have coloring options for Zigzag, Fibonacci lines and texts:
Enjoy!
Machine Learning / Longs [Experimental]Hello Traders/Programmers,
For long time I thought that if it's possible to make a script that has own memory and criterias in Pine. it would learn and find patterns as images according to given criterias. after we have arrays of strings, lines, labels I tried and made this experimental script. The script works only for Long positions.
Now lets look at how it works:
On each candle it creates an image of last 8 candles. before the image is created it finds highest/lowest levels of 8 candles, and creates a string with the lengths 64 (8 * 8). and for each square, it checks if it contains wick, green or red body, green or red body with wicks. see the following picture:
Each square gets the value:
0: nothing in it
1: only wick in it
2: only red body in it
3. only green body in it
4: red body and wick in it
5: green body and wick in it
And then it checks if price went up equal or higher than user-defined profit. if yes then it adds the image to the memory/array. and I call this part as Learning Part.
what I mean by image is:
if there is 1 or more element in the memory, it creates image for current 8 candles and checks the memory if there is a similar images. If the image has similarity higher than user-defined similarty level then if show the label "Matched" and similarity rate and the image in the memory. if it find any with the similarity rate is equal/greater than user-defined level then it stop searching more.
As an example matched image:
and then price increased and you got the profit :)
Options:
Period: if there is possible profit higher than user-defined minimum profit in that period, it checks the images from 2. to X. bars.
Min Profit: you need to set the minimum expected profit accordingly. for example in 1m chart don't enter %10 as min profit :)
Similarity Rate: as told above, you can set minimum similarity rate, higher similarity rate means better results but if you set higher rates, number of images will decrease. set it wisely :)
Max Memory Size: you can set number of images (that gives the profit equal/higher than you set) to be saved that in memory
Change Bar Color: optionally it can change bar colors if current image is found in the memory
Current version of the script doesn't check if the price reach the minimum profit target, so no statistics.
This is completely experimental work and I made it for fun. No one or no script can predict the future. and you should not try to predict the future.
P.S. it starts searching on last bar, it doesn't check historical bars. if you want you should check it in replay mode :)
if you get calculation time out error then hide/unhide the script. ;)
Enjoy!
RSI Multi Time FrameHello Traders,
Recently we got new features in Pine such Arrays of Lines, Labels and Strings. Thanks to the Pine Team! ( here )
So I decided to make new style of Multi Time Frame indicator and I used Array of Lines in this script. here it is, RSI Multi Time Frame script. it shows RSI for current time frame as it is and also it gets RSI for the Higher Time Frame and converts it and shows it as in time frame. as you can see, RSI for HTF moves to the right on each candle until higher time frame was completed.
You have color and line width options for both RSI, also if you want you can limit the number of bars to show higher time frame RSI by the option " Number of Bars for RSI HTF ", following example show RSI HTF for 100 bars.
Most of you know that old style Multi Time Frames indicators was like:
Hope you like this new Multi time frame style ;)
Enjoy!