Biddles OI Weighted Average PriceAhoy!
This script calculates Open Interested Weighted Average Price for the following lookback periods:
- 7, 30, 60
e.g. On the 1D chart, you will see OIWAP for the past 7, 30, and 60 days. It works on any timeframe though.
It works with any ticker that TV's OI indicator supports, and has ticker override if you are looking at an exchange that's unsupported, but for an asset that is.
e.g. If you're looking at Bybit's BTCUSDT.P which is unsupported- you can override to get OI data from Binance's BTCUSDT.P which is supported.
=====
Open-Sourced + Crowd Sourcing Goals
=====
I am open sourcing this in hopes we can work together to find interesting signal/observation, and make the script better.
The only way I could think of to calculate the OIWAP for the lookback periods was to manually factor in each period in the formula.
e.g. For the 60-period lookback, it's manually taking price and OI for each individual period.
I am also hoping other folks will make interesting observations.
With the few hours I've spent thus far, they seem to operate much like MA bands, with crossovers having similar implications.
But I feel like there are many other observations left unnoticed!
If you find any, hmu on twitter: @thalamu_
=====
Interesting Calculations in the Script, but not Plotted on the Chart
=====
There are calculations for up to 60 days of OIWAP taking change in OI rather than just OI.
There's one set for absolute value of change in OI, and one set for raw change in OI.
I didn't notice anything spectacularly interesting - but perhaps you will if you tinker with it!
=====
Find something cool? Have an improvement?
=====
Hmu on twitter: @thalamu_
在腳本中搜尋"股价站上60月线"
RSI Candle Advanced V2RSI Advanced
As the period value is longer than 14, the RSI value sticks to the value of 50 and becomes useless.
Also, when the period value is less than 14, it moves excessively, so it is difficult for us to see the movement of the RSI .
So, using the period value and the RSI value as variables, I tried to make it easier to identify the RSI value through a new function expression.
This is how RSI Advanced was developed.
Period below 14 reduce the volatility of RSI , and period above 14 increase the volatility of RSI, allowing overbought and oversold zones to work properly and give you a better view of the trend.
By applying the custom algorithm so that the 'RSI Advanced' with period on a 5-minute timeframe has the same value as the 'original RSI' with period on a 60-minute timeframe.
As another example, an 'RSI Advanced' with a period in a 60-minute time frame has the same value as an 'original RSI' with a period in a 240-minute time frame.
Compare the difference in the RSI with a period value of 200 in the snapshot.
------------------------------------------------------------------------------------------
RSI Candlestick
RSI derives its value using only the closing price as a variable.
I solved the RSI equation in reverse and tried to include the high and low prices of candlesticks in the equation.
As a result, 'if the high or low was the closing price, the value of RSI would be like this' was implemented.
Just like when a candle comes down after setting a high price, an upper tail is formed when RSI Candle goes down after setting a high price!!
In divergence, we had to look only at the relationship between closing prices, but if we use RSI candles, we can find divergences in highs and highs, and lows and lows.
Existing indicators could not express "gap", but Version 2 made it possible to express "gap"!!!!!!
RSI can be displayed as candlesticks, bars and lines
Then enjoy my RSI!
----------------------------------------------------------------------------------------
RSI Advanced
기간값이 14보다 길어질수록 RSI값은 50값에 달라붙게 되어서 쓸모가 없어집니다.
또 기간값이 14보다 줄어들수록 과도하게 움직여서 우리는 RSI의 움직임을 보기가 힘듭니다.
그래서 기간 값과 RSI 값을 변수로 사용하여 새로운 함수 식을 통해 RSI 값을 식별하기 편하도록 해보았습니다.
이렇게 RSI Advanced가 개발되었습니다.
기간값이 14보다 낮으면 rsi의 변동폭이 줄어들고, 기간값이 14보다 크면 변동폭이 넓어져 과매수 및 과매도 영역이 제대로 작동하여 추세를 더 잘 볼 수 있습니다.
또한 저는 5분 타임프레임의 기간값이 168(=14*12)인 RSI가 주기 값이 14인 60분 타임프레임의 RSI와 동일한 값을 갖도록 적절한 함수 표현식을 적용하여 RSI를 변경했습니다.
다른 예로, 15분 시간 프레임에서 기간값이 56(=14*4)인 RSI는 60분 시간 프레임의 기간값이 14인 RSI와 동일한 값을 갖습니다.
기간값이 200인 RSI의 차이를 스냅샷에서 비교해보십시오.
-----------------------------
RSI Candlestick
RSI는 종가만을 변수로 사용하여 값을 도출해냅니다.
저는 RSI 식을 역으로 풀어내어서 캔들스틱의 고가와 저가, 시가를 식에 포함시켜보았습니다.
결과적으로, '만약 고가나 저가가 종가였다면 RSI의 값이 이럴것이다'를 구현해내었습니다.
캔들이 고가를 찍고 내려오면 윗꼬리가 생기듯 RSI Candle에서도 고가를 찍고 내려오면 윗꼬리가 생기는겁니다!!
다이버전스 또한 원래는 종가끼리의 관계만 봐야했지만 RSI 캔들을 이용한다면 고가와 고가, 저가와 저가에서도 다이버전스를 발견할 수 있습니다.
기존의 지표는 "갭"을 표현하지 못했지만 Version 2 에서는 "갭"을 표현할 수 있게 만들었습니다!!!!!!
그럼 잘 사용해주십시오!!!
PIVOT STRATEGY [INDIAN MARKET TIMING]
A Back-tested Profitable Strategy for Free!!
A PIVOT INTRADAY STRATEGY for 5 minute Time-Frame , that also explains the time condition for Indian Markets
The Timing can be changed to fit other markets, scroll down to "TIME CONDITION" to know more.
The commission is also included in the strategy .
The basic idea is when ,
1) Price crosses above ema1 ,indicated by pivot highest line in green color .
2) Price crosses below ema1 ,indicated by pivot lowest line in red color .
3) Candle high crosses above pivot highest , is the Long condition .
4) Candle low crosses below pivot lowest , is the Short condition .
5) Maximum Risk per trade for the intraday trade can be changed .
6) Default_qty_size is set to 60 contracts , which can be changed under settings → properties → order size .
7) ATR is used for trailing after entry, as mentioned in the inputs below.
// ═════════════════════════//
// ————————> INPUTS <————————— //
// ═════════════════════════//
Leftbars —————> Length of pivot highs and lows
Rightbars —————> Length of pivot highs and lows
Price Cross Ema —————> Added condition
ATR LONG —————> ATR stoploss trail for Long positions
ATR SHORT —————> ATR stoploss trail for Short positions
RISK —————> Maximum Risk per trade for the day
The strategy was back-tested on RELIANCE ,the input values and the results are mentioned under "BACKTEST RESULTS" below .
// ═════════════════════════ //
// ————————> PROPERTIES<——————— //
// ═════════════════════════ //
Default_qty_size ————> 60 contracts , which can be changed under settings
↓
properties
↓
order size
// ═══════════════════════════════//
// ————————> TIME CONDITION <————————— //
// ═══════════════════════════════//
The time can be changed in the script , Add it → click on ' { } ' → Pine editor→ making it a copy [right top corner} → Edit the line 25 .
The Indian Markets open at 9:15am and closes at 3:30pm .
The 'time_cond' specifies the time at which Entries should happen .
"Close All" function closes all the trades at 3pm, at the open of the next candle.
To change the time to close all trades , Go to Pine Editor → Edit the line 103 .
All open trades get closed at 3pm , because some brokers don't allow you to place fresh intraday orders after 3pm .
NSE:RELIANCE
// ═══════════════════════════════════════════════ //
// ————————> BACKTEST RESULTS ( 128 CLOSED TRADES )<————————— //
// ═══════════════════════════════════════════════ //
INPUTS can be changed for better back-test results.
The strategy applied to NIFTY ( 5 min Time-Frame and contract size 60 ) gives us 60% profitability y , as shown below
It was tested for a period a 6 months with a Profit Factor of 1.45 ,net Profit of 21,500Rs profit .
Sharpe Ratio : 0.311
Sortino Ratio : 0.727
The graph has a Linear Curve with consistent profits .
The INPUTS are as follows,
1) Leftbars ————————> 3
2) Rightbars ————————> 5
3) Price Cross Ema ——————> 150
4) ATR LONG ————————> 2.7
5) ATR SHORT ———————> 2.9
6) RISK —————————> 2500
7) Default qty size ——————> 60
NSE:RELIANCE
Save it to favorites.
Apply it to your charts Now !!
↓
FOLLOW US FOR MORE !
Thank me later ;)
RSI Trend Heatmap in Multi TimeframesRSI Trend Heatmap in Multi Timeframes
Description
Sometimes you want to look at the RSI Trend across multiple time frames.
You have to waste time browsing through them.
So we've put together every time frame you want to see in one indicator.
We have 10 layers of RSI Trend heatmap available for you.
You can set the timeframe as you want on the Settings page.
Description of Parameter RSI Setting ** You can change it by setting.
RSI Trend Length : (Default 50)
Source : (Default close)
RSI Sideways Length : (Default 2 = RSI between 48 .. 52)
Description of Parameter RSI Timeframe ** You can change it by setting.
""=None,
"M"=1Month, "2W"=2Weeks, "W"=1Week,
"3D"=3Days, "2D"=2Days, "D"=1Day,
"720"=12Hours, "480"=4Hours, "240"=4Hours, "180"=3Hours, "120"=2Hours,
"60"=60Minutes, "30"=30Minutes, "15"=15Minutes, "5"=5Minutes, "1"=1Minute
Default Configurate of RSI Timeframe (for a time frame of 1 hour to 1 day)
"W"= Timeframe 1 month shown in line 90-100 --> Represent Long Trend of RSI
---------------------------------------
"D2"= Timeframe 2 days shown in line 70-80 --> Represent Trend of RSI
"D"= Timeframe 1 day shown in line 60-70 --> Represent Trend of RSI
---------------------------------------
"240"= Timeframe 3 hours shown in line 40-50 --> Represent Signal Up/Signal Down/Divergence of RSI
"120"= Timeframe 2 hours shown in line 30-40 --> Represent Signal Up/Signal Down/Divergence of RSI
"60"= Timeframe 1 hour shown in line 20-30 --> Represent Signal Up/Signal Down/Divergence of RSI
"30"= Timeframe 30 minutes shown in line 10-20 --> Represent Signal Up/Signal Down/Divergence of RSI
"15"= Timeframe 15 minutes shown in line 00-10 --> Represent Signal Up/Signal Down/Divergence of RSI
Description of Colors
Dark Bule = Extreme Uptrend / Overbought / Bull Market (RSI > 67)
Light Bule = Uptrend (RSI between 50-52 .. 67)
Yellow = Sideways Trend / Trend Reversal (RSI between 48 .. 52) ** You can change it by setting.
Light Red = Downtrend (RSI between 33 .. 48-50)
Dark Red = Extreme Downtrend / Oversold / Bear Market (RSI < 33)
How to use
1. You must first know what the main trend of the RSI is (look at the 60-80 line). If it is red, it is a downtrend. and if it's blue shows that it is an uptrend
2. Throughout the period of the main trend There will always be a reversal of the sub-trend. (Can see from the 0-50 line), but eventually will return to follow the main trend.
3. Unless the sub trend persists for a long time until the main trend changes.
Runners & Laggers (scanner)Firstly, seems to me this may only work with crypto but I know nothing about the other sectors so i could be wrong. I was trying to think up a good way to find moving coins(other than by volume bc theres holes in the results when using it this way). Thought this was an interesting concept so decided to publish it as I've seen no others like it (though i did not extensively search for it. We need to start with a little Tradingview(TV) common knowledge. When there is no update of trades/volume in a candle TV does not print the candle. So when looking at (let's say) a 1 second chart, if the coin being observed by the user has no update from a trade in the time of that 1 sec candle it is skipped over. This means that a coin with a ton of volume might fill an entire 60 seconds with 60 candles and conversely with a low volume coin there could be as little as 0 1-second candles. BUT even for normally low volume coins, when a pump is beginning with the coin it could literally go from 0 1-second candles within a minute to 60 1-second candles within the next minute. ***NOTE: This DOES NOT show ANY information if the coin is going up or down but rather that a LOT more trading volume is occurring than normal.*** What this script does is scans (via request.security feature) up to 40 coins at a time and counts how many candles are printed within a user set timespan calculated in minute. 1 candle print per incremented timeframe that the chart is on. ie. if the chart is a 1 min chart it counts how many 1 min candles are printed. So, (as is in the captured image for the script) if you wanted to count how many 5 second candles are printed for each coin in 1 min then you would have to put the charts timeframe on 5sec and the setting titled 'Window of TIME(in minutes) to count bars' as 1.0 (which bc it's in minutes 1.0m = 60sec and bc 60s / 5s = 12 there would be 12 possible values that each coin can be at depending on how many bars are counted within that 1min/60sec. *** I will update to show an image of what I'm talking about here. Now, the exchange I'm scanning here is Kucoin's Margin Coins. There are 170 something coins total but I removed a few i didn't care for to make it a round 40 coins per set (there being 4 sets of 40 coins total=160 coins being scanned). To scan all 4 sets the indicator must be added 4 times to the chart and a different 'set' selected for each iteration of the script on the chart. Free users can only scan 3 at the most. All others can scan all 4 sets. In the script you can change the exchange and coins as necessary. If there done so and there are not 40 coins total just put '' '' in the extra coins spots that are not filled and the script will skip over these blankly filled spots. The suffix (traded pair) for the tickerID on all Kucoin's Margin Coin's is USDT so that's what i have inputted in the main function on line 46 (will need to be changed if that differs from the coins you want to scan. Next in the line of settings is 'Window of TIME(in minutes) to count bars' which has already been discussed. Following that is the setting "Table Shows" which the results are all in a table and the table will present the coins that have either "Passed" or "Failed" depending on which you choose. The next setting determines what passes or fails. If there are 12 possible rows for the coins to be in (as described above) then this setting is the "Pass/Fail Cutoff" level. So if you want to show all the coins that are in rows 11 and 12 (as in the image at top) then 11 should be selected here. At this point you will see all the coins that have a lot of volume in them. Finding coin names in the table that are usually not with a ton of volume will present your present movers. NOTE: coins like BTC and ETH will almost always be in these levels so it does not indicate anything different from the norm of these coins. Last setting is the ability to show the table on the main window or not. Hope you enjoy and find use in it. BTW this screener format is the same as the others I have published. If you like, check those out too. If you find difficulty using then refer to those as well as they have additional info in them on how to use the scanner and its format. Lastly, in the script is the ability to print the plots and labels but I commented them out bc its really just a jumbled mess. In the commented out sections there is a Random Color Function (provided by @hewhomustnotbenamed which was developed on the basis of Function-HSL-color by @RicardoSantos. All right, peace brothers....and sisters.
**** Also, I see how the "levels" could be confusing so I will put them into a % format soon (probably not today) so that the "Pass/Fail Cutoff" can be in % format so that if "passed" is chosen and 50% is chosen (in the new setting that will be changed) then it'll show you all the coins that have more than 50% of the bars printed within the time window chosen. Goodluck in all your trading adventures. ChasinAlts out.
P/L panelThis is not a indicator or strategy.
I thought of having a table showing running profit or loss on chart from a specific price.
I tried to put the same in code and ended up with this code.
This is a table showing the running profit or loss from a manually specified price and quantity.
when you add the code, This table asks us to input the entry price and quantity.
It will calculate the running profit or loss with respect to running price and puts that in the table.
We will have to input two things.
1.) entry price: the price at which a position(long/short) is taken.
2.) Quantity: A +value need to be entered for Long position and -value for short position.
code detects whether its a long position or short position based on the quantity info.
for example if a LONG position is taken at a price 60 of 100 quantity,
then in price we need to enter 60
and in quantity 100 (+ve value)
for SHORT position at a price of 60 of 100 quantity,
in price we need to enter 60
and in quantity -100 (-ve value)
once the table is added to the chart.
Just double click on the table, it will open the settings tab and we can provide new inputs price/quantity/position.
positioning of table is optional and all possible positioning options are provided.
Advise further improvements required if any in this code.
This piece of code can be used along with any indicator.
For which we may need to use valuewhen() additionally.
Try it yourself and ping me if required.
RSI Candle with Advanced RSI fomulaRSI Advanced
As the period value is longer than 14, the RSI value sticks to the value of 50 and becomes useless.
Also, when the period value is less than 14, it moves excessively, so it is difficult for us to see the movement of the RSI.
So, using the period value and the RSI value as variables, I tried to make it easier to identify the RSI value through a new function expression.
This is how RSI Advanced was developed.
Period values below 14 reduce the volatility of RSI, and period values greater than 14 allow wider fluctuations, allowing overbought and oversold zones to work properly and give you a better view of the trend.
I also changed the RSI by applying the appropriate function expression so that the RSI with a period value of 168 (=14*12) on a 5 minute timeframe has the same value as the RSI on a 60 minute timeframe with a period value of 14.
As another example, an RSI with a period value of 56 (=14*4) in a 15-minute time frame has the same value as an RSI with a period value of 14 in a 60-minute time frame.
Compare the difference in the RSI with a period value of 200 in the snapshot.
------------------------------------------------------------------------------------------
RSI Candlestick
RSI derives its value using only the closing price as a variable. I solved the RSI equation in reverse and tried to include the high and low prices of candlesticks in the equation.
As a result, 'if the high or low was the closing price, the value of RSI would be like this' was implemented. Just like when a candle comes down after setting a high price, an upper tail is formed when RSI Candle goes down after setting a high price!!
In divergence, we had to look only at the relationship between closing prices, but if we use RSI candles, we can find divergences in highs and highs, and lows and lows.
Then enjoy my RSI!
----------------------------------------------------------------------------------------
RSI Advanced
기간값이 14보다 길어질수록 RSI값은 50값에 달라붙게되어서 쓸모가 없어집니다.
또 기간값이 14보다 줄어들수록 과도하게 움직여서 우리는 RSI의 움직임을 보기가 힘듭니다.
그래서 기간 값과 RSI 값을 변수로 사용하여 새로운 함수 식을 통해 RSI 값을 식별하기 편하도록 해보았습니다.
이렇게 RSI Advanced가 개발되었습니다.
기간값이 14보다 낮으면 rsi의 변동폭이 줄어들고, 기간값이 14보다 크면 변동폭이 넓어져 과매수 및 과매도 영역이 제대로 작동하여 추세를 더 잘 볼 수 있습니다.
또한 저는 5분 타임프레임의 기간값이 168(=14*12)인 RSI가 주기 값이 14인 60분 타임프레임의 RSI와 동일한 값을 갖도록 적절한 함수 표현식을 적용하여 RSI를 변경했습니다.
다른 예로, 15분 시간 프레임에서 기간값이 56(=14*4)인 RSI는 60분 시간 프레임의 기간값이 14인 RSI와 동일한 값을 갖습니다.
기간값이 200인 RSI의 차이를 스냅샷에서 비교해보십시오.
-----------------------------
RSI Candlestick
RSI는 종가만을 변수로 사용하여 값을 도출해냅니다. 저는 RSI 식을 역으로 풀어내어서 캔들스틱의 고가와 저가를 식에 포함시켜보았습니다.
결과적으로, '만약 고가나 저가가 종가였다면 RSI의 값이 이럴것이다'를 구현해내었습니다. 캔들이 고가를 찍고 내려오면 윗꼬리가 생기듯 RSI Candle에서도 고가를 찍고 내려오면 윗꼬리가 생기는겁니다!!
다이버전스 또한 원래는 종가끼리의 관계만 봐야했지만 RSI 캔들을 이용한다면 고가와 고가, 저가와 저가에서도 다이버전스를 발견할 수 있습니다.
그럼 잘 사용해주십시오!!!
Modified RSI Multi-Time Frame (HM)Effective RSI with Multi-Timeframe with Hilema - Milega(HM) concept (HM=WMA -EMA). RSI Script is included with WMA and EMA band for RSI1 and it works very simple
i) When the RSI band turns to Green its a Buy signal. Normally whenever Bearish strength weakens and move towards the Bullish area, the WMA and EMA cross each other and that tends to provide a possible trend change. A trade at crossover normally provides a very good trading oppertunity. One can combine with some other Price action if needed for double confirmation.
ii)When RSI band turns to RED its a Sell signal. As explained in the point 1 , its a vice-versa where a crossover of WMA and EMA is perfect entry to get a good swing trade. Once can combine this tool with Price action for double confirmation.
iii) Using the Multi timeframe user could able to find the trend at higher timeframe to take double confirm on the trend strength and take a perfect oppertunity to take the trade.
By default, script uses the RSI with length 14, WMA 21 and EMA 3 which perfectly working for Index in NSE. Please change as per your requirement.
Apart from the above band, RSI is not have the different levels like 20/ 40 /50/60/80
Multi-timeframes currently set as
RSI1 - Same as Chart
RSI2 - 15 Min
RSI3 - 60 Min
RSI4 - Daily
Script has enabled the option to change the values for these timeframes as per the user requirement.
These ranges can be interpreted and acts as a probable swing points based on the trend and momentum.
40-60 - Neutral Range or Sideways
20 - 60 Bearish range
40 - 70 - Bullish range
Below 20 -- Over Sold Zone
Above 80 - over Bought zone
Also, the crossovers of the WMA and EMA on the RSI gives a very good momentum towards that trend.
[kai]Futility RatioAn indicator that measures movement inefficiency
Inefficient movement, that is, the range market becomes a high number, the limit is reached at about 60 and a trend occurs
When the range breaks and a trend occurs, the inefficiency drops to about 40 and many trends end.
The full-scale trend goes down further and goes down to about 25, which is evaluated as an efficient movement, the limit is reached and the trend ends.
As for how to use this Inge, the direction of the trend needs to be considered in other ways.
Create a position when you reach 60
Position closed or contrarian at 40 or 25
I assume the usage
動きの非効率性を測定するインジケーターです
非効率な動きをするつまりレンジ相場は高い数字になって、60程度で限界が訪れてトレンドが発生します
レンジがブレイクしトレンドが発生すると40程度まで非効率性は下がりって多くのトレンドは終了します
本格的なトレンドはさらに下がっていって効率的な動きと評価される25程度まで下がって限界が訪れてトレンドが終了します
このインジの使い方はトレンドの方向は他の方法で考える必要がありますが
60まで上がったときにポジション作成
40又は25でポジションクローズ又は逆張り
という使い方を想定しています
Waindrops [Makit0]█ OVERALL
Plot waindrops (custom volume profiles) on user defined periods, for each period you get high and low, it slices each period in half to get independent vwap, volume profile and the volume traded per price at each half.
It works on intraday charts only, up to 720m (12H). It can plot balanced or unbalanced waindrops, and volume profiles up to 24H sessions.
As example you can setup unbalanced periods to get independent volume profiles for the overnight and cash sessions on the futures market, or 24H periods to get the full session volume profile of EURUSD
The purpose of this indicator is twofold:
1 — from a Chartist point of view, to have an indicator which displays the volume in a more readable way
2 — from a Pine Coder point of view, to have an example of use for two very powerful tools on Pine Script:
• the recently updated drawing limit to 500 (from 50)
• the recently ability to use drawings arrays (lines and labels)
If you are new to Pine Script and you are learning how to code, I hope you read all the code and comments on this indicator, all is designed for you,
the variables and functions names, the sometimes too big explanations, the overall structure of the code, all is intended as an example on how to code
in Pine Script a specific indicator from a very good specification in form of white paper
If you wanna learn Pine Script form scratch just start HERE
In case you have any kind of problem with Pine Script please use some of the awesome resources at our disposal: USRMAN , REFMAN , AWESOMENESS , MAGIC
█ FEATURES
Waindrops are a different way of seeing the volume and price plotted in a chart, its a volume profile indicator where you can see the volume of each price level
plotted as a vertical histogram for each half of a custom period. By default the period is 60 so it plots an independent volume profile each 30m
You can think of each waindrop as an user defined candlestick or bar with four key values:
• high of the period
• low of the period
• left vwap (volume weighted average price of the first half period)
• right vwap (volume weighted average price of the second half period)
The waindrop can have 3 different colors (configurable by the user):
• GREEN: when the right vwap is higher than the left vwap (bullish sentiment )
• RED: when the right vwap is lower than the left vwap (bearish sentiment )
• BLUE: when the right vwap is equal than the left vwap ( neutral sentiment )
KEY FEATURES
• Help menu
• Custom periods
• Central bars
• Left/Right VWAPs
• Custom central bars and vwaps: color and pixels
• Highly configurable volume histogram: execution window, ticks, pixels, color, update frequency and fine tuning the neutral meaning
• Volume labels with custom size and color
• Tracking price dot to be able to see the current price when you hide your default candlesticks or bars
█ SETTINGS
Click here or set any impar period to see the HELP INFO : show the HELP INFO, if it is activated the indicator will not plot
PERIOD SIZE (max 2880 min) : waindrop size in minutes, default 60, max 2880 to allow the first half of a 48H period as a full session volume profile
BARS : show the central and vwap bars, default true
Central bars : show the central bars, default true
VWAP bars : show the left and right vwap bars, default true
Bars pixels : width of the bars in pixels, default 2
Bars color mode : bars color behavior
• BARS : gets the color from the 'Bars color' option on the settings panel
• HISTOGRAM : gets the color from the Bearish/Bullish/Neutral Histogram color options from the settings panel
Bars color : color for the central and vwap bars, default white
HISTOGRAM show the volume histogram, default true
Execution window (x24H) : last 24H periods where the volume funcionality will be plotted, default 5
Ticks per bar (max 50) : width in ticks of each histogram bar, default 2
Updates per period : number of times the histogram will update
• ONE : update at the last bar of the period
• TWO : update at the last bar of each half period
• FOUR : slice the period in 4 quarters and updates at the last bar of each of them
• EACH BAR : updates at the close of each bar
Pixels per bar : width in pixels of each histogram bar, default 4
Neutral Treshold (ticks) : delta in ticks between left and right vwaps to identify a waindrop as neutral, default 0
Bearish Histogram color : histogram color when right vwap is lower than left vwap, default red
Bullish Histogram color : histogram color when right vwap is higher than left vwap, default green
Neutral Histogram color : histogram color when the delta between right and left vwaps is equal or lower than the Neutral treshold, default blue
VOLUME LABELS : show volume labels
Volume labels color : color for the volume labels, default white
Volume Labels size : text size for the volume labels, choose between AUTO, TINY, SMALL, NORMAL or LARGE, default TINY
TRACK PRICE : show a yellow ball tracking the last price, default true
█ LIMITS
This indicator only works on intraday charts (minutes only) up to 12H (720m), the lower chart timeframe you can use is 1m
This indicator needs price, time and volume to work, it will not work on an index (there is no volume), the execution will not be allowed
The histogram (volume profile) can be plotted on 24H sessions as limit but you can plot several 24H sessions
█ ERRORS AND PERFORMANCE
Depending on the choosed settings, the script performance will be highly affected and it will experience errors
Two of the more common errors it can throw are:
• Calculation takes too long to execute
• Loop takes too long
The indicator performance is highly related to the underlying volatility (tick wise), the script takes each candlestick or bar and for each tick in it stores the price and volume, if the ticker in your chart has thousands and thousands of ticks per bar the indicator will throw an error for sure, it can not calculate in time such amount of ticks.
What all of that means? Simply put, this will throw error on the BITCOIN pair BTCUSD (high volatility with tick size 0.01) because it has too many ticks per bar, but lucky you it will work just fine on the futures contract BTC1! (tick size 5) because it has a lot less ticks per bar
There are some options you can fine tune to boost the script performance, the more demanding option in terms of resources consumption is Updates per period , by default is maxed out so lowering this setting will improve the performance in a high way.
If you wanna know more about how to improve the script performance, read the HELP INFO accessible from the settings panel
█ HOW-TO SETUP
The basic parameters to adjust are Period size , Ticks per bar and Pixels per bar
• Period size is the main setting, defines the waindrop size, to get a better looking histogram set bigger period and smaller chart timeframe
• Ticks per bar is the tricky one, adjust it differently for each underlying (ticker) volatility wise, for some you will need a low value, for others a high one.
To get a more accurate histogram set it as lower as you can (min value is 1)
• Pixels per bar allows you to adjust the width of each histogram bar, with it you can adjust the blank space between them or allow overlaping
You must play with these three parameters until you obtain the desired histogram: smoother, sharper, etc...
These are some of the different kind of charts you can setup thru the settings:
• Balanced Waindrops (default): charts with waindrops where the two halfs are of same size.
This is the default chart, just select a period (30m, 60m, 120m, 240m, pick your poison), adjust the histogram ticks and pixels and watch
• Unbalanced Waindrops: chart with waindrops where the two halfs are of different sizes.
Do you trade futures and want to plot a waindrop with the first half for the overnight session and the second half for the cash session? you got it;
just adjust the period to 1860 for any CME ticker (like ES1! for example) adjust the histogram ticks and pixels and watch
• Full Session Volume Profile: chart with waindrops where only the first half plots.
Do you use Volume profile to analize the market? Lucky you, now you can trick this one to plot it, just try a period of 780 on SPY, 2760 on ES1!, or 2880 on EURUSD
remember to adjust the histogram ticks and pixels for each underlying
• Only Bars: charts with only central and vwap bars plotted, simply deactivate the histogram and volume labels
• Only Histogram: charts with only the histogram plotted (volume profile charts), simply deactivate the bars and volume labels
• Only Volume: charts with only the raw volume numbers plotted, simply deactivate the bars and histogram
If you wanna know more about custom full session periods for different asset classes, read the HELP INFO accessible from the settings panel
EXAMPLES
Full Session Volume Profile on MES 5m chart:
Full Session Unbalanced Waindrop on MNQ 2m chart (left side Overnight session, right side Cash Session):
The following examples will have the exact same charts but on four different tickers representing a futures contract, a forex pair, an etf and a stock.
We are doing this to be able to see the different parameters we need for plotting the same kind of chart on different assets
The chart composition is as follows:
• Left side: Volume Labels chart (period 10)
• Upper Right side: Waindrops (period 60)
• Lower Right side: Full Session Volume Profile
The first example will specify the main parameters, the rest of the charts will have only the differences
MES :
• Left: Period size: 10, Bars: uncheck, Histogram: uncheck, Execution window: 1, Ticks per bar: 2, Updates per period: EACH BAR,
Pixels per bar: 4, Volume labels: check, Track price: check
• Upper Right: Period size: 60, Bars: check, Bars color mode: HISTOGRAM, Histogram: check, Execution window: 2, Ticks per bar: 2,
Updates per period: EACH BAR, Pixels per bar: 4, Volume labels: uncheck, Track price: check
• Lower Right: Period size: 2760, Bars: uncheck, Histogram: check, Execution window: 1, Ticks per bar: 1, Updates per period: EACH BAR,
Pixels per bar: 2, Volume labels: uncheck, Track price: check
EURUSD :
• Upper Right: Ticks per bar: 10
• Lower Right: Period size: 2880, Ticks per bar: 1, Pixels per bar: 1
SPY :
• Left: Ticks per bar: 3
• Upper Right: Ticks per bar: 5, Pixels per bar: 3
• Lower Right: Period size: 780, Ticks per bar: 2, Pixels per bar: 2
AAPL :
• Left: Ticks per bar: 2
• Upper Right: Ticks per bar: 6, Pixels per bar: 3
• Lower Right: Period size: 780, Ticks per bar: 1, Pixels per bar: 2
█ THANKS TO
PineCoders for all they do, all the tools and help they provide and their involvement in making a better community
scarf for the idea of coding a waindrops like indicator, I did not know something like that existed at all
All the Pine Coders, Pine Pros and Pine Wizards, people who share their work and knowledge for the sake of it and helping others, I'm very grateful indeed
I'm learning at each step of the way from you all, thanks for this awesome community;
Opensource and shared knowledge: this is the way! (said with canned voice from inside my helmet :D)
█ NOTE
This description was formatted following THIS guidelines
═════════════════════════════════════════════════════════════════════════
I sincerely hope you enjoy reading and using this work as much as I enjoyed developing it :D
GOOD LUCK AND HAPPY TRADING!
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 не получает промежуточные значения в реальном времени.
Чтобы увидеть результат, дождитесь закрытия бара или перейдите на меньший таймфрейм
ICHIMOKU MTFMultiple Time Frame Version of Ichimoku Kinko Hyo Indicator.
Created in 1940's by Goichi Hosoda withe the help of University students in Japan.
Ichimoku is one of the best trend following indicators that works nearly perfect in all markets and time frames.
Ichimoku is originally an built in indicator in Tradingview but there are some problems like:
the indicator hast 5 lines but you can change only 4 parameters in the settings menu of Tradingview Charts which you could only control 3 of the lines effectively. A second problem is that Tradingview preferred to use English titles for the ICHIMOKU lines instead of giving them the most common original Japanese ones. (So I rewrite the indicator)
Kijun Sen (blue line): Also called standard line or base line, this is calculated by averaging the highest high and the lowest low for the past 26 periods.
Tenkan Sen (red line): This is also known as the turning line and is derived by averaging the highest high and the lowest low for the past nine periods.
Chikou Span (Plum line): This is called the lagging line. It is today’s closing price plotted 26 periods behind.
Senkou SpanA (green line): The first Senkou line is calculated by averaging the Tenkan Sen and the Kijun Sen and plotted 26 periods ahead.
Senkou SpanB (purple line):
The second Senkou line is determined by averaging the highest high and the lowest low for the past 52 periods and plotted 26 periods ahead.
PERSONALLY I ADVISE YOU TO USE ICHIMOKU WITH DEAFULT LENGTHS (9,26,26,52,26) IN ORDER FOR STOCK MARKETS AND FOREX MARKETS
FOR CRYPTO YOU'D BETTER USE:
10,30,30,60,30 OR 20,60,60,120,60
THE TRICKY THING IS THAT KEEPING THE 1-3-3-6-3 RATIO CONSTANT IS NECESSARY
Here's a link of my Youtube video explaining ICHIMOKU but unfortunately only in TURKISH:
www.youtube.com
Developed by: Goichi Hosoda
Here's the link to a complete list of all my indicators:
tr.tradingview.com
Ichimoku kullanımı anlattığım detaylı video serisini linkten izleyebilirsiniz:
www.youtube.com
İndikatörü geliştiren: Goichi Hosoda
ICHIMOKU Kinko Hyo by KIVANC fr3762Created in 1940's by Goichi Hosoda withe the help of University students in Japan.
Ichimoku is one of the best trend following indicators that works nearly perfect in all markets and time frames.
Ichimoku is originally an built in indicator in Tradingview but there are some problems like:
the indicator hast 5 lines but you can change only 4 parameters in the settings menu of Tradingview Charts which you could only control 3 of the lines effectively. A second problem is that Tradingview preferred to use English titles for the ICHIMOKU lines instead of giving them the most common original Japanese ones. (So I rewrite the indicator)
Kijun Sen (blue line): Also called standard line or base line, this is calculated by averaging the highest high and the lowest low for the past 26 periods.
Tenkan Sen (red line): This is also known as the turning line and is derived by averaging the highest high and the lowest low for the past nine periods.
Chikou Span (Plum line): This is called the lagging line. It is today’s closing price plotted 26 periods behind.
Senkou SpanA (green line): The first Senkou line is calculated by averaging the Tenkan Sen and the Kijun Sen and plotted 26 periods ahead.
Senkou SpanB (purple line):
The second Senkou line is determined by averaging the highest high and the lowest low for the past 52 periods and plotted 26 periods ahead.
PERSONALLY I ADVISE YOU TO USE ICHIMOKU WITH DEAFULT LENGTHS (9,26,26,52,26) IN ORDER FOR STOCK MARKETS AND FOREX MARKETS
FOR CRYPTO YOU'D BETTER USE:
10,30,30,60,30 OR 20,60,60,120,60
THE TRICKY THING IS THAT KEEPING THE 1-3-3-6-3 RATIO CONSTANT IS NECESSARY
Here's a link of my Youtube video explaining ICHIMOKU but unfortunately only in TURKISH:
www.youtube.com
Developed by: Goichi Hosoda
Money Flow Index + AlertsThis study is based on the work of TV user Beasley Savage ( ) and all credit goes to them.
Changes I've made:
1. Added a visual symbol of an overbought/oversold threshold cross in the form of a red/green circle, respectively. Sometimes it can be hard to see when a cross actually occurs, and if your scaling isn't set up properly you can get misleading visuals. This way removes all doubt. Bear in mind they aren't meant as trading signals, so DO NOT use them as such. Research the MFI if you're unsure, but I use them as an early warning and that particular market/stock is added to my watchlist.
2. Added 60/40 lines as the MFI respects these incredibly well in trends. E.g. in a solid uptrend the MFI won't go below 40, and vice versa. Use the idea of support and resistance levels on the indicator and it'll be a great help. I've coloured the zones. Strong uptrends should stay above 60, strong downtrends should stay below 40. The zone in between 40-60 I've called the transition zone. MFI often stays here in consolidation periods, and in the last leg of a cycle/trend the MFI will often drop into this zone after being above 60 or below 40. This is a great sign that you should get out and start looking to reverse your position. Hopefully it helps to spot divergences as well.
3. Added alerts based on an overbought/oversold cross. Also added an alert for when either condition is triggered, so hopefully that's useful for those struggling with low alert limits. Feel free to change the overbought/oversold levels, the alerts + crossover visual are set to adapt.
Like any indicator, don't use this one alone. It works best paired with indicators/techniques that contradict it. You'll often see a OB/OS cross, and price will continue on it's way for many weeks more. But MFI is a great tool for identifying upcoming trend changes.
Any queries please comment or PM me.
Cheers,
RJR
PT Magic - BTC/ETH Trigger Trend ChangesThis Script shows you how BTC/ETH Percentage change in trends affect coins you trade.
- For ETH market please change BTC in Setting for ETH
What you need it PT Magic:
{
"Name": "BTC1h", // UNIQUE market trend name (to be referenced by your triggers below)
"Platform": "CoinMarketCap", // Platform to grab prices from (Allowed values are: CoinMarketCap, Exchange)
"MaxMarkets": 1, // Number of markets/pairs to analyze sorted by 24h volume
"TrendMinutes": 60 // Number of minutes to build a trend (1440 = 24h, 720 = 12h, 60 = 1h)
},
{
"Name": "ETH1h", // UNIQUE market trend name (to be referenced by your triggers below)
"Platform": "CoinMarketCap", // Platform to grab prices from (Allowed values are: CoinMarketCap, Exchange)
"MaxMarkets": 2, // Number of markets/pairs to analyze sorted by 24h volume
"IgnoredMarkets": "BTC",
"TrendMinutes": 60 // Number of minutes to build a trend (1440 = 24h, 720 = 12h, 60 = 1h)
},
VWAP forex Yesterday Hi/Low update fix This script is an updte fix of an earlier script that stopped functioning when TradingView updated Pine script. This script plots Forex (24 hour session) VWAP, yesterday's high, low, open and close (HLOC),
the day before's HLOC -
Also plots higher timeframe 20 emas
1 minute 5, 15, 60 period 20 ema
5 minute 15, 60 period 20 ema
15 minute 60, 120 , 240 period 20 ema
60 minute 120, 240 period 20 ema
120 minute 240, D period 20 ema
240 minute D period 20 ema
Also signals inside bars (high is less than or equal to the previous bar's high and the low is greater than or equal to the previous low) the : true inside bars have a maroon triangle below the bar as well as a ">" above the bar.
If subsequest bars are inside the last bar before the last true inside bar they also are marked with an ">"
This is probably a slight variation from the way Leaf_West plots the inside bars.
It appears that he marks all bars that are inside the original bar until one a bar has a high or low
outside the original bar. But I would need to see an example on his charts.
The Time Session Glitch and the Fix FX_IDC, COINBASE and BITSTAMP:
The script will correctly default to 1700 hrs to 1700hrs EDT/EST session for FXCM.
Strangely some securities appear to erroneously start their session at 1200 hrs ie. My guess is that they are somehow tied to GMT+0 instead of New York time (GMT+5). See this for yourself by selecting EURUSD using the FXCM exchange (FX:EURUSD) and then EURUSD from the IDC exchange (FX_IDC:EURUSD). The FX-IDC session opening range starts 5 hours before it actually should at 1700 hrs EDT/EST. To correct for this I have implemented an automatic fix (default) and a user selected "5 hour time shift adjust. ment needed on some securities".
There is also a 4 hour time shift button which might be necessary when New York reverts from Eastern Standard Time to Eastern Daylight Time (1 hour difference) in March (and then back again in November). In the default auto adjust mode you will need to select the 1 hour time shift. That is if this glitch still exists at that time.
I have looked at other scripts, other than my own and where the script is available, that need to use information about the opening bar and all have the same time shift issue
COINBASE and BITSTAMP open at 0000 hours GMT. Since I use lines instead of circles or crosses I had to make a small adjustment to plot the lines correctly.
If it needs work let me know.
Jayy
VWAP forex Yesterday Hi/Low switchThis script plots VWAP, yesterday's high, low, open and close (HLOC), the day before's HLOC -
Also plots higher timeframe 20 emas including:
1 minute 5, 15, 60 period 20 ema
5 minute 15, 60 period 20 ema
15 minute 60, 120 , 240 period 20 ema
60 minute 120, 240 period 20 ema
120 minute 240, D period 20 ema
240 minute D period 20 ema
Also signals inside bars (high is less than or equal to the previous
bar's high and the low is greater than or equal to the previous low) the : true inside bars have a maroon triangle below the bar as well as a ">" above the bar.
If subsequent bars are inside the last bar before the last true inside bar they also are marked with an ">"
If you have suggestions let me know.
Jayy
HeikenAshi[1]This is the alert script so you can automate this strategy using AutoView:
Make sure to use
crossing down value 0.9 once per bar (on condition) for this.
For the alert Message if you're using AutoView:
Long GBPUSD
c=order b=short
c=position b=short l=200 t=market
b=long q=0.01 l=200 t=market tp=60 sl=60
Short GBPUSD
c=order b=long
c=position b=long l=200 t=market
b=short q=0.01 l=200 t=market tp=60 sl=60
TLP Swing Chart V2chào cả nhà,
đây là public tlp gan swing
// This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
// Sửa đổi trên code gốc của © meomeo105
// © meomeo105
//@version=5
indicator('TLP Swing Chart V2', shorttitle='TLP Swing V2', overlay=true, max_lines_count=500)
//-----Input-------
customTF = input.timeframe(defval="",title = "Show Other TimeFrame")
showTLP = input.bool(false, 'Show TLP', inline = "TLP1")
colorTLP = input.color(color.aqua, '', inline = "TLP1")
showSTLP = input.bool(true, 'Show TLP Swing', inline = "Swing1")
colorSTLP = input.color(color.aqua, '', inline = "Swing1")
showLabel = input.bool(true, 'Show Label TimeFrame')
lineSTLP = input.string(title="",options= ,defval="(─)", inline = "Swing1")
lineStyleSTLP = lineSTLP == "(┈)" ? line.style_dotted : lineSTLP == "(╌)" ? line.style_dashed : line.style_solid
//IOSB
IOSB = "TLPInOutSideBarSetting"
ISB = input(true,group =IOSB, title="showISB")
colorISB = input.color(color.rgb(250, 171, 0), inline = "ISB")
OSB = input(true,group =IOSB, title="showOSB")
colorOSB = input.color(color.rgb(56, 219, 255), inline = "OSB")
ZoneColor = input(defval = color.new(color.orange, 90),group =IOSB, title = "Background Color")
BorderColor = input(defval = color.new(color.orange, 100),group =IOSB, title = "Border Color")
/////////////////
var aCZ = array.new_float(0)
float highest = high
float lowest = low
if (array.size(aCZ) > 0)
highest := array.get(aCZ, 0)
lowest := array.get(aCZ, 1)
insideBarCondtion = low >= lowest and low <= highest and high >= lowest and high <= highest
if ( insideBarCondtion == true )
array.push(aCZ, high )
array.push(aCZ, low )
if( array.size(aCZ) >= 2 and insideBarCondtion == false )
float maxCZ = array.max(aCZ)
float minCZ = array.min(aCZ)
box.new(bar_index - (array.size(aCZ) / 2) - 1, maxCZ, bar_index - 1, minCZ, bgcolor = ZoneColor, border_color = BorderColor)
array.clear(aCZ)
//////////////////////////Global//////////////////////////
var arrayLineTemp = array.new_line()
// Funtion
f_resInMinutes() =>
_resInMinutes = timeframe.multiplier * (
timeframe.isseconds ? 1. / 60. :
timeframe.isminutes ? 1. :
timeframe.isdaily ? 1440. :
timeframe.isweekly ? 10080. :
timeframe.ismonthly ? 43800. : na)
// Converts a resolution expressed in minutes into a string usable by "security()"
f_resFromMinutes(_minutes) =>
_minutes < 1 ? str.tostring(math.round(_minutes*60)) + "S" :
_minutes < 60 ? str.tostring(math.round(_minutes)) + "m" :
_minutes < 1440 ? str.tostring(math.round(_minutes/60)) + "H" :
_minutes < 10080 ? str.tostring(math.round(math.min(_minutes / 1440, 7))) + "D" :
_minutes < 43800 ? str.tostring(math.round(math.min(_minutes / 10080, 4))) + "W" :
str.tostring(math.round(math.min(_minutes / 43800, 12))) + "M"
f_tfRes(_res,_exp) =>
request.security(syminfo.tickerid,_res,_exp,lookahead=barmerge.lookahead_on)
var label labelError = label.new(bar_index, high, text = "", color = #00000000, textcolor = color.white,textalign = text.align_left)
sendError(_mmessage) =>
label.set_xy(labelError, bar_index + 3, close )
label.set_text(labelError, _mmessage)
var arrayLineChoCh = array.new_line()
var label labelTF = label.new(time, close, text = "",color = color.new(showSTLP ? colorSTLP : colorTLP,95), textcolor = showSTLP ? colorSTLP : colorTLP,xloc = xloc.bar_time, textalign = text.align_left)
//////////////////////////TLP//////////////////////////
var arrayXTLP = array.new_int(5,time)
var arrayYTLP = array.new_float(5,close)
var arrayLineTLP = array.new_line()
int drawLineTLP = 0
_high = high
_low = low
_close = close
_open = open
if(customTF != timeframe.period)
_high := f_tfRes(customTF,high)
_low := f_tfRes(customTF,low)
_close := f_tfRes(customTF,close)
_open := f_tfRes(customTF,open)
highPrev = _high
lowPrev = _low
// drawLineTLP => 2:Tiếp tục 1:Đảo chiều; // Outsidebar 2:Tiếp tục 3:Tiếp tục và Đảo chiều 4 : Đảo chiều 2 lần
drawLineTLP := 0
if(_high > highPrev and _low > lowPrev )
if(array.get(arrayYTLP,0) > array.get(arrayYTLP,1))
if(_high <= high)
array.set(arrayXTLP, 0, time)
array.set(arrayYTLP, 0, _high )
drawLineTLP := 2
else
array.unshift(arrayXTLP,time)
array.unshift(arrayYTLP,_high )
drawLineTLP := 1
else if(_high < highPrev and _low < lowPrev )
if(array.get(arrayYTLP,0) > array.get(arrayYTLP,1))
array.unshift(arrayXTLP,time)
array.unshift(arrayYTLP,_low )
drawLineTLP := 1
else
if(_low >= low)
array.set(arrayXTLP, 0, time)
array.set(arrayYTLP, 0, _low )
drawLineTLP := 2
else if(_high >= highPrev and _low < lowPrev or _high > highPrev and _low <= lowPrev )
if(array.get(arrayYTLP,0) > array.get(arrayYTLP,1))
if(_high >= array.get(arrayYTLP,0) and array.get(arrayYTLP,1) < _low )
if(_high <= high)
array.set(arrayXTLP, 0, time)
array.set(arrayYTLP, 0, _high )
drawLineTLP := 2
else if(_high >= array.get(arrayYTLP,0) and array.get(arrayYTLP,1) > _low )
if(_close < _open)
if(_high <= high)
array.set(arrayXTLP, 0, time)
array.set(arrayYTLP, 0, _high )
array.unshift(arrayXTLP,time)
array.unshift(arrayYTLP,_low )
drawLineTLP := 3
else
array.unshift(arrayXTLP,time)
array.unshift(arrayYTLP,_low )
array.unshift(arrayXTLP,time)
array.unshift(arrayYTLP,_high )
drawLineTLP := 4
else if(array.get(arrayYTLP,0) < array.get(arrayYTLP,1))
if(_low <= array.get(arrayYTLP,0) and _high < array.get(arrayYTLP,1))
if(_low >= low)
array.set(arrayXTLP, 0, time)
array.set(arrayYTLP, 0, _low )
drawLineTLP := 2
else if(_low <= array.get(arrayYTLP,0) and _high > array.get(arrayYTLP,1))
if(_close > _open)
if(_low >= low)
array.set(arrayXTLP, 0, time)
array.set(arrayYTLP, 0, _low )
array.unshift(arrayXTLP,time)
array.unshift(arrayYTLP,_high )
drawLineTLP := 3
else
array.unshift(arrayXTLP,time)
array.unshift(arrayYTLP,_high )
array.unshift(arrayXTLP,time)
array.unshift(arrayYTLP,_low )
drawLineTLP := 4
else if((_high <= highPrev and _low >= lowPrev ))
highPrev := highPrev
lowPrev := lowPrev
if(f_resInMinutes() < f_tfRes(customTF,f_resInMinutes()) and drawLineTLP == 0)
if(array.get(arrayYTLP,0) > array.get(arrayYTLP,1))
if(array.get(arrayYTLP,0) <= high)
array.set(arrayXTLP, 0, time)
drawLineTLP := 2
else
if(array.get(arrayYTLP,0) >= low)
array.set(arrayXTLP, 0, time)
drawLineTLP := 2
if((showSTLP or showTLP) and f_resInMinutes() <= f_tfRes(customTF,f_resInMinutes()))
if(drawLineTLP == 2)
if(array.size(arrayLineTLP) >0)
line.set_xy2(array.get(arrayLineTLP,0),array.get(arrayXTLP,0),array.get(arrayYTLP,0))
else
array.unshift(arrayLineTLP,line.new(array.get(arrayXTLP,1),array.get(arrayYTLP,1),array.get(arrayXTLP,0),array.get(arrayYTLP,0), color = colorTLP,xloc = xloc.bar_time, style = lineStyleSTLP))
else if(drawLineTLP == 1)
array.unshift(arrayLineTLP,line.new(array.get(arrayXTLP,1),array.get(arrayYTLP,1),array.get(arrayXTLP,0),array.get(arrayYTLP,0), color = colorTLP,xloc = xloc.bar_time, style = lineStyleSTLP))
else if(drawLineTLP == 3)
if(array.size(arrayLineTLP) >0)
line.set_xy2(array.get(arrayLineTLP,0),array.get(arrayXTLP,1),array.get(arrayYTLP,1))
else
array.unshift(arrayLineTLP,line.new(array.get(arrayXTLP,2),array.get(arrayYTLP,2),array.get(arrayXTLP,1),array.get(arrayYTLP,1), color = colorTLP,xloc = xloc.bar_time, style = lineStyleSTLP))
array.unshift(arrayLineTLP,line.new(array.get(arrayXTLP,1),array.get(arrayYTLP,1),array.get(arrayXTLP,0),array.get(arrayYTLP,0), color = colorTLP,xloc = xloc.bar_time, style = lineStyleSTLP))
else if(drawLineTLP == 4)
array.unshift(arrayLineTLP,line.new(array.get(arrayXTLP,2),array.get(arrayYTLP,2),array.get(arrayXTLP,1),array.get(arrayYTLP,1), color = colorTLP,xloc = xloc.bar_time, style = lineStyleSTLP))
array.unshift(arrayLineTLP,line.new(array.get(arrayXTLP,1),array.get(arrayYTLP,1),array.get(arrayXTLP,0),array.get(arrayYTLP,0), color = colorTLP,xloc = xloc.bar_time, style = lineStyleSTLP))
//////////////////////////Swing TLP//////////////////////////
var arrayXSTLP = array.new_int(5,time)
var arrayYSTLP = array.new_float(5,close)
var arrayLineSTLP = array.new_line()
int drawLineSTLP = 0
int drawLineSTLP1 = 0
if(showSTLP)
if(math.max(array.get(arrayYSTLP,0),array.get(arrayYSTLP,1)) < math.min(array.get(arrayYTLP,0),array.get(arrayYTLP,1)) or math.min(array.get(arrayYSTLP,0),array.get(arrayYSTLP,1)) > math.max(array.get(arrayYTLP,0),array.get(arrayYTLP,1)))
//Khởi tạo bắt đầu
drawLineSTLP1 := 5
array.set(arrayXSTLP, 0, array.get(arrayXTLP,1))
array.set(arrayYSTLP, 0, array.get(arrayYTLP,1))
array.unshift(arrayXSTLP,array.get(arrayXTLP,0))
array.unshift(arrayYSTLP,array.get(arrayYTLP,0))
// drawLineSTLP kiểm tra điểm 1 => 13:Tiếp tục có sóng hồi // 12|19(reDraw):Tiếp tục không có sóng hồi // 14:Đảo chiều
if(array.get(arrayXTLP,0) == array.get(arrayXTLP,1))
if(array.get(arrayXSTLP,0) >= array.get(arrayXTLP,2) and array.get(arrayYSTLP,0) != array.get(arrayYTLP,1) and ((array.get(arrayYTLP,1) > array.get(arrayYTLP,2) and array.get(arrayYSTLP,0) > array.get(arrayYSTLP,1)) or (array.get(arrayYTLP,1) < array.get(arrayYTLP,2) and array.get(arrayYSTLP,0) < array.get(arrayYSTLP,1))))
drawLineSTLP1 := 12
array.set(arrayXSTLP, 0, array.get(arrayXTLP,1))
array.set(arrayYSTLP, 0, array.get(arrayYTLP,1))
else if(array.get(arrayXSTLP,0) <= array.get(arrayXTLP,2))
if((array.get(arrayYSTLP,0) > array.get(arrayYSTLP,1) and array.get(arrayYTLP,1) < array.get(arrayYSTLP,1)) or (array.get(arrayYSTLP,0) < array.get(arrayYSTLP,1) and array.get(arrayYTLP,1) > array.get(arrayYSTLP,1)))
drawLineSTLP1 := 14
array.unshift(arrayXSTLP,array.get(arrayXTLP,1))
array.unshift(arrayYSTLP,array.get(arrayYTLP,1))
else if((array.get(arrayYSTLP,0) > array.get(arrayYSTLP,1) and array.get(arrayYTLP,1) > array.get(arrayYSTLP,0)) or (array.get(arrayYSTLP,0) < array.get(arrayYSTLP,1) and array.get(arrayYTLP,1) < array.get(arrayYSTLP,0)))
drawLineSTLP1 := 13
_max = math.min(array.get(arrayYSTLP,0),array.get(arrayYSTLP,1))
_min = math.max(array.get(arrayYSTLP,0),array.get(arrayYSTLP,1))
_max_idx = 0
_min_idx = 0
for i = 2 to array.size(arrayXTLP)
if(array.get(arrayXSTLP,0) >= array.get(arrayXTLP,i))
break
if(_min > array.get(arrayYTLP,i))
_min := array.get(arrayYTLP,i)
_min_idx := array.get(arrayXTLP,i)
if(_max < array.get(arrayYTLP,i))
_max := array.get(arrayYTLP,i)
_max_idx := array.get(arrayXTLP,i)
if(array.get(arrayYSTLP,0) > array.get(arrayYSTLP,1))
array.unshift(arrayXSTLP,_min_idx)
array.unshift(arrayYSTLP,_min)
else if(array.get(arrayYSTLP,0) < array.get(arrayYSTLP,1))
array.unshift(arrayXSTLP,_max_idx)
array.unshift(arrayYSTLP,_max)
array.unshift(arrayXSTLP,array.get(arrayXTLP,1))
array.unshift(arrayYSTLP,array.get(arrayYTLP,1))
if(f_resInMinutes() < f_tfRes(customTF,f_resInMinutes()))
if(array.get(arrayYSTLP,0) == array.get(arrayYTLP,1) and array.get(arrayXSTLP,0) != array.get(arrayXTLP,1))
array.set(arrayXSTLP, 0, array.get(arrayXTLP,1))
drawLineSTLP1 := 19
if(f_resInMinutes() <= f_tfRes(customTF,f_resInMinutes()))
if(drawLineSTLP1 == 12 or drawLineSTLP1 == 19)
if(array.size(arrayLineSTLP) >0)
line.set_xy2(array.get(arrayLineSTLP,0),array.get(arrayXSTLP,0),array.get(arrayYSTLP,0))
else
array.unshift(arrayLineSTLP,line.new(array.get(arrayXSTLP,1),array.get(arrayYSTLP,1),array.get(arrayXSTLP,0),array.get(arrayYSTLP,0), color = colorSTLP,xloc = xloc.bar_time))
else if(drawLineSTLP1 == 14)
array.unshift(arrayLineSTLP,line.new(array.get(arrayXSTLP,1),array.get(arrayYSTLP,1),array.get(arrayXSTLP,0),array.get(arrayYSTLP,0), color = colorSTLP,xloc = xloc.bar_time))
else if(drawLineSTLP1 == 13)
array.unshift(arrayLineSTLP,line.new(array.get(arrayXSTLP,2),array.get(arrayYSTLP,2),array.get(arrayXSTLP,1),array.get(arrayYSTLP,1), color = colorSTLP,xloc = xloc.bar_time))
array.unshift(arrayLineSTLP,line.new(array.get(arrayXSTLP,1),array.get(arrayYSTLP,1),array.get(arrayXSTLP,0),array.get(arrayYSTLP,0), color = colorSTLP,xloc = xloc.bar_time))
else if(drawLineSTLP1 == 15)
if(array.size(arrayLineSTLP) >0)
line.set_xy2(array.get(arrayLineSTLP,0),array.get(arrayXSTLP,1),array.get(arrayYSTLP,1))
else
array.unshift(arrayLineSTLP,line.new(array.get(arrayXSTLP,2),array.get(arrayYSTLP,2),array.get(arrayXSTLP,1),array.get(arrayYSTLP,1), color = colorSTLP,xloc = xloc.bar_time))
array.unshift(arrayLineSTLP,line.new(array.get(arrayXSTLP,1),array.get(arrayYSTLP,1),array.get(arrayXSTLP,0),array.get(arrayYSTLP,0), color = colorSTLP,xloc = xloc.bar_time))
// drawLineSTLP kiểm tra điểm 0 => 3:Tiếp tục có sóng hồi // 2|9(reDraw):Tiếp tục không có sóng hồi // 4:Đảo chiều
if(array.get(arrayXSTLP,0) >= array.get(arrayXTLP,1) and array.get(arrayYSTLP,0) != array.get(arrayYTLP,0) and ((array.get(arrayYTLP,0) > array.get(arrayYTLP,1) and array.get(arrayYSTLP,0) > array.get(arrayYSTLP,1)) or (array.get(arrayYTLP,0) < array.get(arrayYTLP,1) and array.get(arrayYSTLP,0) < array.get(arrayYSTLP,1))))
drawLineSTLP := 2
array.set(arrayXSTLP, 0, array.get(arrayXTLP,0))
array.set(arrayYSTLP, 0, array.get(arrayYTLP,0))
else if(array.get(arrayXSTLP,0) <= array.get(arrayXTLP,1))
if((array.get(arrayYSTLP,0) > array.get(arrayYSTLP,1) and array.get(arrayYTLP,0) < array.get(arrayYSTLP,1)) or (array.get(arrayYSTLP,0) < array.get(arrayYSTLP,1) and array.get(arrayYTLP,0) > array.get(arrayYSTLP,1)))
drawLineSTLP := 4
array.unshift(arrayXSTLP,array.get(arrayXTLP,0))
array.unshift(arrayYSTLP,array.get(arrayYTLP,0))
else if((array.get(arrayYSTLP,0) > array.get(arrayYSTLP,1) and array.get(arrayYTLP,0) > array.get(arrayYSTLP,0)) or (array.get(arrayYSTLP,0) < array.get(arrayYSTLP,1) and array.get(arrayYTLP,0) < array.get(arrayYSTLP,0)))
drawLineSTLP := 3
_max = math.min(array.get(arrayYSTLP,0),array.get(arrayYSTLP,1))
_min = math.max(array.get(arrayYSTLP,0),array.get(arrayYSTLP,1))
_max_idx = 0
_min_idx = 0
for i = 1 to array.size(arrayXTLP)
if(array.get(arrayXSTLP,0) >= array.get(arrayXTLP,i))
break
if(_min > array.get(arrayYTLP,i))
_min := array.get(arrayYTLP,i)
_min_idx := array.get(arrayXTLP,i)
if(_max < array.get(arrayYTLP,i))
_max := array.get(arrayYTLP,i)
_max_idx := array.get(arrayXTLP,i)
if(array.get(arrayYSTLP,0) > array.get(arrayYSTLP,1))
array.unshift(arrayXSTLP,_min_idx)
array.unshift(arrayYSTLP,_min)
else if(array.get(arrayYSTLP,0) < array.get(arrayYSTLP,1))
array.unshift(arrayXSTLP,_max_idx)
array.unshift(arrayYSTLP,_max)
array.unshift(arrayXSTLP,array.get(arrayXTLP,0))
array.unshift(arrayYSTLP,array.get(arrayYTLP,0))
if(f_resInMinutes() < f_tfRes(customTF,f_resInMinutes()))
if(array.get(arrayYSTLP,0) == array.get(arrayYTLP,0) and array.get(arrayXSTLP,0) != array.get(arrayXTLP,0))
array.set(arrayXSTLP, 0, array.get(arrayXTLP,0))
drawLineSTLP := 9
if(f_resInMinutes() <= f_tfRes(customTF,f_resInMinutes()))
if(drawLineSTLP == 2 or drawLineSTLP == 9)
if(array.size(arrayLineSTLP) >0)
line.set_xy2(array.get(arrayLineSTLP,0),array.get(arrayXSTLP,0),array.get(arrayYSTLP,0))
else
array.unshift(arrayLineSTLP,line.new(array.get(arrayXSTLP,1),array.get(arrayYSTLP,1),array.get(arrayXSTLP,0),array.get(arrayYSTLP,0), color = colorSTLP,xloc = xloc.bar_time))
else if(drawLineSTLP == 4)
array.unshift(arrayLineSTLP,line.new(array.get(arrayXSTLP,1),array.get(arrayYSTLP,1),array.get(arrayXSTLP,0),array.get(arrayYSTLP,0), color = colorSTLP,xloc = xloc.bar_time))
else if(drawLineSTLP == 3)
array.unshift(arrayLineSTLP,line.new(array.get(arrayXSTLP,2),array.get(arrayYSTLP,2),array.get(arrayXSTLP,1),array.get(arrayYSTLP,1), color = colorSTLP,xloc = xloc.bar_time))
array.unshift(arrayLineSTLP,line.new(array.get(arrayXSTLP,1),array.get(arrayYSTLP,1),array.get(arrayXSTLP,0),array.get(arrayYSTLP,0), color = colorSTLP,xloc = xloc.bar_time))
else if(drawLineSTLP == 5)
if(array.size(arrayLineSTLP) >0)
line.set_xy2(array.get(arrayLineSTLP,0),array.get(arrayXSTLP,1),array.get(arrayYSTLP,1))
else
array.unshift(arrayLineSTLP,line.new(array.get(arrayXSTLP,2),array.get(arrayYSTLP,2),array.get(arrayXSTLP,1),array.get(arrayYSTLP,1), color = colorSTLP,xloc = xloc.bar_time))
array.unshift(arrayLineSTLP,line.new(array.get(arrayXSTLP,1),array.get(arrayYSTLP,1),array.get(arrayXSTLP,0),array.get(arrayYSTLP,0), color = colorSTLP,xloc = xloc.bar_time))
///////////////////////Other//////////////////////////////////
if(f_resInMinutes() <= f_tfRes(customTF,f_resInMinutes()))
if(showSTLP)
if(showLabel and (barstate.islast or barstate.islastconfirmedhistory))
texLabel = f_resInMinutes() == f_tfRes(customTF,f_resInMinutes()) ? f_resFromMinutes(f_resInMinutes()) : f_resFromMinutes(f_tfRes(customTF,f_resInMinutes()))
label.set_xy(labelTF,array.get(arrayXSTLP,0),array.get(arrayYSTLP,0))
label.set_text(labelTF,texLabel)
label.set_style(labelTF,array.get(arrayYSTLP,0) < array.get(arrayYSTLP,1) ? label.style_label_upper_right : label.style_label_lower_right)
if(not showTLP)
arrayLineTemp := array.copy(arrayLineTLP)
for itemArray in arrayLineTemp
if(line.get_x1(itemArray) < array.get(arrayXSTLP,0))
line.delete(itemArray)
array.remove(arrayLineTLP,array.indexof(arrayLineTLP, itemArray))
//Inside Bars - Outside Bars
insideBar() => ISB and high <= high and low >= low ? 1 : 0
outsideBar() => OSB and (high > high and low < low ) ? 1 : 0
//Inside and Outside Bars
barcolor(insideBar() ? color.new(colorISB,0) : na )
barcolor(outsideBar() ? color.new(colorOSB,0) : na )
Simple Multi-Timeframe Trends with RSI (Realtime)Simple Multi-Timeframe Trends with RSI Realtime Updates
Overview
The Simple Multi-Timeframe Trends with RSI Realtime Updates indicator is a comprehensive dashboard designed to give you an at-a-glance understanding of market trends across nine key timeframes, from one minute (M1) to one month (M).
It moves beyond simple moving average crossovers by calculating a sophisticated Trend Score for each timeframe. This score is then intelligently combined into a single, weighted Confluence Signal , which adapts to your personal trading style. With integrated RSI and divergence detection, SMTT provides a powerful, all-in-one tool to confirm your trade ideas and stay on the right side of the market.
Key Features
Automatic Trading Presets: The most powerful feature of the script. Simply select your trading style, and the indicator will automatically adjust all internal parameters for you:
Intraday: Uses shorter moving averages and higher sensitivity, focusing on lower timeframe alignment for quick moves.
Swing Trading: A balanced preset using medium-term moving averages, ideal for capturing trends that last several days or weeks.
Investment: Uses long-term moving averages and lower sensitivity, prioritizing the major trends on high timeframes.
Advanced Trend Scoring: The trend for each timeframe isn't just "up" or "down". The score is calculated based on a combination of:
Price vs. Moving Average: Is the price above or below the MA?
MA Slope: Is the trend accelerating or decelerating? A steep slope indicates a strong trend.
Price Momentum: How quickly has the price moved recently?
Volatility Adjustment: The score's quality is adjusted based on current market volatility (using ATR) to filter out choppy conditions.
Weighted Confluence Score: The script synthesizes the trend scores from all nine timeframes into a single, actionable signal. The weights are dynamically adjusted based on your selected Trading Style , ensuring the most relevant timeframes have the most impact on the final result.
Integrated RSI & Divergence: Each timeframe includes a smoothed RSI value to help you spot overbought/oversold conditions. It also flags potential bullish (price lower, RSI higher) and bearish (price higher, RSI lower) divergences, which can be early warnings of a trend reversal.
Clean & Customizable Dashboard: The entire analysis is presented in a clean, easy-to-read table on your chart. You can choose its position and optionally display the raw numerical scores for a deeper analysis.
How to Use It
1. Add to Chart: Apply the "Simple Multi-Timeframe Trends" indicator to your chart.
2. Select Your Style: This is the most important step. Go to the indicator settings and choose the Trading Style that best fits your strategy (Intraday, Swing Trading, or Investment). All calculations will instantly adapt.
3. Analyze the Dashboard:
Look at the Trend row to see the direction and strength of the trend on individual timeframes. Strong alignment (e.g., all green or all red) indicates a powerful, market-wide move.
Check the RSI row. Is the trend overextended (RSI > 60) or is there room to run? Look for the fuchsia color, which signals a divergence and warrants caution.
Focus on the Signal row. This is your summary. A "STRONG SIGNAL" with high alignment suggests a high-probability setup. A "NEUTRAL" or "Weak" signal suggests waiting for a better opportunity.
4. Confirm Your Trades: Use the SMTT dashboard as a confirmation tool. For example, if you are looking for a long entry, wait for the dashboard to show a "BULLISH" or "STRONG SIGNAL" to confirm that the broader market structure supports your trade.
Dashboard Legend
Trend Row
This row shows the trend direction and strength for each timeframe.
⬆⬆ (Dark Green): Ultra Bullish - Very strong, established uptrend.
⬆ (Green): Strong Bullish - Confident uptrend.
▲ (Light Green): Bullish - The beginning of an uptrend or a weak uptrend.
━ (Orange): Neutral - Sideways or consolidating market.
▼ (Light Red): Bearish - The beginning of a downtrend or a weak downtrend.
⬇ (Red): Strong Bearish - Confident downtrend.
⬇⬇ (Dark Red): Ultra Bearish - Very strong, established downtrend.
RSI Row
This row displays the smoothed RSI value and its condition.
Green Text: Oversold (RSI < 40). Potential for a bounce or reversal upwards.
Red Text: Overbought (RSI > 60). Potential for a pullback or reversal downwards.
Fuchsia (Pink) Text: Divergence Detected! A potential reversal is forming.
White Text: Neutral (RSI between 40 and 60).
Signal Row
This is the final, weighted confluence of all timeframes.
Label:
🚀 STRONG SIGNAL / 💥 STRONG SIGNAL: High confluence and strong momentum.
🟢 BULLISH / 🔴 BEARISH: Clear directional bias across relevant timeframes.
🟡 Weak + / 🟠 Weak -: Minor directional bias, suggests caution.
⚪ NEUTRAL: No clear directional trend; market is likely choppy or undecided.
Numerical Score: The raw weighted confluence score. The further from zero, the stronger the signal.
Alignment %: The percentage of timeframes (out of 9) that are showing a clear bullish or bearish trend. Higher percentages indicate a more unified market.
Choppiness ZONE OverlayPurpose
This script overlays choppiness zones directly onto the price chart to help traders identify whether the market is trending or ranging. It is designed to filter out low-probability trades during high choppiness conditions.
How It Works
Calculates the Choppiness Index over a user-defined period using ATR and price range.
Divides choppiness into four zones:
30 to 40: Low choppiness, possible trend initiation, shown in yellow.
40 to 50: Moderate choppiness, transition zone, shown in orange.
50 to 60: High choppiness, weakening momentum, shown in red.
60 and above: Extreme choppiness, avoid trading, shown in purple.
Highlights each zone with customizable color fills between the high and low of the selected range.
Triggers a real-time alert when choppiness exceeds 60.
Features
Customizable choppiness zones and color settings.
Real-time alert when market becomes extremely choppy (choppiness ≥ 60).
Visual zone overlay on the price chart.
Compatible with all timeframes.
Lightweight and responsive for scalping, intraday, or swing trading.
Tip
Use this tool as a volatility or trend filter. Combine it with momentum or trend-following indicators to improve trade selection.
Kaufman Trend Strategy# ✅ Kaufman Trend Strategy – Full Description (Script Publishing Version)
**Kaufman Trend Strategy** is a dynamic trend-following strategy based on Kaufman Filter theory.
It detects real-time trend momentum, reduces noise, and aims to enhance entry accuracy while optimizing risk.
⚠️ _For educational and research purposes only. Past performance does not guarantee future results._
---
## 🎯 Strategy Objective
- Smooth price noise using Kaufman Filter smoothing
- Detect the strength and direction of trends with a normalized oscillator
- Manage profits using multi-stage take-profits and adaptive ATR stop-loss logic
---
## ✨ Key Features
- **Kaufman Filter Trend Detection**
Extracts directional signal using a state space model.
- **Multi-Stage Profit-Taking**
Automatically takes partial profits based on color changes and zero-cross events.
- **ATR-Based Volatility Stops**
Stops adjust based on swing highs/lows and current market volatility.
---
## 📊 Entry & Exit Logic
**Long Entry**
- `trend_strength ≥ 60`
- Green trend signal
- Price above the Kaufman average
**Short Entry**
- `trend_strength ≤ -60`
- Red trend signal
- Price below the Kaufman average
**Exit (Long/Short)**
- Blue trend color → TP1 (50%)
- Oscillator crosses 0 → TP2 (25%)
- Trend weakens → Final exit (25%)
- ATR + swing-based stop loss
---
## 💰 Risk Management
- Initial capital: `$3,000`
- Order size: `$100` per trade (realistic, low-risk sizing)
- Commission: `0.002%`
- Slippage: `2 ticks`
- Pyramiding: `1` max position
- Estimated risk/trade: `~0.1–0.5%` of equity
> ⚠️ _No trade risks more than 5% of equity. This strategy follows TradingView script publishing rules._
---
## ⚙️ Default Parameters
- **1st Take Profit**: 50%
- **2nd Take Profit**: 25%
- **Final Exit**: 25%
- **ATR Period**: 14
- **Swing Lookback**: 10
- **Entry Threshold**: ±60
- **Exit Threshold**: ±40
---
## 📅 Backtest Summary
- **Symbol**: USD/JPY
- **Timeframe**: 1H
- **Date Range**: Jan 3, 2022 – Jun 4, 2025
- **Trades**: 924
- **Win Rate**: 41.67%
- **Profit Factor**: 1.108
- **Net Profit**: +$1,659.29 (+54.56%)
- **Max Drawdown**: -$1,419.73 (-31.87%)
---
## ✅ Summary
This strategy uses Kaufman filtering to detect market direction with reduced lag and increased smoothness.
It’s built with visual clarity and strong trade management, making it practical for both beginners and advanced users.
---
## 📌 Disclaimer
This script is for educational and informational purposes only and should not be considered financial advice.
Use with proper risk controls and always test in a demo environment before live trading.
Enhanced Cycle IndicatorEnhanced Cycle Indicator Guide
DISCLAIMER
"This PineScript indicator evolved from a foundational algorithm designed to visualize cycle-based center average differentials. The original concept has been significantly enhanced and optimized through collaborative refinement with AI, resulting in improved functionality, performance, and visualization capabilities while maintaining the core mathematical principles of the original design"
Overview
The Enhanced Cycle Indicator is designed to identify market cycles with minimal lag while ensuring the cycle lows and highs correspond closely with actual price bottoms and tops. This indicator transforms price data into observable cycles that help you identify when a market is likely to change direction.
Core Principles
Cycle Detection: Identifies natural market rhythms using multiple timeframes
Dynamic Adaptation: Adjusts to changing market conditions for consistent performance
Precise Signals: Provides clear entry and exit points aligned with actual market turns
Reduced Lag: Uses advanced calculations to minimize delay in cycle identification
How To Use
1. Main Cycle Interpretation
Green Histogram Bars: Bullish cycle phase (upward momentum)
Red Histogram Bars: Bearish cycle phase (downward momentum)
Cycle Extremes: When the histogram reaches extreme values (+80/-80), the market is likely approaching a turning point
Zero Line: Crossovers often indicate a shift in the underlying market direction
2. Trading Signals
Green Triangle Up (bottom of chart): Strong bullish signal - ideal for entries or covering shorts
Red Triangle Down (top of chart): Strong bearish signal - ideal for exits or short entries
Diamond Shapes: Indicate divergence between price and cycle - early warning of potential reversals
Small Circles: Minor cycle turning points - useful for fine-tuning entries/exits
3. Optimal Signal Conditions
Bullish Signals Work Best When:
The cycle is deeply oversold (below -60)
RSI is below 40 or turning up
Price is near a significant low
Multiple confirmation bars have occurred
Bearish Signals Work Best When:
The cycle is heavily overbought (above +60)
RSI is above 60 or turning down
Price is near a significant high
Multiple confirmation bars have occurred
4. Parameter Adjustments
For Shorter Timeframes: Reduce cycle periods and smoothing factor for faster response
For Daily/Weekly Charts: Increase cycle periods and smoothing for smoother signals
For Volatile Markets: Reduce cycle responsiveness to filter noise
For Trending Markets: Increase signal confirmation requirement to avoid false signals
Recommended Settings
Default (All-Purpose)
Main Cycle: 50
Half Cycle: 25
Quarter Cycle: 12
Smoothing Factor: 0.5
RSI Filter: Enabled
Signal Confirmation: 2 bars
Faster Response (Day Trading)
Main Cycle: 30
Half Cycle: 15
Quarter Cycle: 8
Smoothing Factor: 0.3
Cycle Responsiveness: 1.2
Signal Confirmation: 1 bar
Smoother Signals (Swing Trading)
Main Cycle: 80
Half Cycle: 40
Quarter Cycle: 20
Smoothing Factor: 0.7
Cycle Responsiveness: 0.8
Signal Confirmation: 3 bars
Advanced Features
Adaptive Period
When enabled, the indicator automatically adjusts cycle periods based on recent price volatility. This is particularly useful in markets that alternate between trending and ranging behaviors.
Momentum Filter
Enhances cycle signals by incorporating price momentum, making signals more responsive during strong trends and less prone to whipsaws during consolidations.
RSI Filter
Adds an additional confirmation layer using RSI, helping to filter out lower-quality signals and improve overall accuracy.
Divergence Detection
Identifies situations where price makes a new high/low but the cycle doesn't confirm, often preceding significant market reversals.
Best Practices
Use the indicator in conjunction with support/resistance levels
Look for signal clusters across multiple timeframes
Reduce position size when signals appear far from cycle extremes
Pay special attention to signals that coincide with divergences
Customize cycle periods to match the natural rhythm of your traded instrument
Troubleshooting
Too Many Signals: Increase signal confirmation bars or reduce cycle responsiveness
Missing Major Turns: Decrease smoothing factor or increase cycle responsiveness
Signals Too Late: Decrease cycle periods and smoothing factor
False Signals: Enable RSI filter and increase signal confirmation requirement