[-_-] Custom Type ExamplesDescription:
This script shows an example use of new Pinescript's feature called User Defined Types, which can be seen as analogue of from C++ or from Python. It is not an indicator for technical analysis, and serves only as an example of how to use the new feature mentioned above.
In the script I define 4 custom types and a custom initialisation function for each:
- Point (represents a coordinate with x -> bar_index, y -> price)
- Tria (creates a triangle using objects and objects as coordinates of 3 points)
- Path (creates a path-like object from an of )
- Trade (creates a visual representation of a Long/Short trade with set Take Profit and Stop Loss, and displays an info label with realized Profit/Loss)
I'd personally like to see this feature improved by adding methods (so that we could, for example, define functions inside a custom type), which could be an analogue of classes from other programming languages.
Pine utilities
Cumulative Weighted Exponential Moving Average (CWEMA)This is a Pine Script for the "Cumulative Weighted Exponential Moving Average" (CWEMA) indicator. The script defines the CWEMA indicator using the ema() and wma() functions, which respectively calculate the exponential moving average and weighted moving average of a given data series. The cwema() function computes the weights for each value in the moving average and then uses the wma() function to calculate the weighted moving average of the exponentially weighted moving average of the input data series. The resulting CWEMA values are plotted on a chart.
Center Weighted Moving Average (CWMA)This is a pine script that defines and implements a custom weighted moving average (WMA) indicator. The script first defines a function called wma that calculates the weighted moving average of a given data source (src) with a specified set of weights (weights) over a specified length (len). The wma function first computes the weighted sum of the source data by multiplying the source data with the weights and summing over the length. It then calculates the sum of the weights. Finally, it divides the weighted sum by the sum of the weights to compute the weighted moving average.
The script then defines a second function called cwma that calculates a custom WMA by defining the weights for each value in the moving average as the length plus one divided by two minus the absolute value of the length minus the source data. It then uses the wma function to calculate and return the weighted moving average.
The script then specifies the input parameters for the cwma function: the source data (close) and the moving average length (length). It then plots the custom weighted moving average on the chart.
Time Zone / Market SessionsTime Zone / Market Sessions indicator is a handy tool to display current major Market Open / Close condition along with present time at that Exchange. Sydney, Tokyo, London, New York market sessions are included. Clear display of Overlap Zones and Kill Zones.. Can be used to estimate market Pumping and Dumping. Alerts can be set when a market opens.
Time is Displayed in Table Layout
Active Market is displayed as Dots on top and bottom
You can select as Timeline or Table display
Overlap is clearly displayed on top and bottom without any mess
Gray color in Table layout Shows Closed Markets
You are free to reuse this code No Limitations.
Kill Zones are indicated in Table format. When some of the markets are closed
Alerts included for market openings
[Mad] Active LineThis is a simple line tool that can give you active feedback based on the closing price.
It is intended for a live chart whose ticker is not changed by the user every 10 minutes, like a general overview of an asset in a higher time frame.
What can it provide:
Price difference from the price to the line
Price at the current collision point
How to use it:
When opened, it requests 2 input points from you.
After you set these 2 points, it will set the "Active Line" for you, like the normal TV line.
One thing to know is that you can't place into the future, so "extend" is always on by default.
and as always, have fun trading the assets up and down :-)
Custom Candle Body WidthOver the specified bar range, plots a vertical line from open to close using the specified colors and line width (in pixels).
In effect, these look like thinner/thicker candle bodies.
The default candle bodies are made transparent over this range to make them appear hidden.
The indicator is capable of referencing the bar colors from another plot, using a technique of encapsulating the RGBT color value in a float value (plot to data window only recommended).
Refer to example code (which is commented out) in the source code.
RSI Candle ColorI manually made a 100 point gradient for this one. Its just smooth sensitive rsi but it colors your candles based on the level of the rsi. I hope you find this useful even as a utility for the gradient.
True Range Outlier Detector (TROD)True Range Outlier Detector (TROD) shows you weather or not a candle is larger than normal. This works by taking the normalized true range and if the candle exceeds a score of 0.5 or -0.5 it triggers the outlier detection. This is great for building strategies if you want to refrain from buying larger than normal up or down ticks. The only feature is the ability to change the lookback period of the normalization. I hope you find this as useful as I do!
Enjoy!
Vector ScalerVector Scaler is like Stochastic but it uses a different method to scale the input. The method is very similar to vector normalization but instead of keeping the "vector" we just sum the three points and average them. The blue line is the signal line and the orange line is the smoothed signal line. I have added the "J" line from the KDJ indicator to help spot divergences. Differential mode uses the delta of the input for the calculations. Here are some pictures to help illustrate how this works relative to other popular indicators.
Vector Scaler vs Stochastic
Vector Scaler vs Smooth Stochastic RSI
average set to 100
average set to 200
Didi's Needles setup screener Didi's Needles setup screener
I basically used the screener created by QuantNomad , made some modifications and used the indicators from the setup
Indicators used:
Didi Index, ADX, Bollinger Bands, Trix and Stochastic.
Signals from each column:
Column 'Symbol'
Blue Symbol: When the Didi, ADX and BB are with buy signals
Yellow Symbol: When Didi, ADX and BB are with sell signals
Red Symbol: When ADX, BB, Trix and Stoch are with signals to close the trade
ADX' Column
ADX Kick: When the ADX has given a Kick (Top or Bottom). ADX was rising and starts to fall
Uptrend: When the ADX is up and below the Level and the DI+ is above the DI-
Uptrend Strong: When the ADX is up and above the Level and the DI+ is above the DI-
Uptrend Falling: When the ADX is below and above the Level and the DI+ is above the DI-
Downtrend: When the ADX is below the level and the DI- is above the DI+
Downtrend Strong: When the ADX is above the level and the DI- is above the DI+
Downtrend Falling: When the ADX is below the level and the DI- is above the DI+
Didi' Column
Buy Alert: When the Fast Average crosses the Median to the upside (as long as it is not a False Point) = Needle Alert
Sell Alert: When Fast Average Crosses Median Down (as long as it is not a False Point) = Needle Alert
Needle Buy: When slow average crosses the median down = Needle confirmation
Needle Sell: When slow moving average crosses the median to high = Needle confirmation
Fake Buy: When the fast moving average crosses the median and the slow moving average is above the median and rising = False Point (Sell signal or if you are positioned on the buy side, hold the buy or raise the hand)
Fake Sell: When the fast moving average crosses the median and the slow moving average is below the median and falling = False Point (Buy signal or if you are positioned on the sell side, hold the sell or raise your hand)
BB' Column
Open Rising: When the Bollinger Bands are open and the Base Mean (BB) is rising
Open Falling: When the Bollinger Bands are open and the Base Mean (BB) is falling
Parallel Rising: When the Bollinger Bands are parallel and rising
Parallel Falling: When the Bollinger Bands are Parallel and falling
Close: When the Bollinger Bands are closed
Trix Column
Bought: When the Trix is above the MA (trix)
Sold: When the Trix is below the MA (trix)
Stoch Column
Bought: When %K is above %D
Sold: When %K is below %D
--------------------------
Rastreador para o setup de Agulhadas do Didi
Eu basicamente usei o screener criado por QuantNomad , fiz algumas modificações e usei os indicadores do setup
Indicadores usado:
Didi Index, ADX, Bandas de Bollinger, Trix e Estocástico.
Sinais de cada coluna:
Coluna 'Symbol'
Symbol Azul: Quando o Didi, ADX e BB estão com sinais de compra
Symbol Amarelo: Quando o Didi, ADX e BB estão com sinais de venda
Symbol Vermelho: Quando o ADX, BB, Trix e Stoch estão com sinais para fechar a operação
Coluna 'ADX'
Kick ADX: Quando o ADX deu um Kick (Topo ou Fundo). ADX vinha subinte e começa cair
Uptrend: Quando o ADX está subinte e abaixo do Nivel e o DI+ está acima do DI-
Uptrend Strong: Quando o ADX está subinte e acima do Nivel e o DI+ está acima do DI-
Uptrend Falling: Quando o ADX está cainte e acima do Nivel e o DI+ está acima do DI-
Downtrend: Quando o ADX está subinte e abaixo do Nivel e o DI- está acima do DI+
Downtrend Strong: Quando o ADX está subinte e acima do Nivel e o DI- está acima do DI+
Downtrend Falling: Quando o ADX está cainte e acima do Nivel e o DI- está acima do DI+
Coluna 'Didi'
Buy Alert: Quando a média rapida cruza a mediana para cima (contanto que não seja um Ponto Falso) = Alerta da Agulhada
Sell Alert: Quando a média rapida cruza a mediana para baixo (contanto que náo seja um Ponto Falso) = Alerta da Agulhada
Needle Buy: Quando a média lenta cruza a mediana para baixo = Confirmação da Agulhada
Needle Sell: Quando a média lenta cruza a mediana para cima = Confirmação da Agulhada
Fake Buy: Quando a média rapida cruza a mediana paa cima e a média lenta está acima da mediana e subindo = Ponto Falso (Sinal de venda ou caso esteja posicionado na compra, segurar a compra ou aumentar a mão)
Fake Sell: Quando a média rapida cruza a mediana para baixo e a média lenta está abaixo da mediana e caindo = Ponto Falso (Sinal de compra ou caso esteja posicionado na venda, segurar a venda ou aumentar a mão)
Coluna 'BB'
Open Rising: Quando as Bandas de Bollingers estão abertas e a média base (BB) está subindo
Open Falling: Quando as Bandas de Bollingers estão abertas e a média base (BB) está caindo
Parallel Rising: Quando as Bandas de Bollingers estão Paralelas e subindo
Parallel Falling: Quando as Bandas de Bollingers estão Paralelas e caindo
Close: Quando as Bandas de Bollingers estão fechadas
Coluna 'Trix'
Bought: Quando o Trix está acima da MA (trix)
Sold: Quando o Trix está abaixo da MA (trix)
Coluna 'Stoch'
Bought: Quando %K está acima do %D
Sold: Quando o %K está abaixo do %D
[Mad] Exchange liquidationThis is just a basic tool to calculate liquidation based on:
margin-maintenance
leverage
it starts drawing on your input point short and long liquidation, so you can easily place it on your trade and drag it around if you are rebuying as an example.
Also, you can use it to aim for a specific support/resistance to see if it is even possible to reach some levels, which leverage you can use...
It additionally delivers live data based on the actual close to the 2 liquidation points
have fun
Slow but limitless moving averagesThis aproach shows how to execute diffrent MAs with diffrent lenghts conditionaly with only one MA function call. Current method allows to swap inputs of functions on the fly, but due to pinescript limitations calculation is slow. Publishing this script like an indicator not a libriary because i am working on better calculation method that can be evaluated, also data collecting and processing can be optimised, BUT its still extrimely useful aproach if you dont need to calculate (and swap inputs condtionaly for) more than 8 HTF MAs on every bar.
Currency translate indicator v1.0This indicator enters the base currency exchange rate.
Then transform it to display a candle graph.
This indicator is not equivalent to the actual value of the stock.
It is converted and displayed based on the exchange rate information you entered.
e.g. FX_IDC:KRWUSD, FXCM:AUDUSD
---
이 표시기는 기초 통화의 환율을 입력 받습니다.
그러면 이 표시기가 변환하여 캔들 그래프를 표시합니다.
이 표시기는 주식의 실제 가치와 동등하지 않습니다.
이는 그저 당신이 입력한 환율을 기반으로 변환해서 보여줄 뿐입니다.
예시) FX_IDC:KRWUSD, FX:AUDUSD
Hull Moving Average Bollinger Bands (HMABB)Hello! This is simply Bollinger Bands calculated with HMA! Heres a recap on both.
The Hull Moving Average (HMA) attempts to minimize the lag of a traditional moving average while retaining the smoothness of the moving average line. Developed by Alan Hull in 2005, this indicator makes use of weighted moving averages to prioritize more recent values and greatly reduce lag.
Bollinger Bands are envelopes plotted at a standard deviation level above and below a simple moving average of the price. Because the distance of the bands is based on standard deviation, they adjust to volatility swings in the underlying price. Bollinger Bands use 2 parameters, Period and Standard Deviations, StdDev.
Beta ScreenerThis script allows you to screen up to 38 symbols for their beta. It also allows you to compare the list to not only SPY but also CRYPTO10! Features include custom time frame and custom colors.
Here is a refresher on what beta is:
Beta (β) is a measure of the volatility—or systematic risk—of a security or portfolio compared to the market as a whole (usually the S&P 500 ). Stocks with betas higher than 1.0 can be interpreted as more volatile than the S&P 500 .
Beta is used in the capital asset pricing model (CAPM), which describes the relationship between systematic risk and expected return for assets (usually stocks). CAPM is widely used as a method for pricing risky securities and for generating estimates of the expected returns of assets, considering both the risk of those assets and the cost of capital.
How Beta Works
A beta coefficient can measure the volatility of an individual stock compared to the systematic risk of the entire market. In statistical terms, beta represents the slope of the line through a regression of data points. In finance, each of these data points represents an individual stock's returns against those of the market as a whole.
Beta effectively describes the activity of a security's returns as it responds to swings in the market. A security's beta is calculated by dividing the product of the covariance of the security's returns and the market's returns by the variance of the market's returns over a specified period.
cov (a,b)/var(b)
Close CandlesClosing candle takes any input and turs it into a candle stick chart. You can go from a regular candle chart by setting the length to 1, to heikin ashi by setting the length to 4. One of the features of this scripts is the ability to reuse the function. This function is a great addition to most scripts as it makes it really easy to give your script a candle view. As always I hope that you find this release useful. If you find any bugs please let me know. The same goes with any features you might want to request. This includes requesting custom indicators. Enjoy!
[VTaL] Vertical Time Alert Lines - By BlueJayBird🦾 USE
- Vertical lines drawn ON TOP of chart at selected key times of the day, week, month, year.
- You can use it at any symbol (as far as I know).
- Programmatic alerts available.
- Lines from lower time-frames are selectively NOT visible at higher time-frames. Example: At 1h time-frame, vertical lines from 1h and 4h intervals are not visible. Drawing them is considered not really useful.
🎭 MAIN FEATURES
- Available targeted times: 3m, 15m, 1h, 4h, 1D, 1W, 1M, 1Y.
- Offset available for all lines. Example: 1 offset for 4h moves lines from 4AM to 8AM.
- Programmatic alerts for all lines. Example: If alert is enabled for 15m lines, every time those lines are reached, alert will trigger.
- Available drawing themes: Custom, Light, Dark.
💻 NOTES ON CODE
- Vertical lines are drawn using a custom function, which uses line.new() built-in function.
- Alerts are triggered using ta.cross() built-in function. Alert is triggered when close price crosses a given time value from the line.get_x1() built-in function.
- I've added, where necessary, several comments to the code for understanding what's going on. If you have additional questions, you may ask them in the comment section of the publication.
- 3m lines are not really useful in day-trading, they were added for debugging purposes mainly. Useful for learning how to use alerts, though.
👉🏼 NOTES ON ALERTS
- When setting up an alert, the targeted line must be enabled/visible.
- Every time any alert is enabled or disabled, you must create AGAIN the alert from the "Alerts" panel (remember, alerts run in the back-end).
- Alerts contain really useful information. If you have any idea for adding some other data, tell in the comment section. 💡
⚠️ KNOWN ISSUES
- None. Let me know please if you find any.
--------------------------------------------
~ Comment , Follow and Boost ~ 🚀
Expansion of EMAWe are added multi EMA for trend analysis .
use only 1MIN and 5 MIN candle
its only use for Indian market and intraday purpose .
Altcoin Analyzer [Lysergik]Quickly view any USD-based asset's value relative to Bitcoin without needing to have a separate chart with all its bells and whistles.
[FFriZz]Priceline/TicksFFriZz | FrizLabz -- Priceline/Ticks
Due to TradingView not allowing us to change the size or style of the Priceline I decided to make this
You can change the style, size, color of the Price line with this Script
There is also an option for the closing price to be plotted on the Priceline
-- Colors --
You can have the Line and/or the Closing price change colors with the price movements
both are adjustable to your preference
-- Ticks --
Will show the difference in price from tick to tick
when Volume moves but price doesn't it will show '▲▼'
-- Adjustments --
The offset of the Close and Ticks can be adjusted from left to right
Can Extend Priceline in all directions
Can change the Line style and Width
Can change all the Text sizes and Colors
Can also Change Colors to change with Price movements
Can Change number of Ticks to show
-- Priceline --
You don't have to but I suggest going to the settings of your Chart and turning off the Priceline
-- Challenge --
There is Some code at the bottom that will move the Label and Ticks to the x% of your screen in from the right once
the last bar is no longer visible. I decided not to use it because even when the feature is turned off any movement of the
chart resets the Ticks. If you find out a way to have it not reset the Ticks Let me know!
If you find any bugs or have any suggestions feel free to DM me or leave a comment!
Hope you Enjoy! -- FFriZz | FrizLabz
[FriZz]Watermark -- Watermark by FriZz | FrizLabz --
Lets you Customize a watermark how ever you would like
There are 4 Textboxes in the settings window 2 for your inputs
There's 1 with instructions/examples and 1 with Special Characters (there are tons more online)
-- The options you can type into Textbox 1 and 2 --
- Volume
- Open
- Close
- High
- Low
- Ticker [ Chart ticker ]
- Ticker2 [ Optional 2nd ticker that can be set in the settings will also display close ]
- TF
- Day
- Date
- Time
- Session
- SessionTime
-- Important --
These options need to be spelled and Case matched correctly or it will simply just display the word
You can add anything around a word or between two words you would like
If you want a new line simply press [ ENTER/RETURN ] and continue
-- Tooltip --
Tooltip appears when you mouse over the watermark
There are options to change the session times if you need too
The Sessions will be listed on the tooltip with Session times
I think that pretty much covers most of it if you have any questions or suggestions on this or anything else I've made
or if I missed a bug.. feel free to comment or DM me
Enjoy! - FriZz
Benjamin Graham Net-Net AnalyserA simple indicator that displayers as a table, telling you whether or not the stock you have selected has a current price that is less than 67% of the company's net current asset value per share (NCAVPS) at its last reporting period (FQ, FY, TTM).
Benjamin Graham uses this 67% rule to decide whether or not a stock is significantly undervalued, and studies have shown that investing in companies whose share prices are less than 67% of their NCAVPS can be highly profitable, and will beat markets in the long run.
Feel free to use as you please or repurpose the code for your own projects.
Tick StatisticsTick Statistics:
I have seen many questions/queries related to tick data in TV telegram channels. This script will help pine scripts to understand how ticks work, how to capture and process tick data.
This is an educational indicator script for pine scripters.
The indicator shall work only on real time candles. Tick data capture is initiated as soon as indicator is loaded on the chart. You might not get correct statistics on 1st candle in case indicator is loaded when real time candle is in progress, in such case you can monitor the statistics generated for subsequent candles.
Generated statistics is shown on the chart by placing 2 diamond shapes above and below the candle.
Diamond shape below the candle will have candles ‘tick data’ listed in a table. This can be view by placing mouse pointer on the diamond shape. Refer to point 1 below for more details.
Diamond shape above the candle will have statistics as mentioned in point no 2 onwards. To view the statistics place the mouse point on the diamond shape. The shape will appear in green color when both tick price and tick volume are both moving in the same direction. The diamond shape in red color means tick price and tick volume are moving in opposite direction.
The script captures tick by tick data and generate statistics below:
1. List of tick data with details below: (this is stored in the diamond shape placed below the candle)
a. Tick no
b. Tick type – Up tick (Up), Down tick (Dn), No change (--)
c. Tick price
d. Volume
e. Price difference (as compared to previous tick price)
f. Volume difference (as compared to previous tick volume)
2. Tick statistics
a. Total ticks
b. Number of up ticks
c. Number of down ticks
d. Number of No change ticks
3. Volume Statistics
a. Total volume
b. Up tick volume
c. Down tick volume
d. Volume associated with ticks where there is no change
e. Candle volume (just for reconciliation purpose)
4. Max-min statistics
a. Max volume = <> at price = <> at tick no = <>
b. Min volume = <> at price = <> at tick no = <>
c. Max price = <> at volume = <> at tick no = <>
d. Min price = <> at volume = <> at tick no = <>
5. Candle summary
a. Price << Up >> (if price is up as compared to 1st tick <> otherwise
b. Volume <> (if up tick volume is more than down tick volume <> otherwise