Multi TF Trend Indicator
...Mark Douglas in his book Trading in the Zone wrote
The longer the time frame, the more significant the trend, so a trending market on a daily bar chart is more significant than a trending market on a 30-minute bar chart. Therefore, the trend on the daily bar chart would take precedence over the trend on the 30-minute bar chart and would be considered the major trend. To determine the direction of the major trend, look at what is happening on a daily bar chart. If the trend is up on the daily, you are only going to look for a sell-off or retracement down to what your edge defines as support on the 30-minute chart. That's where you will become a buyer. On the other hand, if the trend is down on the daily, you are only going to look for a rally up to what your edge defines as a resistance level to be a seller on the 30-minute chart. Your objective is to determine, in a downtrending market, how far it can rally on an intraday basis and still not violate the symmetry of the longer trend. In an up-trending market, your objective is to determine how far it can sell off on an intraday basis without violating the symmetry of the longer trend. There's usually very little risk associated with these intraday support and resistance points, because you don't have to let the market go very far beyond them to tell you the trade isn't working.
The purpose of this indicator to show both the major and minor trend on the same chart with no need to switch between timeframes
Script includes
timeframe to determine the major trend
price curve, close price is default, but you can pick MA you want
type of coloring, either curve color or the background color
Implementation details
major trend is determined by the slope of the price curve
Further improvements
a variation of techniques for determining the major trend (crossing MA, pivot points etc.)
major trend change alerts
Thanks @loxx for pullData helper function
Cerca negli script per "30年国债收益率"
TARVIS Labs - Bitcoin Macro Bottom/Top SignalsSCRIPT DESCRIPTION
This is a script specifically written to help provide indicators from a macro view. This script is best run on the 1 day interval on Bitstamp's $BTCUSD chart. It helps indicate when to accumulate bitcoin, and when its in a bull run when there are local tops, strong top warnings, and a signal to exit a bull run. This is described further below.
If you don't have interest in trading on the way to the top I suggest turning off the following indicators in the settings of the indicator:
- Opportunity To Buy Back In Indicator
- Local Top Near Bull Run Top Indicator
ACCUMULATION ZONE INDICATOR - LIGHT GREEN
Description
When we look at the history of Bitcoin every bottom has crossed below the 100 week EMA. Once it does its accompanied by hash ribbon cross with miner capitulation. After that is the prime time to accumulate as theres a clearer signal the bottom is in. Specifically, a signal to look for is the 14 day MACD/signal cross and the 14 day MACD continuing to stay above the signal until the price returns above the 100 week EMA. This is prime accumulation territory.
Strategy for Usage
A good strategy to use when accumulating the bottom is dollar-cost averaging over a 30 day period. The accumulation zone can last longer than 30 days but 30 days is a good range of time to DCA.
STRONG BUY IN ACCUMULATION ZONE INDICATOR - DARK GREEN
Description
We can add to the bottoming signal by looking for post-downtrend reversals inside the bottoming signal. We do this by using a 9/19 daily cross.
Strategy for Usage
These post-downtrend reversals can potentially provide better targeted days for accumulation than the broader bottoming signal and can be used to add more on that day than on an average day for the dollar cost average strategy. Say for example, use 1/3 of funds on these days rather than 1/30th.
OPPORTUNITY TO BUY BACK IN INDICATOR - BLUE
Description
When the 1d 18 EMA > 1d 63 EMA and the 12/52 1d crosses. These together provide good buy opportunities to buy bitcoin.
Strategy for Usage
If you happen to find yourself out of the market from your own TA or a trade, this signal can provide a buy opportunity to reenter the market if you're out of it.
BULL RUN LOCAL TOP INDICATOR - ORANGE
Description
We will similarly use the 100 week EMA to determine trend reversal into a bull run. When we see the 100 week EMA uptrending, we can begin to look for local tops using the 9/19 daily MACD/signal bearish cross along with the 12 EMA having a negative slope, which could be the beginning signal for a local top.
Strategy for Usage
This is a rather light indicator, but can be used in tandem with your own technical analysis to determine if you want to reenter after you exit from its signal.
LOCAL TOP NEAR BULL RUN TOP INDICATOR - RED
Description
When the 100 week EMA is in an uptrend we can look for significant loss of momentum in order to determine if a local top is in near a bull run top. Similar to the Bull Run Local Top Indicator, this strategy uses a MACD/signal cross but instead uses the 30/65 day EMAs.
Strategy for Usage
Ideally the right strategy to use here is to exit the market when this indicator starts. When the indicator ends if the "End of Bull Run Indicator" is not showing on the chart you can buy back into the market.
TOP IS LIKELY IN INDICATOR
Description
When the 100 week EMA is in a very strong uptrend and the 9/19 weekly MACD/signal bearish cross occurs, and the 63 EMA begins to downtrend.
Strategy for Usage
This signal typically accompanies the "Local Top Near Bull Run Top Indicator" therefore if you're following the strategy you would likely already be out of the market, but if you're not and this signal fires its a strong signal the top is in and we're likely going to start seeing a strong retrace. This is typically right before we see the "End of Bull Run Indicator". There is only one occurrence where it wasn't followed by a large drop & the "End of Bull Run Indicator" and that was in the 2017 bull run where there were many strong retracements post local top. The likelihood we see that again is low, but if it were to happen you can buy back into the market when the "Top is Likely In Indicator" and the "Local Top Near Bull Run Top Indicator" are not firing.
TOP IS LIKELY IN INDICATOR
Description
When the 100 week EMA is in a strong uptrend and the 9/19 weekly MACD/signal bearish cross occurs, and the 63 EMA begins to downtrend.
Strategy for Usage
This signal typically accompanies the "Local Top Near Bull Run Top Indicator" therefore if you're following the strategy you would likely already be out of the market, but if you're not and this signal fires its a strong signal the top is in and we're likely going to start seeing a strong retrace. This is typically right before we see the "End of Bull Run Indicator". There is only one occurrence where it wasn't followed by a large drop & the "End of Bull Run Indicator" and that was in the 2017 bull run where there were many strong retracements post local top. The likelihood we see that again is low, but if it were to happen you can buy back into the market when the "Top is Likely In Indicator" and the "Local Top Near Bull Run Top Indicator" are not firing.
END OF BULL RUN INDICATOR
Description
When the 100 week EMA is in an uptrend and the 1d 18 EMA crosses the 1d 63 EMA.
Strategy for Usage
When the 100 week EMA is a strong uptrend and the 18/63 cross occurs the top is very likely in. It has occurred in every bull run top leading to the bear market.
Time█ OVERVIEW
This library is a Pine Script™ programmer’s tool containing a variety of time related functions to calculate or measure time, or format time into string variables.
█ CONCEPTS
`formattedTime()`, `formattedDate()` and `formattedDay()`
Pine Script™, like many other programming languages, uses timestamps in UNIX format, expressed as the number of milliseconds elapsed since 00:00:00 UTC, 1 January 1970. These three functions convert a UNIX timestamp to a formatted string for human consumption.
These are examples of ways you can call the functions, and the ensuing results:
CODE RESULT
formattedTime(timenow) >>> "00:40:35"
formattedTime(timenow, "short") >>> "12:40 AM"
formattedTime(timenow, "full") >>> "12:40:35 AM UTC"
formattedTime(1000 * 60 * 60 * 3.5, "HH:mm") >>> "03:30"
formattedDate(timenow, "short") >>> "4/30/22"
formattedDate(timenow, "medium") >>> "Apr 30, 2022"
formattedDate(timenow, "full") >>> "Saturday, April 30, 2022"
formattedDay(timenow, "E") >>> "Sat"
formattedDay(timenow, "dd.MM.yy") >>> "30.04.22"
formattedDay(timenow, "yyyy.MM.dd G 'at' hh:mm:ss z") >>> "2022.04.30 AD at 12:40:35 UTC"
These functions use str.format() and some of the special formatting codes it allows for. Pine Script™ documentation does not yet contain complete specifications on these codes, but in the meantime you can find some information in the The Java™ Tutorials and in Java documentation of its MessageFormat class . Note that str.format() implements only a subset of the MessageFormat features in Java.
`secondsSince()`
The introduction of varip variables in Pine Script™ has made it possible to track the time for which a condition is true when a script is executing on a realtime bar. One obvious use case that comes to mind is to enable trades to exit only when the exit condition has been true for a period of time, whether that period is shorter that the chart's timeframe, or spans across multiple realtime bars.
For more information on this function and varip please see our Using `varip` variables publication.
`timeFrom( )`
When plotting lines , boxes , and labels one often needs to calculate an offset for past or future end points relative to the time a condition or point occurs in history. Using xloc.bar_index is often the easiest solution, but some situations require the use of xloc.bar_time . We introduce `timeFrom()` to assist in calculating time-based offsets. The function calculates a timestamp using a negative (into the past) or positive (into the future) offset from the current bar's starting or closing time, or from the current time of day. The offset can be expressed in units of chart timeframe, or in seconds, minutes, hours, days, months or years. This function was ported from our Time Offset Calculation Framework .
`formattedNoOfPeriods()` and `secondsToTfString()`
Our final two offerings aim to confront two remaining issues:
How much time is represented in a given timestamp?
How can I produce a "simple string" timeframe usable with request.security() from a timeframe expressed in seconds?
`formattedNoOfPeriods()` converts a time value in ms to a quantity of time units. This is useful for calculating a difference in time between 2 points and converting to a desired number of units of time. If no unit is supplied, the function automatically chooses a unit based on a predetermined time step.
`secondsToTfString()` converts an input time in seconds to a target timeframe string in timeframe.period string format. This is useful for implementing stepped timeframes relative to the chart time, or calculating multiples of a given chart timeframe. Results from this function are in simple form, which means they are useable as `timeframe` arguments in functions like request.security() .
█ NOTES
Although the example code is commented in detail, the size of the library justifies some further explanation as many concepts are demonstrated. Key points are as follows:
• Pivot points are used to draw lines from. `timeFrom( )` calculates the length of the lines in the specified unit of time.
By default the script uses 20 units of the charts timeframe. Example: a 1hr chart has arrows 20 hours in length.
• At the point of the arrows `formattedNoOfPeriods()` calculates the line length in the specified unit of time from the input menu.
If “Use Input Time” is disabled, a unit of time is automatically assigned.
• At each pivot point a label with a formatted date or time is placed with one of the three formatting helper functions to display the time or date the pivot occurred.
• A label on the last bar showcases `secondsSince()` . The label goes through three stages of detection for a timed alert.
If the difference between the high and the open in ticks exceeds the input value, a timer starts and will turn the label red once the input time is exceeded to simulate a time-delayed alert.
• In the bottom right of the screen `secondsToTfString()` posts the chart timeframe in a table. This can be multiplied from the input menu.
Look first. Then leap.
█ FUNCTIONS
formattedTime(timeInMs, format)
Converts a UNIX timestamp (in milliseconds) to a formatted time string.
Parameters:
timeInMs : (series float) Timestamp to be formatted.
format : (series string) Format for the time. Optional. The default value is "HH:mm:ss".
Returns: (string) A string containing the formatted time.
formattedDate(timeInMs, format)
Converts a UNIX timestamp (in milliseconds) to a formatted date string.
Parameters:
timeInMs : (series float) Timestamp to be formatted.
format : (series string) Format for the date. Optional. The default value is "yyyy-MM-dd".
Returns: (string) A string containing the formatted date.
formattedDay(timeInMs, format)
Converts a UNIX timestamp (in milliseconds) to the name of the day of the week.
Parameters:
timeInMs : (series float) Timestamp to be formatted.
format : (series string) Format for the day of the week. Optional. The default value is "EEEE" (complete day name).
Returns: (string) A string containing the day of the week.
secondsSince(cond, resetCond)
The duration in milliseconds that a condition has been true.
Parameters:
cond : (series bool) Condition to time.
resetCond : (series bool) When `true`, the duration resets.
Returns: The duration in seconds for which `cond` is continuously true.
timeFrom(from, qty, units)
Calculates a +/- time offset in variable units from the current bar's time or from the current time.
Parameters:
from : (series string) Starting time from where the offset is calculated: "bar" to start from the bar's starting time, "close" to start from the bar's closing time, "now" to start from the current time.
qty : (series int) The +/- qty of units of offset required. A "series float" can be used but it will be cast to a "series int".
units : (series string) String containing one of the seven allowed time units: "chart" (chart's timeframe), "seconds", "minutes", "hours", "days", "months", "years".
Returns: (int) The resultant time offset `from` the `qty` of time in the specified `units`.
formattedNoOfPeriods(ms, unit)
Converts a time value in ms to a quantity of time units.
Parameters:
ms : (series int) Value of time to be formatted.
unit : (series string) The target unit of time measurement. Options are "seconds", "minutes", "hours", "days", "weeks", "months". If not used one will be automatically assigned.
Returns: (string) A formatted string from the number of `ms` in the specified `unit` of time measurement
secondsToTfString(tfInSeconds, mult)
Convert an input time in seconds to target string TF in `timeframe.period` string format.
Parameters:
tfInSeconds : (simple int) a timeframe in seconds to convert to a string.
mult : (simple float) Multiple of `tfInSeconds` to be calculated. Optional. 1 (no multiplier) is default.
Returns: (string) The `tfInSeconds` in `timeframe.period` format usable with `request.security()`.
Realtime FootprintThe purpose of this script is to gain a better understanding of the order flow by the footprint. To that end, i have added unusual features in addition to the standard features.
I use "Real Time 5D Profile by LucF" main engine to create basic footprint(profile type) and added some popular features and my favorites.
This script can only be used in realtime, because tradingview doesn't provide historical Bid/Ask date.
Bid/Ask date used this script are up/down ticks.
This script can only be used by time based chart (1m, 5m , 60m and daily etc)
This script use many labels and these are limited max 500, so you can't display many bars.
If you want to display foot print bars longer, turn off the unused sub-display function.
Default setting is footprint is 25 labels, IB count is 1, COT high and Ratio high is 1, COT low and Ratio low is 1 and Delta Box Ratio Volume is 1 , total 29.
plus UA , IB stripes , ladder fading mark use several labels.
///////// General Setting ///////////
Resets on Volume / Range bar
: If you want to use simple time based Resets on, please set Total Volume is 0.
Your timeframe is always the first condition. So if you set Total Volume is 1000, both conditions(Volume >= 1000 and your timeframe start next bar) must be met. (that is, new footprint bar doesn't start at when total volume = exactly 1000).
Ticks per row and Maximum row of Bar
: 1 is minimum size(tick). "Maximum row of Bar" decide the number of rows used in one footprint. 1 row is created from 1 label, so you need to reduce this number to display many footprints (Max label is 500).
Volume Filter and For Calculation and Display
: "Volume Filter" decide minimum size of using volume for this script.
"For Calculation and Display" is used to convert volume to an integer.
This script only use integer to make profile look better (I contained Bid number and Ask number in one row( one label) to saving labels. This require to make no difference in width by the number of digits and this script corresponds integers from 0 to 3 digits).
ex) Symbol average volume size is from 0.0001 to 0.001. You decide only use Volume >= 0.0005 by "Volume Filter".
Next, you convert volume to integer, by setting "For Calculation and Display" is 1000 (0.0005 * 1000 = 5).
If 0.00052 → 5.2 → 5, 0.00058 → 5.8 → 6 (Decimal numbers are rounded off)
This integer is used to all calculation in this script.
//////// Main Display ///////
Footprint, Total, Row Delta, Diagonal Delta and Profile
: "Footprint" display Ask and Bid per row. "Total" display Ask + Bid per row.
"Row Delta" display Ask - Bid per row. "Diagonal Delta" display Ask(row N) - Bid(row N -1) per row.
Profile display Total Volume(Ask + Bid) per row by using Block. Profile Block coloring are decided by Row Delta value(default: positive Row Delta (Ask > Bid) is greenish colors and negative Row Delta (Ask < Bid) is reddish colors.)
Volume per Profile Block, Row Imbalance Ratio and Delta Bull/Bear/Neutral Colors
: "Volume per Profile Block" decide one block contain how many total volume.
ex) When you set 20, Total volume 70 display 3 block.
The maximum number of blocks that can be used per low is 20.
So if you set 20, Total volume 400 is 20 blocks. total volume 800 is 20 blocks too.
"Row Imbalance Ratio" decide block coloring. The row imbalance is that the difference between Ask and Bid (row delta) is large.
default is x3, x2 and x1. The larger the difference, the brighter the color.
ex) Ask 30 Bid 10 is light green. Ask 20 Bid 10 is green. Ask 11 Bid 10 is dark green.
Ask 0 Bid 1 is light red. Ask 1 Bid 2 is red. ask 30 Bid 59 is dark green.
Ask 10 Bid 10 is neutral color(gray)
profile coloring is reflected same row's other elements(Ask, Bid, Total and Delta) too.
It's because one label can only use one text color.
/////// Sub Display ///////
Delta, total and Commitment of Traders
: "Delta" is total Ask - total Bid in one footprint bar. Total is total Ask + total Bid in one footprint bar.
"Commitment of traders" is variation of "Delta". COT High is reset to 0 when current highest is touched. COT Low is opposite.
Basic concept of Delta is to compare price with Delta. Ordinary, when price move up, delta is positive. Price move down is negative delta.
This is because market orders move price and market orders are counted by Delta (although this description is not exactly correct).
But, sometimes prices do not move even though many market orders are putting pressure on price , or conversely, price move strongly without many market orders.
This is key point. Big player absorb market orders by iceberg order(Subdivide large orders and pretend to be small limit orders.
Small limit orders look weak in the order book, but they are added each time you fill, so they are more powerful than they look.), so price don't move.
On the other hand, when the price is moving easily, smart players may be aiming to attract and counterattack to a better price for them.
It's more of a sport than science, and there's always no right response. Pay attention to the relationship between price, volume and delta.
ex) If COT Low is large negative value, it means many sell market orders is coming, but iceberg order is absorbing their attack at limit order.
you should not do buy entry, only this clue. but this is one of the hints.
"Delta, Box Ratio and Total texts is contained same label and its color are "Delta" coloring. Positive Delta is Delta Bull color(green),Negative Delta is Delta Bear Color
and Delta = 0 is Neutral Color(gray). When Delta direction and price direction are opposite is Delta Divergence Color(yellow).
I didn't add the cumulative volume delta because I prefer to display the CVD line on the price chart rather than the number.
Box Ratio , Box Ratio Divisor and Heavy Box Ratio Ratio
: This is not ordinary footprint features, but I like this concept so I added.
Box Ratio by Richard W. Arms is simple but useful tool. calculation is "total volume (one bar) divided by Bar range (highest - lowest)."
When Bull and bear are fighting fiercely this number become large, and then important price move happen.
I made average BR from something like 5 SMA and if current BR exceeds average BR x (Heavy Box Ratio Ratio), BR box mark will be filled.
Box Ratio Divisor is used to good looking display(BR multiplied by Box Ratio Divisor is rounded off and displayed as an integer)
Diagonal Imbalance Count , D IB Mark and D IB Stripes
: Diagonal Imbalance is defined by "Diagonal Imbalance Ratio".
ex) You set 2. When Ask(row N) 30 Bid(row N -1)10, it's 30 > 10*2, so positive Diagonal Imbalance.
When Ask(row N) 4 Bid(row N -1)9, it's 4*2 < 9, so negative Diagonal Imbalance.
This calculation does not use equals to avoid Ask(row N) 0 Bid(row N -1)0 became Diagonal Imbalance.
Ask(row N) 0 Bid(row N -1)0, it's 0 = 0*2, not Diagonal Imbalance. Ask(row N) 10 Bid(row N -1)5, it's 10 = 5*2, not Diagonal Imbalance.
"D IB Mark" emphasize Ask or Bid number which is dominant side(Winner of Diagonal Imbalance calculation), by under line.
"Diagonal Imbalance Count" compare Ask side D IB Mark to Bid side D IB Mark in one footprint.
Coloring depend on which is more aggressive side (it has many IB Mark) and When Aggressive direction and price direction are opposite is Delta Divergence Color(yellow).
"D IB Stripes" is a function that further emphasizes with an arrow Mark, when a DIB mark is added on the same side for three consecutive row. Three consecutive arrow is added at third row.
Unfinished Auction, Ratio Bounds and Ladder fading Mark
: "Unfinished Auction" emphasize highest or lowest row which has both Ask and Bid, by Delta Divergence Color(yellow) XXXXXX mark.
Unfinished Auction sometimes has magnet effect, price may touch and breakout at UA side in the future.
This concept is famous as profit taking target than entry decision.
But, I'm interested in the case that Big player make fake breakout at UA side and trapped retail traders, and then do reversal with retail traders stop-loss hunt.
Anyway, it's not stand alone signal.
"Ratio Bounds" gauge decrease of pressure at extreme price. Ratio Bounds High is number which second highest ask is divided by highest ask.
Ratio Bounds Low is number which second lowest bid is divided by lowest bid. The larger the number, the less momentum the price has.
ex)first footprint bar has Ratio Bounds Low 2, second footprint bar has RBL 4, third footprint bar has RBL 20.
This indicates that the bear's power is gradually diminishing.
"Ladder fading mark" emphasizes the decrease of the value in 3 consecutive row at extreme price. I added two type Marks.
Ask/Bid type(triangle Mark) is Ask/Bid values are decreasing of three consecutive row at extreme price.
Row Imbalance type(Diamond Mark) are row Imbalance values are decreasing of three consecutive row at extreme price.
ex)Third lowest Bid 40, second lowest Bid 10 and lowest Bid 5 have triangle up Mark. That is bear's power is gradually diminishing.
(This Mark only check Bid value at lowest price and Ask value at highest price).
Third highest row delta + 60, second highest row delta + 5, highest delta - 20 have diamond Mark. That is Bull's power is gradually diminishing.
Sub display use Delta colors at bottom of Sub display section.
////// Candle & POC /////////
candle and POC
: Ordinary, "POC" Point of Control is row of largest total volume, but this script'POC is volume weighted average.
This is because the regular POC was visually displayed by the profile ,and I was influenced LucF's ideas.
POC coloring is decided in relation to the previous POC. When current POC is higher than previous POC, color is UP Bar Color(green).
In the opposite case, Down Bar color is used.
POC Divergence Color is used when Current POC is up but current bar close is lower than open (Down price Bar),or in the opposite case.
POC coloring has option also highlight background by Delta Divergence Color(yellow). but bg color is displayed at your time frame current price bar not current footprint bar.
The basic explanation is over.
I add some image to promote understanding basic ideas.
30min_breakEnglish:
It is an indicator that displays the high and low prices as of 30 minutes before the event,
and when you break it, you can see it with a balloon.
The high and low lines at 30 minutes before the front are shown as candidates for support lines and resistance lines.
Used in the minute chart
Japanese:
前場 30分時点の 高値・安値の線を表示し、そこをBreakしたら吹き出しでわかるようにしたインジケーターです
前場 30分時点の 高値安値の線を支持線・抵抗線の候補として図示します。
分足のチャートで利用します
30min_breakEnglish:
It is an indicator that displays the high and low prices as of 30 minutes before the event,
and when you break it, you can see it with a balloon.
The high and low lines at 30 minutes before the front are shown as candidates for support lines and resistance lines.
Used in the minute chart
Japanese:
前場 30分時点の 高値・安値の線を表示し、そこをBreakしたら吹き出しでわかるようにしたインジケーターです
前場 30分時点の 高値安値の線を支持線・抵抗線の候補として図示します。
分足のチャートで利用します
Timeframe Time of Day Buying and Selling StrategyThis strategy allows you to back test longing or shorting or do nothing during time increments of 30 minutes. The price trends in one direction every 30 minutes and this strategy allows you to test various 30 minute time frames across a range of dates to capitalize on this.
Make sure you are in the 30 minute time frame while viewing the performance and trade history.
McClellan Oscillator for DAX (GER30) [aftabmk modified]About McClellan Oscillator
Developed by Sherman and Marian McClellan, the McClellan Oscillator is a breadth indicator derived from Net Advances, the number of advancing issues less the number of declining issues. Subtracting the 39-day exponential moving average of Net Advances from the 19-day exponential moving average of Net Advances forms the oscillator.
As the formula reveals, the McClellan Oscillator is a momentum indicator that works similar to MACD .
McClellan Oscillator signals can be generated with breadth thrusts, centerline crossovers, overall levels and divergences.
About my version
This version here is a modification, though:
- It can only be used on the DAX index (DAX 30 or GER 30)
- It only considers the DAX 30 stocks
- The data window will provide a summary about rising and declining stocks
- The data window will output the last change for each of the 30 stocks
BUG
I am only publishing this version because I am not sure if my current version is saved when I leave tradingview.com without publishing the script.
This version still contains a bug - the if/else clauses do not correctly recognize declining stocks. So the oscillator should not be used as it is.
Working on it these days. Feel free to provide feedback!
Stuff I am working on
- Coloring the area green/red according to the value
- Fixing this bug/making this script more efficient
DISCLAIMER
This script was mainly written for educational purposes (training myself how to write custom indicatotors).
As you can see, the code is really messy.
Credits
Based on the simple version of aftabmk
You can find the original version by searching for McClellan Oscillator for nifty 50.
Gann RetracementThe indicator is based on W. D. Gann's method of retracement studies. Gann looked at stock retracement action in terms of Halves (1/2), Thirds (1/3, 2/3), Fifths (1/5, 2/5, 3/5, and 4/5) and more importantly the Eighths (1/8, 2/8, 3/8, 4/8, 5/8, 6/8, and 7/8). Needless to say, {2, 3, 5, 8} are the only Fibonacci numbers between 1 to 10. These ratios can easily be visualized in the form of division of a Circle as follows :
Divide the circle in 12 equal parts of 30 degree each to produce the Thirds :
30 x 4 = 120 is 1/3 of 360
30 x 8 = 240 is 2/3 of 360
The 30 degree retracement captures fundamental geometric shapes like a regular Triangle (120-240-360), a Square (90-180-270-360), and a regular Hexagon (60-120-180-240-300-360) inscribed inside of the circle.
Now, divide the circle in 10 equal parts of 36 degree each to produce the Fifths :
36 x 2 = 72 is 1/5 of 360
36 x 4 = 144 is 2/5 of 360
36 x 6 = 216 is 3/5 of 360
36 x 8 = 288 is 4/5 of 360
where, (72-144-216-288-360) is a regular Pentagon.
Finally, divide the circle in 8 equal parts of 45 degree each to produce the Eighths :
45 x 1 = 45 is 1/8 of 360
45 x 2 = 90 is 2/8 of 360
45 x 3 = 135 is 3/8 of 360
45 x 4 = 180 is 4/8 of 360
45 x 5 = 225 is 5/8 of 360
45 x 6 = 270 is 6/8 of 360
45 x 7 = 315 is 7/8 of 360
where, (45-90-135-180-225-270-315-360) is a regular Octagon.
How to Use this indicator ?
The indicator generates Gann retracement levels between any two significant price points, such as a high and a low.
Input :
Swing High (significant high price point, such as a top)
Swing Low (significant low price point, such as a bottom)
Degree (degree of retracement)
Output :
Gann retracement levels (color coded as follows) :
Swing High and Swing Low (BLUE)
50% retracement (ORANGE)
Retracements between Swing Low and 50% level (RED)
Retracements between 50% level and Swing High (LIME)
Bollinger Bands %B + ATR This indicator is best suitable for the 30-minutes interval OIL charts, due to ATR accuracy.
BB%B is great for showing oversold/overbought market conditions and offers excellent entry/exit opportunities for Day Trading (30 minutes chart), as well as reliable convergence/divergence patterns. ATR is conveniently combined and shows potential market volatility levels for the day when used in 30-minutes charts, thus demarcating your day trade exit point.
To use the ATR on this indicator: Just read the ATR value of the lowest (for a new bull trend) or the highest (for a new bear trend) candlestick of the newly formed trend leg. Let's suppose the ATR reads 0.2891, then you project a move of 2.891 points towards the given trend direction using the ruler tool (30-minutes charts). That's all, and there you have your take profit target!
Good Luck!!!
ADX strategy (considering ADX and +DI only )I have been checking the strategies on ADX indicator.
I have found that +DI crossing above ADX line under threshold 30 and exit on crossdown when ADX above 30 has better results than just following crossovers of +DI and -DI , ADX crossing above 30 .
BUY Rule
========
fast ema is above slow ema (default 13 and 55 , you can change these values in settings)
+DI cross above ADX well beloe threshold level (default 30)
Exit reule
========
when +DI cross down ADX , well above on threshold level
Stop Loss
=========
Default is set to 8%
Take a look and let me know how your symbol works with this strategy
Note : Bar color changes to yellow when the BUY condition is met.
Bar color and Background color shows to blue --- if Long position is active
fast ema and long ema doesnt print on the chart -- please add manually to the chart
Warning : for the use of educational purposes only
EulerMethod: DeltaEN
Shows the Integral Volume Delta (IVD)
It is a detailed OBV. Each bar sums up the volume for bars of a shorter timeframe.
For example, inside a 1M bar, every 12h bar is added up, and inside a 1h bar, every 1min bar is added. Thus, a conditional volume delta inside the bar is obtained.
The indicator for each bar shows the volume of purchases (positive), sales (negative) and the difference — IVD
The delta histogram is thicker than the volume histograms
Settings detalisation
M — 6 hours, 12 hours and 1 day for the M timeframe (720 by default)
W — 4 hours, 6 hours and 12 hours for the W timeframe (240 by default)
D — 30 minutes, 1 hour and 2 hours for the D timeframe (60 by default)
H — 1 minute, 5 minutes and 15 minutes for timeframes [1h, D) (default is 1)
For timeframes of 15m and less, the calculation is carried out by minute bars
VSA mode
The classic OBV adds volume to the cumulative sum under the condition Сlose (n) > Close (n-1) and subtracts it under the condition Close (n) < Close (n-1)
When VSA mode is disabled, all volumes are summed up under these conditions.
When the VSA approximation is turned on, the volume per bar of detail is divided by the factor (Close - Low) / (High - Low)
That is, it takes into account the spread per bar and closing relative to the spread. VSA is enabled by default
A/D mode
Shows the cumulative Accumulation / Distribution Index
The delta of the detail bar is multiplied by (High + Low + Close) / 3 bars, the result is added to the cumulative sum
No additional price conversions required due to integral summation
Index line view is customizable
EM Delta does not receive intermediate values in real time.
To see the result, wait until the bar closes or switch to a smaller timeframe
RU
Показывает Интегральную Дельту Объёма (ИДО)
Представляет собой детализированный OBV. В каждом баре суммируется объём за бары меньшего таймфрейма.
Например, внутри 1М-бара суммируется каждый 12h-бар, а внутри 1h — каждый 1m-бар. Таким образом получается условная дельта объёма внутри бара
Индикатор на каждый бар показывает объём покупок (положительный), объём продаж (отрицательный) и разницу — ИДО
Гистограмма дельты толще гистограмм объёмов
Настройки детализации внутри бара
M — 6 часов, 12 часов и 1 день для таймфрейма M (по-умолчанию 720)
W — 4 часа, 6 часов и 12 часов для таймфрейма W (по-умолчанию 240)
D — 30 минут, 1 час и 2 часа для таймфрейма D (по-умолчанию 60)
H — 1 минута, 5 минут и 15 минут для таймфреймов [1h, D) (по-умолчанию 1)
Для таймфреймов 15m и меньше расчёт ведётся по минутным барам
Режим VSA
Классический OBV прибавляет объём к кумулятивной сумме при условии Сlose(n) > Close(n-1) и отнимает при условии Close(n) < Close(n-1)
При отключении режима VSA все объёмы суммируются по этим условиям
При включённой VSA-аппроксимации объём за бар детализации делится по фактору (Close - Low) / (High - Low)
То есть учитывает спред за бар и закрытие относительно спреда. По-умолчанию режим VSA включен
Режим A/D
Показывает кумулятивный индекс Накопления/Распределения
Дельта бара детализации умножается на (High + Low + Close) / 3 бара, результат прибавляется к кумулятивной сумме
Дополнительные преобразования цены не требуются ввиду интегрального суммирования
Вид линии индекса настраивается
EM Delta не получает промежуточные значения в реальном времени.
Чтобы увидеть результат, дождитесь закрытия бара или перейдите на меньший таймфрейм
Crypto Trading Hours UTC based on Berlin time (UTC +2)Although crypto markets trade 24/7, there are spikes in volume according to the general hours at which different parts of the world do the majority of their trading.
This Script highlights the US, European and Asian markets when they are most active. The normal market hours are always from 08:00 to 16:30 local time.
US market opens at 8:00 Silicon Valley local time, and closes at 16:30 New York local time.
European market opens at 8:00 London local time, and closes at 16:30 Frankfurt local time.
Asian market opens at 8:00 Hong Kong local time, and closes at 16:30 Sydney local time.
Supertrend MTF LAG ISSUEThis script based on
we all use Super trend but it main issue is the lag as it buy too late or sell too late
using Deavaet study of Heat map MTF we can do a little trick
if you look on his study you can see that major signal for example will happen in the time frame before it happen at larger time frame
so in this example if signal at MTF 30 min and signal at MTF 60 min happen at the same time at 2 hours or 4 hours candles then this signal are more likely to be true then random signal at each time frame specific.
since we use shorter time frame on larger time frame we can remove the lag issue that make supertrend not so effective
In this example I set the signal to be MTF 30 +60 om 2 hour TF , can be good also for 4 hour candles..
So you get the signal to close inside the larger candle
now if you want to make on even shorter TF then change the code to 15 and 30 MTF on candles on 1 hour
or 1 and 5 min on 30 min or 15 min
Panchang Time//This indicator is required in NimblrTA and can be used to define timeslots for the trend confirmation
study("Panchang Time", overlay=true)
timeinrange(res, sess) => time(res, sess) != 0
premarket = #C0C0C0
regular = #0000FF
regularslot2 = #00CCFF
postmarket = #5000FF
notrading = na
sessioncolor = timeinrange("30", "0915-0930") ? premarket : timeinrange("30", "0915-0930") ? regular : timeinrange("30", "0931-1200") ? regularslot2 : timeinrange("30", "1201-1305") ? postmarket : notrading
bgcolor(sessioncolor, transp=90)
extended session - Regular Opening-Range- JayyOpening Range and some other scripts updated to plot correctly (see comments below.) There are three variations of the fibonacci expansion beyond the opening range and retracements within the opening range of the US Market session - I have not put in the script for the other markets yet.
The three scripts have different uses and strengths:
The extended session script (with the script here below) will plot the opening range whether you are using the extended session or the regular session. (that is to say whether "ext" in the lower right hand corner is highlighted or not.). While in the extended session the opening range has some plotting issues with periods like 13 minutes or any period that is not divisible into 330 mins with a round number outcome (eg 330/60 =5.5. Therefore an hour long opening range has problems in the extended session.
The pre session script is only for the premarket. You can select any opening range period you like. I have set the opening range to be the full premarket session. If you select a different session you will have to unselect "pre open to 9:30 EST for Opening Range?" in the format section. The script defaults to 15 minutes in the "period Of Pre Opening Range?". To go back to the 4 am to 9:30 pre opening range select "pre open to 9:30 EST for Opening Range?" there is no automatic 330 minute selection.
The past days offset script only works in 5 min or 15 minute period. It will show the opening range from up to 20 days past over the current days price action. Use this for the regular session only. 0 shows the current day's opening range. Use the positive integers for number of days back ie 1, 2, 3 etc not -1, -2, -3 etc. The script is preprogrammed to use the current day (0).
Scripts updated to plot correctly: One thing they all have in common is a way of they deal with a somewhat random problem that shifts the plots 4 hours in one direction or the other ie the plot started at 9:30 EST or 1:30PM EST. This issue started to occur approximately June 22, 2015 and impacts any script that tried to use "session" times to manage a plot in my scripts. The issue now seems to have been resolved during this past week.
Just in case the problem reoccurs I have added a "Switch session plot?" to each script. If the plot looks funny check or uncheck the "Switch session plot?" and see the difference. Of course if a new issue crops up it will likely require a different fix.
I have updated all of the scripts shown on this chart. If you are using a script of mine that suffers from the compiler issue then you will find an update on this chart. You can get any and all of the scripts by clicking on the small sideways wishbone on the left middle of the chart. You will see a dialogue box. Then click "make it mine". This will import all of the scripts to your computer and you can play around with them all to decide what you want and what you don't want. This is the easiest way to get all of the scripts in one fell swoop. It is also the easiest way for me to make all of the scripts available. I do not have all of the plots visible since it is too messy and one of the scripts (pre OR) is only for the regular session. To view the scripts click on the blue eye to the right of the script title to show it on this script. If you can only use the regular session. The scripts will all (with the exception of the pre OR) work fine.
If for any reason this script seems flakey refresh the page r try a slightly different period. I have noticed that sometimes randomly the script loves to return to the 5 min OR. This is a very new issue transient issue. As always if you see an issue please let me know.
Cheers Jayy
14:30 New York OpenRed dotted line at NY open. Shows new traders where NY opens. Helpful for backtesting and when trading that session where it starts very quickly
Reduced-Lag Chande Momentum Oscillator [BOSWaves]Reduced-Lag Chande Momentum Oscillator – Adaptive Momentum Geometry with Reduced-Latency Reversion Logic
Overview
The Reduced-Lag Chande Momentum Oscillator represents a sophisticated extension of the classical Chande Momentum Oscillator, preserving the foundational measurement of net directional pressure while addressing inherent limitations in lag, noise, and signal clarity. The traditional CMO provides reliable snapshots of upward versus downward force but reacts slowly to rapid market accelerations and can obscure meaningful momentum inflections with delayed readings. This iteration integrates a dual-stage reduced-lag filter, optional advanced smoothing, and acceleration-based analytics, producing a real-time, multi-dimensional representation of market momentum.
The design reframes classical momentum using a layered curvature and gradient structure - main, midline, and shadow - to show trajectory, velocity, and intensity in one view. Instead of the usual ±70/30 extremes, it uses ±50 as a statistically grounded threshold where one side of the market begins exerting true dominance. This captures structural imbalance more reliably, exposing exhaustion and actionable inflection without amplifying noise.
This visualization gives traders a continuous, responsive read on market structure, revealing not just direction but rate of change, acceleration alignment, and curvature behavior. The oscillator becomes a momentum map, expressing both probability and intensity behind directional shifts.
Where conventional oscillators mislabel short-lived swings as signals, the Reduced-Lag CMO separates baseline shifts from high-conviction transitions, enabling cleaner, more decisive signal interpretation.
Theoretical Foundation
The classical Chande Momentum Oscillator, created by Tushar Chande, calculates the normalized net difference between consecutive upward and downward price changes over a defined window, generating readings from –100 to +100. While effective for capturing basic directional pressure, the unmodified CMO suffers from signal latency and sensitivity to abrupt market swings, which can obscure actionable inflection points.
The Reduced-Lag CMO augments this foundation with three key mechanisms:
Reduced-Lag Filtering : A dual-EMA structure eliminates inertial lag, aligning the oscillator curve closely with real-time market momentum without producing overshoot artifacts.
Smoothing Architecture : Optional SMA, EMA, or WMA smoothing is applied post-filter, balancing noise reduction with trajectory fidelity. A multi-layer line system (shadow → midline → main) communicates depth, curvature, and gradient dynamics.
Acceleration Integration : First and second derivatives of the smoothed curve quantify velocity and acceleration, allowing the indicator to identify not only momentum flips but the force behind each shift, forming the basis for the strong-signal overlay.
The combination of these mechanisms produces an oscillator that respects the original CMO framework while delivering real-time, context-sensitive intelligence. The ±50 boundaries are selected as the statistically validated pressure zones where directional dominance exceeds neutral oscillation. Crosses and rejections at these boundaries are not arbitrary overbought/oversold events, but measurable imbalances with actionable significance.
How It Works
The Reduced-Lag CMO is constructed through a multi-stage process:
Momentum Estimation Core : Raw CMO values are calculated and then passed through a reduced-lag filter to remove delay, creating a curve that closely tracks instantaneous directional pressure.
Smoothing & Layered Representation : The filtered curve can be smoothed and split into three layers - shadow, midline, and main - giving visual depth, trajectory clarity, and curvature instead of a single-line oscillator.
Gradient-Based Pressure Mapping : Color gradients encode momentum strength and polarity. Green-yellow transitions highlight increasing upward dominance, while red-yellow transitions indicate weakening downward force.
Pressure-Zone Anchoring (±50) : The system defines statistically significant pressure zones at ±50. Moves beyond these levels reflect dominant directional control, and rejections inside the zone signal potential exhaustion.
Signal Generation : Momentum events are evaluated through velocity and acceleration. Standard signals appear as triangle markers indicating validated momentum flips. Strong signals appear as triangles with diamonds when acceleration confirms a high-conviction transition.
A cooldown rule spaces signals apart to reduce clutter and emphasize structurally meaningful events.
Interpretation
The Reduced-Lag CMO reframes momentum as a dynamic equilibrium between directional force and structural pressure:
Positive Momentum Phases : Curves above zero with green-yellow gradients indicate sustained upward pressure. Shallow retracements or midline tests denote controlled pullbacks.
Negative Momentum Phases : Curves below zero with red-yellow gradients show downward dominance. Rejections from –50 highlight potential exhaustion and reversal readiness.
Pressure-Zone Dynamics (±50) : Crosses beyond ±50 confirm dominant directional force. Meanwhile, rejections and rotations inside the zone signal structural fatigue.
Velocity & Acceleration Analysis : Rising momentum with decelerating velocity suggests fading force; acceleration alignment amplifies signal strength and forms the basis of strong signals.
Signal Architecture
The Reduced-Lag CMO produces a single event type with two intensities: a validated momentum inflection.
Standard Signals - Triangles:
Triggered by momentum flips confirmed by velocity.
Represent moderate-intensity directional changes.
Appear at zero-line crosses or ±50 rejections with aligned velocity.
Strong Signals Triangles + Diamonds:
Triggered when acceleration confirms the directional change.
Represent high-intensity, high-conviction shifts.
Rare by design; indicate robust momentum inflections.
Cooldown mechanics prevent repeated signals in short succession, emphasizing structural reliability over noise.
Strategy Integration
Trend Confirmation : Align zero-line flips with higher-timeframe directional bias.
Reversal Detection : Strong signals from ±50 zones highlight potential inflection points.
Volatility Assessment : Gradient transitions reveal strengthening or weakening momentum.
Pullback Timing : Multi-layer curvature identifies controlled retracements vs trend exhaustion.
Confluence Mapping : Pair with structure-based indicators to filter signals in context.
Technical Implementation Details
Core Engine : Classical CMO with Ehlers reduced-lag extension
Lag Reduction : Dual EMA filtering
Smoothing : Optional SMA/EMA/WMA post-filter
Multi-Layer Curve : Shadow, midline, main
Signal System : Two-tier momentum-acceleration framework
Pressure Zones : ±50 statistically validated thresholds
Cooldown Logic : Bar-indexed suppression
Gradient Mapping : Encodes magnitude and direction
Alerts : Standard and strong signals
Optimal Application Parameters
Timeframes:
1 - 5 min : Intraday momentum tracking
15 - 60 min : Trend rotations & volatility transitions
4H - Daily : Macro momentum exhaustion & re-accumulation mapping
Suggested Ranges:
CMO Length : 7 - 12
Reduced-Lag Length : 5 - 15
Smoothing : 10 - 20
Cooldown Bars : 5 - 15
Performance Characteristics
High Effectiveness:
Markets with directional pulses & clean pressure transitions
Trending phases with measurable pullbacks
Instruments with stable volatility cycles
Reduced Edge:
Choppy consolidations
Ultra-low volatility environments
Disclaimer
The Reduced-Lag Chande Momentum Oscillator is a professional-grade analytical tool. It is not predictive and carries no guaranteed profitability. Effectiveness depends on asset class, volatility regime, parameter selection, and disciplined execution. Any suggested application timeframes or recommended ranges are guidance only - they are not universally optimal and will not deliver consistent accuracy on every asset or market condition. BOSWaves recommends using it in conjunction with structure, liquidity, and momentum context.
Elliott Wave + SMC Fusion # Elliott Wave + SMC Fusion
## TITLE:
Elliott Wave + Smart Money Concepts Fusion
---
## SHORT DESCRIPTION:
Automated Elliott Wave pattern detection with Smart Money Concepts confirmation, EWO oscillator integration, and confluence scoring system.
---
## FULL DESCRIPTION:
### 📊 OVERVIEW
This indicator combines three powerful trading methodologies into a unified system:
- **Elliott Wave Theory** - Automated detection of Wave 1-2 impulse patterns
- **Smart Money Concepts (SMC)** - Order Blocks and Fair Value Gaps for institutional confirmation
- **Elliott Wave Oscillator (EWO)** - Momentum-based signal validation
The core concept is to identify high-probability Wave 3 entries by detecting completed Wave 1-2 structures and validating them with SMC and momentum indicators.
---
### 🔧 HOW IT WORKS
**1. Pattern Detection (ZigZag Method)**
- Uses pivot high/low detection to identify swing points
- Validates Wave 2 retracement using Fibonacci ratios (default: 38.2% - 88.6%)
- Requires minimum wave size to filter noise
- Applies confirmation bars to avoid premature signals
**2. Wave Projections**
- Wave 3 target: Fibonacci extension of Wave 1 (default: 1.618)
- Wave 4 retracement: Percentage of Wave 3 (default: 38.2%)
- Wave 5 projection: Extension of Wave 1 from Wave 4
**3. Smart Money Validation**
- **Order Blocks**: Identifies last opposing candle before breakout (institutional footprint)
- **Fair Value Gaps**: Detects price imbalances for potential support/resistance
**4. EWO Confirmation**
- Calculates momentum: (EMA5 / EMA34 - 1) × 100
- Signal line crossovers confirm trend direction
- Strong signals occur at extremes (< -13 or > 13 threshold)
**5. Confluence Scoring (0-100%)**
Points awarded for:
- Fibonacci quality of Wave 2 retracement (10-30 pts)
- Order Block presence (15 pts)
- Fair Value Gap presence (10 pts)
- Volume confirmation (10-15 pts)
- Trend alignment with EMA50 (10 pts)
- EWO confirmation (10-20 pts)
---
### 🎯 UNIQUE FEATURES
**Pattern Locking System**
- Once a valid pattern is detected, it locks until:
- Pattern invalidates (price breaks Wave 0)
- Pattern completes (Wave 5 reached)
- Auto-timeout (configurable bars)
- Prevents rapid signal flipping and false alerts
**Signal Stability Controls**
- Adjustable cooldown between signals (default: 20 bars)
- Minimum bar distance between wave points
- Direction change requirement option
- Confirmation bars after Wave 2 formation
**Visual Wave Tracking**
- Solid lines for impulse waves (0→1, 2→3, 4→5)
- Dashed lines for corrective waves (1→2, 3→4)
- Numbered labels on each wave point
- Real-time projection lines to targets
**Comprehensive Dashboard**
- Current wave status and lock state
- Pattern grade (A+ to D based on confluence)
- Projected vs actual wave levels (✓ when completed)
- SMC confirmation status
- Risk/Reward ratio calculation
- EWO trend direction
---
### 📈 TRADING APPLICATION
**Entry Strategy**
- Wait for Wave 1-2 pattern detection (diamond signal)
- Check confluence score (>65% = higher probability)
- Verify EWO alignment with pattern direction
- Enter after 30% retracement of Wave 2 (customizable)
**Risk Management**
- Stop Loss: Below Wave 0 (with buffer)
- Take Profit 1: Wave 3 projection
- Take Profit 2: Wave 5 projection
- R:R displayed in dashboard
**Invalidation Rules**
- Price breaks below Wave 0 (bullish) or above (bearish)
- Wave 2 level violated before Wave 3 forms
- Pattern timeout exceeded
---
### ⚙️ KEY SETTINGS
**Elliott Wave**
- ZigZag Length: Pivot detection sensitivity
- Fib Tolerance: Acceptable retracement range
- Min Wave Size: Filter small movements
**Signal Stability**
- Signal Cooldown: Minimum bars between signals
- Lock Pattern Until Invalid: Prevent signal changes
- Confirmation Bars: Wait after Wave 2
**Wave Projection**
- Wave 3/4/5 Fibonacci extensions
- Projection display distance
**EWO Settings**
- Fast/Slow EMA lengths
- Signal smoothing
- Strength threshold
**SMC Settings**
- Order Block lookback period
- FVG minimum size percentage
---
### 🔔 ALERTS
- New bullish/bearish pattern detected
- High confluence setup (>75%)
- Pattern invalidation
- Wave completion
---
### ⚠️ IMPORTANT NOTES
- This indicator identifies **potential** Elliott Wave patterns based on mathematical rules
- Elliott Wave analysis is subjective - patterns may be interpreted differently
- Always combine with other analysis methods and proper risk management
- Past pattern performance does not guarantee future results
- Pattern locking prevents repainting but delays new pattern detection
- Best used on higher timeframes (1H+) for cleaner wave structures
---
### 📚 METHODOLOGY REFERENCES
**Elliott Wave Theory**
- Wave 2 typically retraces 38.2% - 88.6% of Wave 1
- Wave 3 is often the strongest, extending 161.8% of Wave 1
- Wave 4 usually retraces 38.2% of Wave 3
- Wave 5 completes the impulse structure
**Smart Money Concepts**
- Order Blocks represent institutional supply/demand zones
- FVGs indicate price inefficiencies that may act as magnets
**Elliott Wave Oscillator**
- Developed to identify wave momentum
- Crossovers signal potential wave transitions
- Extreme readings often coincide with wave completions
---
### 🎨 VISUAL ELEMENTS
- **Green**: Bullish patterns and projections
- **Red**: Bearish patterns and projections
- **Orange**: Wave projection levels
- **Purple**: Order Block zones
- **Yellow**: Fair Value Gaps
- **Blue**: Entry levels
- **Diamond shapes**: New pattern signals
- **Triangle shapes**: EWO crossover signals
---
### 💡 TIPS FOR BEST RESULTS
1. Use on liquid markets with clear trend behavior
2. Higher timeframes produce more reliable patterns
3. Look for confluence scores above 65%
4. Verify EWO alignment before entry
5. Consider market context (overall trend, key levels)
6. Adjust ZigZag length based on your trading style
7. Increase cooldown period for longer-term signals
---
**Indicator Type**: Overlay
**Markets**: All (Crypto, Forex, Stocks, Commodities)
**Timeframes**: All (1H+ recommended)
**Style**: Pattern Recognition + Momentum + Price Action
NormalizedIndicatorsNormalizedIndicators Library - Comprehensive Trend Normalization & Pre-Calibrated Systems
Overview
The NormalizedIndicators Library is an advanced Pine Script™ collection that provides normalized trend-following indicators, calculation functions, and pre-calibrated consensus systems for technical analysis. This library extends beyond simple indicator normalization by offering battle-tested, optimized parameter sets for specific assets and timeframes.
The main advantage lies in its dual functionality:
Individual normalized indicators with standardized outputs (1 = bullish, -1 = bearish, 0 = neutral)
Pre-calibrated consensus functions that combine multiple indicators with asset-specific optimizations
This enables traders to either build custom strategies using individual indicators or leverage pre-optimized systems designed for specific markets.
📊 Library Structure
The library is organized into three main sections:
1. Trend-Following Indicators
Individual indicators normalized to standard output format
2. Calculation Indicators
Statistical and mathematical analysis functions
3. Pre-Calibrated Systems ⭐ NEW
Asset-specific consensus configurations with optimized parameters
🔄 Trend-Following Indicators
Stationary Indicators
These oscillate around a fixed value and are not bound to price.
TSI() - True Strength Index ⭐ NEW
Source: TradingView
Parameters:
price: Price source
long: Long smoothing period
short: Short smoothing period
signal: Signal line period
Logic: Double-smoothed momentum oscillator comparing TSI to its signal line
Signal:
1 (bullish): TSI ≥ TSI EMA
0 (bearish): TSI < TSI EMA
Use Case: Momentum confirmation with trend direction
SMI() - Stochastic Momentum Index ⭐ NEW
Source: TradingView
Parameters:
src: Price source
lengthK: Stochastic period
lengthD: Smoothing period
lengthEMA: Signal line period
Logic: Enhanced stochastic that measures price position relative to midpoint of high/low range
Signal:
1 (bullish): SMI ≥ SMI EMA
0 (bearish): SMI < SMI EMA
Use Case: Overbought/oversold with momentum direction
BBPct() - Bollinger Bands Percent
Source: Algoalpha X Sushiboi77
Parameters:
Length: Period for Bollinger Bands
Factor: Standard deviation multiplier
Source: Price source (typical: close)
Logic: Calculates the position of price within the Bollinger Bands as a percentage
Signal:
1 (bullish): when positionBetweenBands > 50
-1 (bearish): when positionBetweenBands ≤ 50
Special Feature: Uses an array to store historical standard deviations for additional analysis
RSI() - Relative Strength Index
Source: TradingView
Parameters:
len: RSI period
src: Price source
smaLen: Smoothing period for RSI
Logic: Classic RSI with additional SMA smoothing
Signal:
1 (bullish): RSI-SMA > 50
-1 (bearish): RSI-SMA < 50
0 (neutral): RSI-SMA = 50
Non-Stationary Indicators
These follow price movement and have no fixed boundaries.
NorosTrendRibbonSMA() & NorosTrendRibbonEMA()
Source: ROBO_Trading
Parameters:
Length: Moving average and channel period
Source: Price source
Logic: Creates a price channel based on the highest/lowest MA value over a specified period
Signal:
1 (bullish): Price breaks above upper band
-1 (bearish): Price breaks below lower band
0 (neutral): Price within channel (maintains last state)
Difference: SMA version uses simple moving averages, EMA version uses exponential
TrendBands()
Source: starlord_xrp
Parameters: src (price source)
Logic: Uses 12 EMAs (9-30 period) and checks if all are rising or falling simultaneously
Signal:
1 (bullish): All 12 EMAs are rising
-1 (bearish): All 12 EMAs are falling
0 (neutral): Mixed signals
Special Feature: Very strict conditions - extremely strong trend filter
Vidya() - Variable Index Dynamic Average
Source: loxx
Parameters:
source: Price source
length: Main period
histLength: Historical period for volatility calculation
Logic: Adaptive moving average that adjusts to volatility
Signal:
1 (bullish): VIDYA is rising
-1 (bearish): VIDYA is falling
VZO() - Volume Zone Oscillator
Parameters:
source: Price source
length: Smoothing period
volumesource: Volume data source
Logic: Combines price and volume direction, calculates the ratio of directional volume to total volume
Signal:
1 (bullish): VZO > 14.9
-1 (bearish): VZO < -14.9
0 (neutral): VZO between -14.9 and 14.9
TrendContinuation()
Source: AlgoAlpha
Parameters:
malen: First HMA period
malen1: Second HMA period
theclose: Price source
Logic: Uses two Hull Moving Averages for trend assessment with neutrality detection
Signal:
1 (bullish): Uptrend without divergence
-1 (bearish): Downtrend without divergence
0 (neutral): Trend and longer MA diverge
LeonidasTrendFollowingSystem()
Source: LeonidasCrypto
Parameters:
src: Price source
shortlen: Short EMA period
keylen: Long EMA period
Logic: Simple dual EMA crossover system
Signal:
1 (bullish): Short EMA < Key EMA
-1 (bearish): Short EMA ≥ Key EMA
ysanturtrendfollower()
Source: ysantur
Parameters:
src: Price source
depth: Depth of Fibonacci weighting
smooth: Smoothing period
bias: Percentage bias adjustment
Logic: Complex system with Fibonacci-weighted moving averages and bias bands
Signal:
1 (bullish): Weighted MA > smoothed MA (with upward bias)
-1 (bearish): Weighted MA < smoothed MA (with downward bias)
0 (neutral): Within bias zone
TRAMA() - Trend Regularity Adaptive Moving Average
Source: LuxAlgo
Parameters:
src: Price source
length: Adaptation period
Logic: Adapts to trend regularity - accelerates in stable trends, slows in consolidations
Signal:
1 (bullish): Price > TRAMA
-1 (bearish): Price < TRAMA
0 (neutral): Price = TRAMA
HullSuite()
Source: InSilico
Parameters:
_length: Base period
src: Price source
_lengthMult: Length multiplier
Logic: Uses Hull Moving Average with lagged comparisons for trend determination
Signal:
1 (bullish): Current Hull > Hull 2 bars ago
-1 (bearish): Current Hull < Hull 2 bars ago
0 (neutral): No change
STC() - Schaff Trend Cycle
Source: shayankm (described as "Better MACD")
Parameters:
length: Cycle period
fastLength: Fast MACD period
slowLength: Slow MACD period
src: Price source
Logic: Combines MACD concepts with stochastic normalization for early trend signals
Signal:
1 (bullish): STC is rising
-1 (bearish): STC is falling
🧮 Calculation Indicators
These functions provide specialized mathematical calculations for advanced analysis.
LCorrelation() - Long-term Correlation
Creator: unicorpusstocks
Parameters:
Input: First time series
Compare: Second time series
Logic: Calculates the average of correlations across 6 different periods (30, 60, 90, 120, 150, 180)
Returns: Correlation value between -1 and 1
Application: Long-term relationship analysis between assets, markets, or indicators
MCorrelation() - Medium-term Correlation
Creator: unicorpusstocks
Parameters:
Input: First time series
Compare: Second time series
Logic: Calculates the average of correlations across 6 different periods (15, 30, 45, 60, 75, 90)
Returns: Correlation value between -1 and 1
Application: Medium-term relationship analysis with higher sensitivity
assetBeta() - Beta Coefficient
Creator: unicorpusstocks
Parameters:
measuredSymbol: The asset to be measured
baseSymbol: The reference asset (e.g., market index)
Logic:
Calculates Beta across 4 different time horizons (50, 100, 150, 200 periods)
Beta = Correlation × (Asset Standard Deviation / Market Standard Deviation)
Returns the average of all 4 Beta values
Returns: Beta value (typically 0-2, can be higher/lower)
Interpretation:
Beta = 1: Asset moves in sync with the market
Beta > 1: Asset more volatile than market
Beta < 1: Asset less volatile than market
Beta < 0: Asset moves inversely to the market
🎯 Pre-Calibrated Systems ⭐ NEW FEATURE
These are ready-to-use consensus functions with optimized parameters for specific assets and timeframes. Each calibration has been fine-tuned through extensive backtesting to provide optimal performance for its target market.
Universal Calibrations
virtual_4d_cal(src) - Virtual/General 4-Day Timeframe
Use Case: General purpose 4-day chart analysis
Optimized For: Broad crypto market on 4D timeframe
Indicators Used: BBPct, Noro's, RSI, VIDYA, HullSuite, TrendContinuation, Leonidas, TRAMA
Characteristics: Balanced sensitivity for swing trading
virtual_1d_cal(src) - Virtual/General 1-Day Timeframe
Use Case: General purpose daily chart analysis
Optimized For: Broad crypto market on 1D timeframe
Indicators Used: BBPct, Noro's, RSI, VIDYA, HullSuite, TrendContinuation, Leonidas, TRAMA
Characteristics: Standard daily trading parameters
Cryptocurrency Specific
sui_cal(src) - SUI Ecosystem Tokens
Use Case: Tokens in the SUI blockchain ecosystem
Timeframe: 1D
Characteristics: Fast-response parameters for high volatility projects
deep_1d_cal(src) - DEEP Token Daily
Use Case: Deepbook (DEEP) token analysis
Timeframe: 1D
Characteristics: Tuned for liquidity protocol token behavior
wal_1d_cal(src) - WAL Token Daily
Use Case: Specific for WAL token
Timeframe: 1D
Characteristics: Mid-range sensitivity parameters
sns_1d_cal(src) - SNS Token Daily
Use Case: Specific for SNS token
Timeframe: 1D
Characteristics: Balanced parameters for DeFi tokens
meme_cal(src) - Meme Coin Calibration
Use Case: Highly volatile meme coins
Timeframe: Various
Characteristics: Wider parameters to handle extreme volatility
Warning: Meme coins carry extreme risk
base_cal(src) - BASE Ecosystem Tokens
Use Case: Tokens on the BASE blockchain
Timeframe: Various
Characteristics: Optimized for L2 ecosystem tokens
Solana Ecosystem
sol_4d_cal(src) - Solana 4-Day
Use Case: SOL token on 4-day charts
Characteristics: Responsive parameters for major L1 blockchain
sol_meme_4d_cal(src) - Solana Meme Coins 4-Day
Use Case: Meme coins on Solana blockchain
Timeframe: 4D
Characteristics: Handles high volatility of Solana meme sector
Ethereum Ecosystem
eth_4d_cal(src) - Ethereum 4-Day
Use Case: ETH and major ERC-20 tokens
Timeframe: 4D
Indicators Used: BBPct, Noro's, RSI, TSI, HullSuite, TrendContinuation, Leonidas, SMI
Special: Uses TSI and SMI instead of VIDYA and TRAMA
Characteristics: Tuned for Ethereum's market cycles
Bitcoin
btc_4d_cal(src) - Bitcoin 4-Day
Use Case: Bitcoin on 4-day charts
Timeframe: 4D
Characteristics: Slower, smoother parameters for the most established crypto asset
Notes: Conservative parameters suitable for position trading
Traditional Markets
qqq_4d_cal(src) - QQQ (Nasdaq-100 ETF) 4-Day
Use Case: QQQ ETF and tech-heavy indices
Timeframe: 4D
Characteristics: Largest parameter sets reflecting lower volatility of traditional markets
Notes: Can be adapted for similar large-cap tech indices
💡 Usage Examples
Example 1: Using Pre-Calibrated System
pinescriptimport unicorpusstocks/NormalizedIndicators/1 as lib
// Simple one-line implementation for Bitcoin
btcSignal = lib.btc_4d_cal(close)
// Trading logic
longCondition = btcSignal > 0.5
shortCondition = btcSignal < -0.5
// Plot
plot(btcSignal, "BTC 4D Consensus", color.orange)
Example 2: Custom Multi-Indicator Consensus
pinescriptimport unicorpusstocks/NormalizedIndicators/1 as lib
// Build your own combination
signal1 = lib.BBPct(20, 2.0, close)
signal2 = lib.RSI(14, close, 5)
signal3 = lib.TRAMA(close, 50)
signal4 = lib.TSI(close, 25, 13, 13)
// Custom consensus
customConsensus = math.avg(signal1, signal2, signal3, signal4)
plot(customConsensus, "Custom Consensus", color.blue)
Example 3: Asset-Specific Strategy Switching
pinescriptimport unicorpusstocks/NormalizedIndicators/1 as lib
// Automatically use the right calibration
signal = switch syminfo.ticker
"BTCUSD" => lib.btc_4d_cal(close)
"ETHUSD" => lib.eth_4d_cal(close)
"SOLUSD" => lib.sol_4d_cal(close)
"QQQ" => lib.qqq_4d_cal(close)
=> lib.virtual_4d_cal(close) // Default
plot(signal, "Auto-Calibrated Signal", color.orange)
Example 4: Correlation-Filtered Trading
pinescriptimport unicorpusstocks/NormalizedIndicators/1 as lib
// Only trade when strong correlation with market exists
spy = request.security("SPY", timeframe.period, close)
correlation = lib.MCorrelation(close, spy)
trendSignal = lib.virtual_1d_cal(close)
// Only signals with positive market correlation
tradeBuy = trendSignal > 0.5 and correlation > 0.5
tradeSell = trendSignal < -0.5 and correlation > 0.5
Example 5: Beta-Adjusted Position Sizing
pinescriptimport unicorpusstocks/NormalizedIndicators/1 as lib
spy = request.security("SPY", timeframe.period, close)
beta = lib.assetBeta(close, spy)
// Adjust position size based on Beta
basePositionSize = 100
adjustedSize = basePositionSize / beta // Less size with high Beta
// Use with calibrated signal
signal = lib.qqq_4d_cal(close)
🎯 Choosing the Right Calibration
Decision Tree
1. What asset are you trading?
Bitcoin → btc_4d_cal()
Ethereum/ERC-20 → eth_4d_cal()
Solana → sol_4d_cal()
Solana memes → sol_meme_4d_cal()
SUI ecosystem → sui_cal()
BASE ecosystem → base_cal()
Meme coins (any chain) → meme_cal()
QQQ/Tech indices → qqq_4d_cal()
Other/General → virtual_4d_cal() or virtual_1d_cal()
2. What timeframe?
Most calibrations are optimized for 4D (4-day) or 1D (daily)
For other timeframes, start with virtual calibrations and adjust
3. What's the asset's volatility?
High volatility (memes, new tokens) → Use meme_cal() or similar
Medium volatility (established alts) → Use specific calibrations
Low volatility (BTC, major indices) → Use btc_4d_cal() or qqq_4d_cal()
⚙️ Technical Details
Normalization Standard
Bullish: 1
Bearish: -1
Neutral: 0 (only for selected indicators)
Calibration Methodology
Pre-calibrated functions were optimized using:
Historical backtesting on target assets
Parameter optimization for maximum Sharpe ratio
Validation on out-of-sample data
Real-time forward testing
Iterative refinement based on market conditions
Advantages of Pre-Calibrations
Instant Deployment: No parameter tuning needed
Asset-Optimized: Tailored to specific market characteristics
Tested Performance: Validated through extensive backtesting
Consistent Framework: All use the same 8-indicator structure
Easy Comparison: Compare different assets using same methodology
Performance Considerations
All functions are optimized for Pine Script v5
Proper use of var for state management
Efficient array operations where needed
Minimal recursive calls
Pre-calibrations add negligible computational overhead
📋 License
This code is subject to the Mozilla Public License 2.0 at mozilla.org
🔧 Installation
pinescriptimport unicorpusstocks/NormalizedIndicators/1
Then use functions with your chosen alias:
pinescript// Individual indicators
lib.BBPct(20, 2.0, close)
lib.RSI(14, close, 5)
lib.TSI(close, 25, 13, 13)
// Pre-calibrated systems
lib.btc_4d_cal(close)
lib.eth_4d_cal(close)
lib.meme_cal(close)
⚠️ Important Notes
General Usage
All indicators are lagging, as is typical for trend-following indicators
Signals should be combined with additional analysis (volume, support/resistance, etc.)
Backtesting is recommended before starting live trading with these signals
Different assets and timeframes may require different parameter optimizations
Pre-Calibrated Systems
Calibrations are optimized for specific timeframes - using them on different timeframes may reduce effectiveness
Market conditions change - what worked historically may need adjustment
Pre-calibrations are starting points, not guaranteed solutions
Always validate performance on your specific use case
Consider current market regime (trending vs. ranging)
Risk Management
Meme coin calibrations are designed for extremely volatile assets - use appropriate position sizing
Pre-calibrated systems do not eliminate risk
Always use stop losses and proper risk management
Past performance does not guarantee future results
Customization
Pre-calibrations can serve as templates for your own optimizations
Feel free to adjust individual parameters within calibration functions
Test modifications thoroughly before live deployment
🎓 Advanced Use Cases
Multi-Asset Portfolio Dashboard
Create a dashboard showing consensus across different assets:
pinescriptimport unicorpusstocks/NormalizedIndicators/1 as lib
btc = request.security("BTCUSD", "4D", close)
eth = request.security("ETHUSD", "4D", close)
sol = request.security("SOLUSD", "4D", close)
btcSignal = lib.btc_4d_cal(btc)
ethSignal = lib.eth_4d_cal(eth)
solSignal = lib.sol_4d_cal(sol)
// Plot all three for comparison
plot(btcSignal, "BTC", color.orange)
plot(ethSignal, "ETH", color.blue)
plot(solSignal, "SOL", color.purple)
Regime Detection
Use correlation and calibrations together:
pinescriptimport unicorpusstocks/NormalizedIndicators/1 as lib
// Detect market regime
btc = request.security("BTCUSD", timeframe.period, close)
correlation = lib.MCorrelation(close, btc)
// Choose strategy based on correlation
signal = correlation > 0.7 ? lib.btc_4d_cal(close) : lib.virtual_4d_cal(close)
Comparative Analysis
Compare asset-specific vs. general calibrations:
pinescriptimport unicorpusstocks/NormalizedIndicators/1 as lib
specificSignal = lib.btc_4d_cal(close) // BTC-specific
generalSignal = lib.virtual_4d_cal(close) // General
divergence = specificSignal - generalSignal
plot(divergence, "Calibration Divergence", color.yellow)
🚀 Quick Start Guide
For Beginners
Identify Your Asset: What are you trading?
Find the Calibration: Use the decision tree above
One-Line Implementation: signal = lib.btc_4d_cal(close)
Set Thresholds: Buy when > 0.5, sell when < -0.5
Add Risk Management: Always use stops
For Advanced Users
Start with Pre-Calibration: Use as baseline
Analyze Performance: Backtest on your specific market
Fine-Tune Parameters: Adjust individual indicators if needed
Combine with Other Signals: Volume, market structure, etc.
Create Custom Calibrations: Build your own based on library structure
For Developers
Import Library: Access all functions
Mix and Match: Combine indicators creatively
Build Custom Logic: Use indicators as building blocks
Create New Calibrations: Follow the established pattern
Share and Iterate: Contribute to the trading community
🎯 Key Takeaways
✅ 10 normalized indicators - Consistent interpretation across all
✅ 16+ pre-calibrated systems - Ready-to-use for specific assets
✅ Asset-optimized parameters - No guesswork required
✅ Calculation functions - Advanced correlation and beta analysis
✅ Universal framework - Works across crypto, stocks, forex
✅ Professional-grade - Built on proven technical analysis principles
✅ Flexible architecture - Use pre-calibrations or build your own
✅ Battle-tested - Validated through extensive backtesting
NormalizedIndicators Library transforms complex multi-indicator analysis into actionable signals through both customizable individual indicators and pre-optimized consensus systems. Whether you're a beginner looking for plug-and-play solutions or an advanced trader building sophisticated strategies, this library provides the foundation for data-driven trading decisions.WiederholenClaude kann Fehler machen. Bitte überprüfen Sie die Antworten. Sonnet 4.5
NormalizedIndicatorsNormalizedIndicators - Comprehensive Trend Normalization Library
Overview
This Pine Script™ library provides an extensive collection of normalized trend-following indicators and calculation functions for technical analysis. The main advantage of this library lies in its unified signal output: All trend indicators are normalized to a standardized format where 1 represents a bullish signal, -1 represents a bearish signal, and 0 (where applicable) represents a neutral signal.
This normalization enables traders to seamlessly combine different indicators, create consensus signals, and develop complex multi-indicator strategies without worrying about different scales and interpretations.
📊 Categories
The library is divided into two main categories:
1. Trend-Following Indicators
2. Calculation Indicators
🔄 Trend-Following Indicators
Stationary Indicators
These oscillate around a fixed value and are not bound to price.
BBPct() - Bollinger Bands Percent
Source: Algoalpha X Sushiboi77
Parameters:
Length: Period for Bollinger Bands
Factor: Standard deviation multiplier
Source: Price source (typical: close)
Logic: Calculates the position of price within the Bollinger Bands as a percentage
Signal:
1 (bullish): when positionBetweenBands > 50
-1 (bearish): when positionBetweenBands ≤ 50
Special Feature: Uses an array to store historical standard deviations for additional analysis
RSI() - Relative Strength Index
Source: TradingView
Parameters:
len: RSI period
src: Price source
smaLen: Smoothing period for RSI
Logic: Classic RSI with additional SMA smoothing
Signal:
1 (bullish): RSI-SMA > 50
-1 (bearish): RSI-SMA < 50
0 (neutral): RSI-SMA = 50
Non-Stationary Indicators
These follow price movement and have no fixed boundaries.
NorosTrendRibbonSMA() & NorosTrendRibbonEMA()
Source: ROBO_Trading
Parameters:
Length: Moving average and channel period
Source: Price source
Logic: Creates a price channel based on the highest/lowest MA value over a specified period
Signal:
1 (bullish): Price breaks above upper band
-1 (bearish): Price breaks below lower band
0 (neutral): Price within channel (maintains last state)
Difference: SMA version uses simple moving averages, EMA version uses exponential
TrendBands()
Source: starlord_xrp
Parameters: src (price source)
Logic: Uses 12 EMAs (9-30 period) and checks if all are rising or falling simultaneously
Signal:
1 (bullish): All 12 EMAs are rising
-1 (bearish): All 12 EMAs are falling
0 (neutral): Mixed signals
Special Feature: Very strict conditions - extremely strong trend filter
Vidya() - Variable Index Dynamic Average
Source: loxx
Parameters:
source: Price source
length: Main period
histLength: Historical period for volatility calculation
Logic: Adaptive moving average that adjusts to volatility
Signal:
1 (bullish): VIDYA is rising
-1 (bearish): VIDYA is falling
VZO() - Volume Zone Oscillator
Parameters:
source: Price source
length: Smoothing period
volumesource: Volume data source
Logic: Combines price and volume direction, calculates the ratio of directional volume to total volume
Signal:
1 (bullish): VZO > 14.9
-1 (bearish): VZO < -14.9
0 (neutral): VZO between -14.9 and 14.9
TrendContinuation()
Source: AlgoAlpha
Parameters:
malen: First HMA period
malen1: Second HMA period
theclose: Price source
Logic: Uses two Hull Moving Averages for trend assessment with neutrality detection
Signal:
1 (bullish): Uptrend without divergence
-1 (bearish): Downtrend without divergence
0 (neutral): Trend and longer MA diverge
LeonidasTrendFollowingSystem()
Source: LeonidasCrypto
Parameters:
src: Price source
shortlen: Short EMA period
keylen: Long EMA period
Logic: Simple dual EMA crossover system
Signal:
1 (bullish): Short EMA < Key EMA
-1 (bearish): Short EMA ≥ Key EMA
ysanturtrendfollower()
Source: ysantur
Parameters:
src: Price source
depth: Depth of Fibonacci weighting
smooth: Smoothing period
bias: Percentage bias adjustment
Logic: Complex system with Fibonacci-weighted moving averages and bias bands
Signal:
1 (bullish): Weighted MA > smoothed MA (with upward bias)
-1 (bearish): Weighted MA < smoothed MA (with downward bias)
0 (neutral): Within bias zone
TRAMA() - Trend Regularity Adaptive Moving Average
Source: LuxAlgo
Parameters:
src: Price source
length: Adaptation period
Logic: Adapts to trend regularity - accelerates in stable trends, slows in consolidations
Signal:
1 (bullish): Price > TRAMA
-1 (bearish): Price < TRAMA
0 (neutral): Price = TRAMA
HullSuite()
Source: InSilico
Parameters:
_length: Base period
src: Price source
_lengthMult: Length multiplier
Logic: Uses Hull Moving Average with lagged comparisons for trend determination
Signal:
1 (bullish): Current Hull > Hull 2 bars ago
-1 (bearish): Current Hull < Hull 2 bars ago
0 (neutral): No change
STC() - Schaff Trend Cycle
Source: shayankm (described as "Better MACD")
Parameters:
length: Cycle period
fastLength: Fast MACD period
slowLength: Slow MACD period
src: Price source
Logic: Combines MACD concepts with stochastic normalization for early trend signals
Signal:
1 (bullish): STC is rising
-1 (bearish): STC is falling
🧮 Calculation Indicators
These functions provide specialized mathematical calculations for advanced analysis.
LCorrelation() - Long-term Correlation
Creator: unicorpusstocks
Parameters:
Input: First time series
Compare: Second time series
Logic: Calculates the average of correlations across 6 different periods (30, 60, 90, 120, 150, 180)
Returns: Correlation value between -1 and 1
Application: Long-term relationship analysis between assets, markets, or indicators
MCorrelation() - Medium-term Correlation
Creator: unicorpusstocks
Parameters:
Input: First time series
Compare: Second time series
Logic: Calculates the average of correlations across 6 different periods (15, 30, 45, 60, 75, 90)
Returns: Correlation value between -1 and 1
Application: Medium-term relationship analysis with higher sensitivity
assetBeta() - Beta Coefficient
Creator: unicorpusstocks
Parameters:
measuredSymbol: The asset to be measured
baseSymbol: The reference asset (e.g., market index)
Logic:
Calculates Beta across 4 different time horizons (50, 100, 150, 200 periods)
Beta = Correlation × (Asset Standard Deviation / Market Standard Deviation)
Returns the average of all 4 Beta values
Returns: Beta value (typically 0-2, can be higher/lower)
Interpretation:
Beta = 1: Asset moves in sync with the market
Beta > 1: Asset more volatile than market
Beta < 1: Asset less volatile than market
Beta < 0: Asset moves inversely to the market
💡 Usage Examples
Example 1: Multi-Indicator Consensus
pinescriptimport unicorpusstocks/MyIndicatorLibrary/1 as lib
// Combine multiple indicators
signal1 = lib.BBPct(20, 2.0, close)
signal2 = lib.RSI(14, close, 5)
signal3 = lib.TRAMA(close, 50)
// Consensus signal: At least 2 of 3 must agree
consensus = (signal1 + signal2 + signal3)
strongBuy = consensus >= 2
strongSell = consensus <= -2
Example 2: Correlation-Filtered Trading
pinescriptimport unicorpusstocks/MyIndicatorLibrary/1 as lib
// Only trade when strong correlation with market exists
spy = request.security("SPY", timeframe.period, close)
correlation = lib.MCorrelation(close, spy)
trendSignal = lib.NorosTrendRibbonEMA(50, close)
// Only bullish signals with positive correlation
tradeBuy = trendSignal == 1 and correlation > 0.5
tradeSell = trendSignal == -1 and correlation > 0.5
Example 3: Beta-Adjusted Position Sizing
pinescriptimport unicorpusstocks/MyIndicatorLibrary/1 as lib
spy = request.security("SPY", timeframe.period, close)
beta = lib.assetBeta(close, spy)
// Adjust position size based on Beta
basePositionSize = 100
adjustedSize = basePositionSize / beta // Less size with high Beta
⚙️ Technical Details
Normalization Standard
Bullish: 1
Bearish: -1
Neutral: 0 (only for selected indicators)
Advantages of Normalization
Simple Aggregation: Signals can be added/averaged
Consistent Interpretation: No confusion about different scales
Strategy Development: Simplified logic for backtesting
Combinability: Seamlessly mix different indicator types
Performance Considerations
All functions are optimized for Pine Script v5
Proper use of var for state management
Efficient array operations where needed
Minimal recursive calls
📋 License
This code is subject to the Mozilla Public License 2.0. More details at: mozilla.org
🎯 Use Cases
This library is ideal for:
Quantitative Traders: Systematic strategy development with unified signals
Multi-Timeframe Analysis: Consensus across different timeframes
Portfolio Managers: Beta and correlation analysis for diversification
Algo Traders: Machine learning with standardized features
Retail Traders: Simplified signal interpretation without deep technical knowledge
🔧 Installation
pinescriptimport unicorpusstocks/MyIndicatorLibrary/1
Then use the functions with your chosen alias:
pinescriptlib.BBPct(20, 2.0, close)
lib.RSI(14, close, 5)
// etc.
⚠️ Important Notes
All indicators are lagging, as is typical for trend-following indicators
Signals should be combined with additional analysis (volume, support/resistance, etc.)
Backtesting is recommended before starting live trading with these signals
Different assets and timeframes may require different parameter optimizations
This library provides a solid foundation for professional trading system design with the flexibility to develop your own complex strategies while abstracting away technical complexity.
RSI MTF 15m + 1h (Oriol)//@version=5
indicator("RSI MTF 15m + 1h (Oriol)", overlay = false, timeframe = "", timeframe_gaps = true)
// ─── PARÀMETRES ─────────────────────────────────────────────
rsiLength = input.int(14, "Període RSI")
src = input.source(close, "Font de preu")
tfFast = input.timeframe("15", "Timeframe ràpid (RSI 15m)")
tfSlow = input.timeframe("60", "Timeframe lent (RSI 1h)")
showSignals = input.bool(true, "Mostrar senyals LONG/SHORT")
// ─── RSI MULTITIMEFRAME ────────────────────────────────────
// RSI del timeframe ràpid (per defecte 15m)
src_fast = request.security(syminfo.tickerid, tfFast, src)
rsi_fast = ta.rsi(src_fast, rsiLength)
// RSI del timeframe lent (per defecte 1h)
src_slow = request.security(syminfo.tickerid, tfSlow, src)
rsi_slow = ta.rsi(src_slow, rsiLength)
// ─── DIBUIX RSI ─────────────────────────────────────────────
plot(rsi_fast, title = "RSI ràpid (15m)", color = color.new(color.aqua, 0), linewidth = 2)
plot(rsi_slow, title = "RSI lent (1h)", color = color.new(color.orange, 0), linewidth = 2)
hline(70, "Sobrecomprat", color = color.new(color.red, 70), linestyle = hline.style_dashed)
hline(30, "Sobrevenut", color = color.new(color.lime, 70), linestyle = hline.style_dashed)
hline(50, "Mitja", color = color.new(color.gray, 80))
// ─── CONDICIONS D’EXEMPLE ───────────────────────────────────
// LONG: RSI 1h < 40 i RSI 15m creua cap amunt 30
// SHORT: RSI 1h > 60 i RSI 15m creua cap avall 70
longCond = (rsi_slow < 40) and ta.crossover(rsi_fast, 30)
shortCond = (rsi_slow > 60) and ta.crossunder(rsi_fast, 70)
// ─── SENYALS (SENSE SCOPE LOCAL) ────────────────────────────
plotshape(showSignals and longCond,
title = "Possible LONG",
style = shape.triangleup,
location = location.bottom,
color = color.new(color.lime, 0),
size = size.small,
text = "LONG")
plotshape(showSignals and shortCond,
title = "Possible SHORT",
style = shape.triangledown,
location = location.top,
color = color.new(color.red, 0),
size = size.small,
text = "SHORT")
// ─── ALERTES ────────────────────────────────────────────────
alertcondition(longCond, title = "Senyals LONG RSI 15m+1h",
message = "Condició LONG RSI 15m + 1h complerta")
alertcondition(shortCond, title = "Senyals SHORT RSI 15m+1h",
message = "Condició SHORT RSI 15m + 1h complerta")
RSI (Custom Background) KDMThis code is a custom version of the RSI (Relative Strength Index) indicator.
Its main purpose is to compare recent price gains and losses to determine whether the market is in an overbought or oversold condition.
30–50 zone (purple tone): represents a weak or pullback area.
50–70 zone (green tone): represents a strengthening or dominant buying area.
Additionally, when the RSI line moves above 70, a green gradient background highlights the overbought region; when it moves below 30, a red gradient background emphasizes the oversold region.
Like the classic RSI, this version is a momentum indicator showing whether the price is losing or gaining strength.
The key difference is the colored background, which allows you to visually identify the RSI zones (e.g., 30–50 weak, 50–70 strong) much faster and more clearly.






















