Front Angler Percent CJA nice little gadget.
Can be used to visually hint on volatility.
Will show a leading vertical bar which shows percentage of price, both up and down, in relation to current price.
Сферы применения Pine
Ultimate risk management toolHow to use:
Use the cursor to select the time, entry, stop loss, and target position. Then a window will pop up and type the trading fee or any other things you want to adjust to calculate the actual reward/risk ratio according to the price you selected.
Known error:
Settings of this script can't be saved as default might due to the interactive price selection function. If anyone knows how to fix it, please let me know.
feature:
1. Dynamic profit label can move up and down vertically on the right-hand side of the box.
2. The breakeven line can tell you you can move your stop loss to the entry price when the price reaches it.
3. Calculate the actual reward/risk ratio based on the trading fee. The calculator only calculates the actual Risk/Reward Ratio, which might be helpful for scalpers.
4. When the price touches sl or tp, that side of the box will be highlighted. Sometimes it doesn't work but I will try my best to fix it. Feel free to share your idea to help me to fix it.
5. Price alert. This tool compares with the alert function but reopens it if you want to change the alert price.
CRYPTO MARKET SESSION ANALYZER INDICATORCrypto Market Session Analyzer is an easy-to-use yet powerful analysis tool that helps the trader visualize and analyze price movements over three different trading sessions:
1) European Session
2) US session
3) Asian session
Automatically tracks the corresponding levels for each market session.
This indicator can be used on all timeframes equal to or less than 15 minutes.
Although this is a simple indicator to use, some care must be taken when using it. The trader must be careful to set the correct times for each session according to his UTC timezone. By default the indicator uses UTC. If your console is set to UTC + 2 for example, you will need to take this into account and align the times correctly. You can adjust the time for each session from the user interface. Following the example, if the opening of the UE session is set to 9 and UTC of your console is set to UTC + 2, the script will proceed to create the level at opening time 11.
HOW IT WORK
The indicator automatically draws a horizontal line at the open and a horizontal line at the close of each session. The indicator clears past support and resistance every 24 hours to provide a clean and easy-to-read chart, updating new levels session after session.
Blue indicates the EU session.
Orange indicates the US session.
Purple indicates the Asian session.
Input Text Area to Array then Reshape Table█ OVERVIEW
Simple method to convert from input.text_area to array using str.split.
Reshape table using switch, not necessary must use matrix.reshape.
Might be useful pine script to replace input.symbol.
█ FEATURES
Table can positioned by any position and font size can be resized.
Reshape table and sorting array if necessary.
█ CREDITS
Credits to TradingView for new update of input.text_area.
SymMatrixTableSimple Example Table for Displaying Price, RSI, Volume of multiple Tickers on selected Timeframe
Displays Price, RSI and Volume of 3 Tickers and Timeframe selected by user input
Conditional Table Cell coloring
Price color green if > than previous candle close and red if < previous candle close
RSI color green if < 30 and red if > 70 (RSI14 by default)
Volume color green if above average volume and red if less than that (SMA20 volume by default)
Can turn on/off whole table, header columns, row indices, or select individual columns or rows to show/hide
// Example Mixed Type Matrix To Table //
access the simple example script by uncommenting the code at the end
Basically I wanted to have the headers and indices as strings and the rest of the matrix for the table body as floats, then conditional coloring on the table cells
And also the functionality to turn rows and columns on/off from table through checkboxes of user input
Before I was storing each of the values separately in arrays that didn't have a centralized way of controlling table structure
so now the structure is :
- string header array, string index array
- float matrix for table body
- color matrix with bool conditions for coloring table cells
- bool checkboxes for controlling table display
Coins x Value CalculatorThrough this script you will be able to calculate in real time your total number of coins correlated to the value that is at that moment, so you will not need to log into the brokerage or be simulating sales to know what your total value is in the asset...
To use it, just add it to your favorites and then right after adding it to the chart, clicking on its gear, a field will appear for you to enter your total amount of coins corresponding to that chart, then immediately calculate the value that is the total of your coins , will also show the entire history of appreciation or devaluation that its capital corresponding to that asset had.
Translator Portuguese:
Através desse script você poderá calcular em tempo real o seu numero de moedas total correlacionado ao valor que se encontra naquele momento ,assim nao precisara logar na corretora ou ficar simulando vendas para saber qual valor esta seu total no ativo...
Para usar basta adicionar ele a seus favoritos e então logo após adicionar ao gráfico, clicando na engrenagem dele aparecera um campo para voce digitar sua quantidade de moedas total correspondente a aquele gráfico logo em seguida calculara imediatamente o valor que se encontra o total de suas moedas, também mostrara todo o histórico de valorização ou desvalorização que seu capital correspondente aquele ativo teve.
Fed and ECB Calendar by KziHello traders,
Here is a script that i've done for testing the timestamp and the input.time fonction.
You can see verticals lines blue and yellow.
The blue are the ECB meeting date (7 dates)
The yellow are the FED meeting date. (10 Dates)
// In the parameter you can enter the next rolling month date for ECB and FED
// I don't figure out how to add label / Txt on the lines
// And be carreful i don't put the real hours of the meeting.
positionsize calculatorHow to use:
Use the cursor to select the time, entry, stop loss, and target position. Enter the trading fee to calculate the reward/risk ratio and the actual reward/risk ratio (including the commission) according to the price you selected.
Known error:
Settings of this script can't be saved as default might due to the interactive price selection function. If anyone knows how to fix it, please let me know.
feature:
The visual Risk/Reward box, have three price labels on the right hand of the box.
Calculate the actual reward/risk ratio based on the trading fee.
The visual Risk/Reward box will extend automatically.
Syminfo [Epi]Hello! This little script tells you everything TradingView lets you access in a ticker's syminfo in Pine Script:
- description
- type: crypto, economic, forex, fund, futures, index, spread, stock
- tickerid, such as AMEX:BLOK
- prefix, such as AMEX
- Ticker, such as BLOK
- root: for derivatives such as futures contracts
- currency, such as USD
- base currency: returns 'BTC' for the ticker 'BTCUSD'
- mintick
- point value
- session: regular, extended
- timezone
Some surprises I found in my development:
- there are some more types than mentioned in the documentation,
- the tickerid takes on additional information if you adjust for dividends or show extended session,
- the prefix contains "_DL" additions depending on your data subscriptions, .e.g. "CME_MINI_DL:ES1!",
- with futures, TV will show session.regular both for the 'regular' and the 'electronic' session.
- Unfortunately, syminfo does not contain the 'sector', although TV has the information in the database (the sector is shown in the screener but not accessed in Pine Script).
I use this little utility in my development and hope it's useful for the community. I see such a great number of contributions from the community and would like to give back, even if it's not much.
Moon Launch Alerts Template [Indicator]I created this indicator/study script because i ran into the issue that the same Alerts would fire multiple times. For example it would trigger a Long signal when already being in a Long. I guess there would be no issue with a very basic strategy but with a larger script and many variables, it seemed to create complications.
This is resolved by a TradingLine oscillator and only when it switches to a new and different position from previous, will it trigger an Alert.
If you are in a Long and it signals Long again, then this is seen as a "Continuation Long" in the Alerts settings. You can use this condition to add to your existing position (Optional). Continuation signals are plotted as bright green/red dots.
You will notice there's an option to uncheck "Trade Shorts" and "Trade Exits" signals.
Lets say you choose not to trade Short and Exits, then your Long would only Exit once a Short signal is detected.
This could prove useful for Back-testing purposes.
This quick example script uses the EMA 10, EMA 200, emaPlus1Atr and emaMinus1Atr.
To use in your script, you will need to modify and add your own BUY/SELL/EXIT signals in the box where it says:
//// INPUT YOUR BUY/SELL/EXIT SIGNALS HERE: ////
//////////////////////////////////////////////////
Hope someone will find this useful, or even just as an additional visual confirmation for your own trading strategy and script.
Multi Asset + Correlation OverlayFrom time to time, you may want to overlay multiple assets on the same chart instead of using multi-chart views. This can be a much cleaner way of viewing and comparing multiple assets. There is some functionality built into TradingView that lets you do this to a certain extent, but I wanted additional options, correlation labeling and ways to adjust the overlay location. So, today I am releasing to the community my Multi-Asset + Correlation Overlay script / indicator.
What is does: This script allows you to overlay the price of any ticker onto your chart. It also labels the line with the ticker name, and calculates / labels the correlation coefficient of your newly overlayed asset.
How to use it: Add the indicator to your chart. Then, go into the indicator settings to set the ticker of the asset you want to pull in along with how you want to "offset" it. Your 2 tickers may not be priced near each-other, so the offset setting allows you to pull the ticker you added up/down to better visually align with your chart's price range/layout. For instance, if the asset you added is priced $400 higher than the underlying chart price, you may want to set the offset to -400.
If you would like to add multiple tickers and multiple overlays, you can do that by just adding the indicator to your chart more than once. The color is adjustable, and the ticker of the asset will print to the right of the line representing the asset price. The script also calculates the correlation coefficient between the ticker overlay and the underlying chart asset. The correlation coefficient prints to the right of the ticker.
Fusion: Big Arty CandlesAnyone who follows Arty knows about his "Big A** Candle" strategies.
I didn't like the BAC indicators that had code available so I wrote this one that has some decent flexibility and display options.
You can use this to enter a trade immediately after a BAC, probably in the opposite direction and ride the pullback that usually occurs or just use it to avoid trading until things settle down. I use it to avoid trading for a few bars on the 15 minute timeframe on bitcoin.
The settings are certainly not optimized so set them to whatever suits your needs as the defaults will probably be wrong for you.
The code is structured to easily drop into a bigger system so use it as a lone indicator or add the code to some bigger project you are creating. If you do integrate it into something else then send me a note as it would be nice to know it's being well used.
Finally, if you find value please do make a comment, give a thumbs up etc.
Enjoy and good luck!
Backtesting- IndicatorFor anyone interested, Here is an example of how to put backtesting results into an Indicator. This calculates the same values as you find in the Summary Screen of the built in Strategy backtester. This will use the same result size as the standard backtester i.e. 5 minute chart grabs roughly 1 month of data, 1 minute chart grabs 1 week of data, etc... I tried to keep this as self-contained as possible so I put most of the code for the results in the bottom of the Indicator. The results stop at the last completed trade signal i.e. a Buy has a Sell to it. This is the same indicator I posted earlier with the PCT Trailing StopLoss so you will see that code in here as well. As said in my previous posting, the indicator is just a simple EMA crossover to give it something to do and I would not recommend using this indicator on its own, but instead copy the code to your own indicator if you find it useful. I also left the code in so that you can switch back to a Strategy if you want to verify the results.
Additional Notes:
- The results are within an acceptable margin of error due to the fact that the Indicator is having to calculate based on when the Buy and Sell Signal occur as opposed to when actual trades occur like in the Strategy Backtester
- I was trying to find a way to set the number of Buy Signals to use i.e. show me the results from the past 100 trades but couldn't sort out the logic. I am open to suggestions. Also keep in mind I am not a coder by profession so if you have any ideas on that front, please explain it to me as though I am a 5 year old child and provide code examples if possible :)
- I included the Strategy results in the Screen Shots so that you can see where the results line up.
Additional Additional Note:
This is not financial advice. Use at your own risk.
Study forloop Star Diamond'Study forloop' pinescript Program to print star diamond
The Program Logic
I've taken the previous script and added a footer to it. instantly transformed into a diamond shape.
Study forloop Star Triangle'Study forloop' pinescript Program to print star Triangle
The Program Logic
For example, the following Pinescript programme will need two nested for loops. The outer forloop is for rows and the inner forloop is for columns or stars. to create a triangle shape.
Feature scalerFeature scaler | Pine Utilities series, ready to be used in "study-on-study" fashion |
Includes min-max, normalization, standardization and unit length scaling.
One and only source: en.wikipedia.org
Endpoint inputs allow to set an interval of interest for min-max scaler.
Can be (and should be) applied to other studies, or to the chart itself. In this example, I applied min-max scaling to weighted linear regression's slope values.
Unfortunately, "All data" is still "experimental" and works only on charts where less than 5000 bars are available. max_bars_back() didn't help.
Sup TV
High-pass filterHigh-pass filter | Pine Utilities series, ready to be used in "study-on-study" fashion |
Represents the difference between the filter and the original unfiltered data.
How to use:
1) Add a filter to your chart (in this particular case it was 4-pole Gaussian filter implemented by @everget, ty man);
2) Tap ... on your's filter status line and choose "Add study/strategy on ...", then choose High-pass filter. Alternatively, add high-pass filter directly to your chart, then High-pass filter's settings -> Basis -> choose the filter you've applied during the step 1;
3) Choose the source (op2 and hlcc4 are available as well);
4) See the difference (literally).
Peace TV
Pareto DistributionBasic Pareto distribution!
This is a simple exponential curve set on the 1 minute timeframe.
Three different gradients are used in the example image.
The strategy example. Close position by timeoutThis is an example how to close open entries by timeout for educational purpose.
[TEMPLATE] Code Block Comments█ OVERVIEW
Here I present to the community at large a collection of code comment blocks that I think will be useful, especially for larger script projects bordering on 2,000 lines or above of code.
█ PLANNED FUTURE UPDATES
Work with the community to expand this template to be even more useful with the inclusion of useful global colour sets, variables, tooltips, groups, etc.
better script thumbnail.
full-screen table or label outlining the script's use-cases.
make lead signalAdd derivative of a signal for leading behaviour
formula: sig = (lambda/100)*source + (1-lambda/100)**momentum )
it has a multiplier and an offset for adjustment of result.
final formula: sig = multiplier*( (lambda/100)*src + (1-lambda/100)*mom_coef*mom ) + offset
PnL and Buy & Hold TrackerIn this script I use a simple, not necessarily profitable, strategy of a cross of MAs to teach how to calculate and plot the PnL of each trade made by the indicator. I also show how to calculate the cumulative PnL of all trades and the Buy and Hold of the same period.
These calculations which are natively available in any strategy script, require a bit of resourcefulness to work in an indicator script.
It can be very useful to optimize parameters for the best performance of an indicator-based strategy.
I use variables to store the price of the asset at each buy signal to calculate the PnL with the closing price of that particular trade and another variable to store the price value of the first trade, which calculates the Buy and Hold percentage with the current price of the asset.
I plot the values of the trades in labels and the accumulated values in a table.
I also show how to calculate and plot the unrealized PnL of open trades.