MAP Money ManagementThis indicator lets you manage your risk as your assets in each position SO you can see the right way in money management and risk management as well
when you know how much you need to put in your positions you should see the volume of your trade and control your risk to be a winner in all ways and have the best win rate.
You can use it so easy and it is going to so helpful
good luck
การจัดการพอร์ตการลงทุน
Crypto Portfolio ManagementCrypto Portfolio Management
This is an indicator not like the other ones that you regularly see in tradingview. The main difference is that this indicator does not plot a value for each candle bar like you would see with RSI or MACD. Actually it is table and it just uses tradingview great database of assets to plot some valuebale information that can not be found elsewhere easily. These metrics are some basic one that is used by portfolio managers to decide what they want to hold in their portfolio. The basic idea is that you should hold assets in your basket that are less correlated to the benchmark.
Benchmark in traditional context refers to main market indices like S&P 500 of US market. But they already have a lot of tools available. My effort was for crypto investors who are trying to rebalance their portfolio every month or week to have some good metrics to make decision. Because of this I used Bitcoin as crypto market benchmark. So, everything is compared to bitcoin in this script. I’m gonna explain the terms that is used in the table’s columns below.
MAKE SURE YOU PUT YOUR CHART AT DAILY AND AT THE MAXIMUM AVAILABLE DATA EXCHANGE.
Y-Exp
This is yearly expected return of the asset. It is simply the mean of the yearly returns of the asset. (these calculations are not typical in Tradingview because mainly we calculate on each bar and give value at the same bar but here this value to change once a year). Remember that the higher this value is the better it is because historically the asset have shown good returns but there is a tip: Always check the available historical data in any asset that you are adding if you add an asset that has only 1 year of data available or you use an exchange data that recently added the coin you will get unsignificant results and the results can not be trusted. You should always selects coins and market (coins can be changed in setting) that have the largest data available.
Y-SDev
This is a little bit complicated than the previous. This is the standard deviation of the yearly returns. This is a classic measure of RISK in financial markets. The higher the value, the more risk is involved with the asset that you have added. If you added two assets that have same returns but different Standard deviations, the rational thinker should choose the asset with lower Standard deviation.
The standard deviation is a good place to start but there are some considerations to have -it is getting complicated and average user should not be involved with these terms and can ignore the next phrases- standard deviation and mean of the yearly returns are random variables, these variables have a theoretical probability density function and these functions are not gaussian normal distribution. Because of this in the professional usage these returns should be transformed to a normal distribution and have all these terms calculated there and then transform back to its own normal state and then be used for any serious investment decision. I think these calculations can be done on Tradingview but I need you support to do this in the form of like and share of my scripts and ideas.
M-Exp and M-SDev
These terms are like the previous ones but it is calculated on monthly returns. As it goes for yearly return, the monthly returns change once a monthly candle closes. So be patient to use this indicator.
I highly recommend not to make decisions on monthly data due to a lot of noise involved with this market but in long run it is ok. So go with yearly returns and wait at least for 3 years to see your results.
CorToBTC
Basically you want to buy something that is less correalted with the benchmark. this is the correlation of the asset to bitcoin.
Sharpe Ratio
This is one of the most used metric as a risk adjusted return measurment. you can google it for more information. The higher this value the better. remmeber with any invenstment it is important to understand risks associated with the assets that you are buying.
DownFromATH
This metric that I didn't see anywhere in the tradingview and is familiar in the platforms like coinmarketcap. this is a real calculation of precentage down from ATH (All Time High). it means how much percentage a coin is down from the maximum price that the asset has experienced until now.
***
Remember you can change all the asset except main asset. If you like this script to 500 I will update this continuously.
Correlation with Matrix TableCorrelation coefficient is a measure of the strength of the relationship between two values. It can be useful for market analysis, cryptocurrencies, forex and much more.
Since it "describes the degree to which two series tend to deviate from their moving average values" (1), first of all you have to set the length of these moving averages. You can also retrieve the values from another timeframe, and choose whether or not to ignore the gaps.
After selecting the reference ticker, which is not dependent from the chart you are on, you can choose up to eight other tickers to relate to it. The provided matrix table will then give you a deeper insight through all of the correlations between the chosen symbols.
Correlation values are scored on a scale from 1 to -1
A value of 1 means the correlation between the values is perfect.
A value of 0 means that there is no correlation at all.
A value of -1 indicates that the correlation is perfectly opposite.
For a better view at a glance, eight level colors are available and it is possible to modify them at will. You can even change level ranges by setting their threshold values. The background color of the matrix's cells will change accordingly to all of these choices.
The default threshold values, commonly used in statistics, are as follows:
None to weak correlation: 0 - 0.3
Weak to moderate correlation: 0.3 - 0.5
Moderate to high correlation: 0.5 - 0.7
High to perfect correlation: 0.7 - 1
Remember to be careful about spurious correlations, which are strong correlations without a real causal relationship.
(1) www.tradingview.com
Fed Funds Rate ProjectionsThis script makes projections via drawing boxes based upon changes in the fed funds rate (FRED:EFFR).
It works by turning the change in the fed funds rate into a user defined percentage (using a multiplier, by default a 1% rate of change implies a 10% change in the chart) and then drawing a box that distance away depending on the direction of the rate of change.
The size of the multiplier should depend on the duration of the asset which this is being applied to, for example, a long duration asset such as a high beta growth stock should use a larger multiplier.
R:R Trading System FrameworkFirst off, huge thanks to @fikira! He was able to adapt what I built to work much more efficiently, allowing for more strategies to be used simultaneously. Simply put, I could not have gotten to this point without you. Thanks for what you do for the TV community. Second, I am fairly new to pinescript writing, so I welcome criticism, thoughtful input and improvement suggestions. I would love to grow this concept into something even better, if possible. So please let me know if you have any ideas for improvement. However I do juggle a lot of different things outside of TV, so implementations may be delayed.
I have decided, at this time, not to add alerts. First, because I feel most people looking to adapt this framework can add their own pretty easily. Also, given how customized the framework is currently, while also attempting to account for all the possible ways in which people may want alerts to function after they customize it, it seems best to leave them out as it doesn't exactly fit the idea of a framework.
For best viewing, I recommend hovering over the script's name > ... > Visual order > Bring to front. Also I found hollow candles with mono-toned colors (like pictured) are more visually appealing for me personally. I HIGHLY RECOMMEND USING WITH BAR REPLAY TO BETTER UNDERSTAND THE FRAMEWORK'S FUNCTIONALITY.
▶️ WHAT THIS FRAMEWORK IS
- A huge collection of concepts and capabilities for those trying to better understand, learn, or teach pinescript.
- A system designed to showcase Risk:Reward concepts more holistically by providing all of the most popular components of retail trading to include backtesting, trade visual plotting, position tracking, market condition shifts, and useful info while positioned to help highlight changes in your risk:reward based decision-making processes.
- A system that can showcase individual strategies regardless of trade direction, allowing you to develop hedging strategies without having multiple indicators that do not correlate with each other.
- Designed around the idea that you trade less numbers of assets but manage your positions and risk based on multiple concurrently running strategies to manage your risk exposure and reward potential.
- An attempt to combine all the things you need to execute with an active trading management style.
- A framework that uses backtested results (in this case the number of averaged bars it takes to hit key levels) in real-time to inform your risk:reward decision-making while in-trade (in this case in your Trade Tracking Table using dynamic color to show how you might be early, on-time, or late compared to the average amount of backtested time it normally takes to hit that specific key level).
▶️ WHAT THIS FRAMEWORK IS NOT
- A complete trading product. DO NOT USE as-is. It is a FRAMEWORK for you to generate ideas of your own and fairly easily implement your own triggering conditions in the appropriate sections of the script.
▶️ USE CASES
- If you decide you like the Stop, Target, Trailing Stop, and Risk:Reward components as-is, then just understanding how to plug in your Entry and Bullish / Bearish conditions (Triangles) and adjust the input texts to match your custom naming will be all you need to make it your own!
- If you want to adapt certain components, then this system gives you a great starting point to adapt your different concepts and ideas from.
▶️ SYSTEM COMPONENTS
- Each of the system's components are described via tooltips both in the input menu and in the tables' cells.
- Each label on the chart displays the corresponding price at those triggered conditions on hover with tooltips.
- The Trailing Stop only becomes active once it is above the Entry Price for that trade, and brightens to show it is active. The STOP line (right of price) moves once it takes over for the Entry Stop representing the level of the Trailing Stop at that time for that trade.
- The Lines / Labels to the right of price will brighten once price is above for Longs or below for Shorts. The Trade Tracking Table cells will add ☑️ once price is above for Longs or below for Shorts.
- The brighter boxes on the chart show the trades that occurred based on your criteria and are color coded for all components of each trade type to ensure your references are consistent. (Defaults are TV built-in strategies)
- The lighter boxes on the chart show the highest and lowest price levels reached during those trades, to highlight areas where improvements can be made or additional considerations can be accounted for by either adjusting Entry triggers or Bullish / Bearish triggers.
- Default Green and Red Triangles (Bullish / Bearish) default to having the same triggering condition as the Entry it corresponds to. This is to highlight either a pyramiding concept, early exit, or you can change to account for other things occurring during your trades which could help you with Stop and Target management/considerations.
TradingView and many of its community members have done a lot for me, so this is my attempt to give back.
Custom IndexCreate your own stock index with up to 20 tickers!
The weight of the index can be selected from market capitalization and equal weight.
You can easily see how your favorite stocks are performing.
In addition, moving average lines (10SMA, 20SMA, 50SMA, 100SMA, 150SMA, 200SMA) can also be displayed as an option.
----以下日本語
最大20銘柄を用いて独自の株価指数を作成できます!
指数のウェイトは時価総額、イコールウェイトから選択でき、
お気に入りの銘柄群がどのようなパフォーマンスなのか簡単に分かります。
また、移動平均線(10SMA、20SMA、50SMA、100SMA、150SMA、200SMA)もオプションで表示可能です。
Investing - Correlation Table This correlation tables idea is nothing new, many sites provides it.
However, I couldn't find any simple correlation indicator on TradingView despite how simple this indicator is.
This indicator works as its called. Calculating the correlation between 2 projects (can be used in stocks as well) using the 'ta.correlation' feature built into pinescript.
When it comes to investing, we do not want our stocks / crypto project to be heavily correlated to each other.
If they are heavily correlated to each other, then there isn't much point in diversifying.
That being said, it can be useful for traders who trade multiple pairs.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
In this indicator, consist of 5 primary input and 15 secondary input (Symbol List).
Correlation Source:
This input options allow you to change how the correlation is calculated. By default, it uses 'close'.
Correlation Percentage(%):
This input options allows you configure how many (%) of correlation is considered as 'decoupled'.
This correlation will only move between -100% ~ 100%.
100% refers to it moving together.
-100% refers to it moving the opposite direction.
For example, Project A rises in Price, what is the possibility of Project B following:
A 100% correlation between Project A and Project B, refers to Project B will follow Project A movement.
A 50% correlation between Project A and Project B, refers to there is only 50% chance for Project B to follow Project A movement.
A -20% correlation between Project A and Project B, refers to there is a 20% chance of Project B moving the opposite direction of Project A
(Refers to the table on chart above to better understand what the numbers means. DOT/USD has a 100% correlation to DOT/USD. However. MXCUSDT has a -37.2% correlation to DOT/USD.)
Amounts Bars To Check:
This input options will check the amount of bars since the last bar in the chart.
If you want to know the correlation of the past 100 days in a daily chart, you will enter '100' into this options and it will check only the past 100 days.
Symbol List
This will allow you to input all the project symbol ticker ID to add into the correlation table.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
Originally, I wish to use for loop to go through the symbol list to reduce the amount of code required. However, due to limitation of 'request.security' feature, I had to abandon that idea and use hard-coded for requesting security and use a while loop to identify the symbol correlation value in the array set then set the table value accordingly.
If there is any script writer could improve this or any unclear explanation, feel free to drop a comment below.
Plots CAGR lines for a given set of ratesPlots CAGR lines for a given set of rates from a specified time. It will be helpful to see how the rate of growth of a security's price is changing over a period of time. It also calculates the current CAGR from the time specified. Works on D, W, M timeframes.
Risk:RewardThis Indicator displays Entry and Exits levels. The display is done under 3 modes:
- Risk/Reward mode (the one by default. It is set to a 1:1 ratio)
- Multiples TP Levels
- Custom Levels
Click to Set entry Price on chart
The displaying is static by default
to make it dynamic disable the "Use custom Entry ?" input.
Disclaimer: Scripts that I post publicly are experimental. They are not financial advices. Always backtest your ideas using your own methodologies.
Position Size Calc. (Minimalist)This is a simplified position size calculator in the form of a table.
The reason I published this script is because all other position size calculator scripts try to provide way too much when it should be much simpler, position in strange areas of the chart and leave unwanted chart pollution.
This is a bare-bones functional table that takes your risk level, entry, stop and take profit as inputs, and calculates your loss, profit and required position size for your chosen risk level as a result.
Inspired by a table type position size calculator made by DojiEmoji design/color-wise. Functionally different however.
I hope you find this script useful and include it on your trading journey.
Manual Stop Loss / Risk Management PanelHere is a panel where you enter the desired stop-loss price, the amount you would like to risk and it spits out what you should trade to only lose that amount if the stop-loss is hit.
Key Performance IndicatorWe are happy to introduce the Key Performance Indicator by Detlev Matthes. This is an amazing tool to quantify the efficiency of a trading system and identify potential spots of improvement.
Abstract
A key performance indicator with high explanatory value for the quality of trading systems is introduced. Quality is expressed as an indicator and comprises the individual values of qualitative aspects. The work developing the KPI was submitted for the 2017 VTAD Award and won first prize.
Introduction
Imagine that you have a variety of stock trading systems from which to select. During backtesting, each trading system will deliver different results with regard to its indicators (depending on, inter alia, its parameters and the stock used). You will also get different forms of progression for profit development. It requires great experience to select the “best” trading system from this variety of information (provided by several indicators) and significantly varying equity progression forms. In this paper, an indicator will be introduced that expresses the quality of a trading system in just one figure. With such an indicator, you can view the results of one backtest at a glance and also more easily compare a variety of backtesting results with one another.
If you are interested in learning more about the calculations behind this indicator then I have included a link to the english version of his research paper.
Along with this, we now offer indicator development services. If you are interested in learning more then feel free to reach out to get a quote for your project.
**Please note that we have NOT inputted any real strategy into the code and therefore it is not producing any real value. Feel free to change the code as desired to test any strategy!**
drive.google.com
Pyramiding Order Volume CalculatorThis is a script to calculate the order volume for the current symbol given your current portfolio value and how many orders you want to place. This is useful when using a strategy that places pyramiding orders and your bot won't automatically divide up your portfolio.
Grid Settings & MMThis script is designed to help you plan your grid trading or when averaging your position in the spot market.
The script has a small error (due to the simplification of the code), it does not take into account the size of the commission.
You can set any values on all parameters on any timeframe, except for the number of orders in the grid (from 2 to 5).
The usage algorithm is quite simple:
1. Connect the script
2. Install a Fibo grid on the chart - optional (settings at the bottom of the description)
3.On the selected pair, determine the HighPrice & LowPrice levels and insert their values
4.Evaluate grid data (levels, estimated profit ’%’, possible profit ‘$’...)
And it's all)
Block of variables for calculating grid and MM parameters
Variables used regularly
--- HighPrice and LowPrice - constant update when changing pairs
--- Deposit - deposit amount - periodically set the actual amount
Variables that do not require permanent changes
--- Grids - set the planned number of grids, default 5
--- Steps - the planned number of orders in the grid, by default 5
--- C_Order - coefficient of increasing the size of orders in the base coin, by default 1.2
--- C_Price - trading levels offset coefficient, default 1.1
--- FirstLevel - location of the first buy level, default 0.5
--- Back_HL - number of candles back, default 150
*** For C_Order and C_Price variables, the value 1 means the same order size and the same distance between buy levels.
The fibo grid is used for visualization, you can do without it, ! it is not tied to the script code !
You can calculate the levels of the Fibo grid using the formula:
(level price - minimum price) / (maximum price - minimum price)
For default values, grid levels are as follows:
1 ... 0.5
2...0.359
3 ... 0.211
4...0.0564
5...-0.1043
Short description:
in the upper right corner
--- indicator of the price movement for the last 150 candles, in % !!! there is no task here to "catch" the peak values - only a relative estimate.
in the upper left corner
--- total amount of the deposit
--- the planned number of grids
--- “cost” of one grid
--- the size of the estimated profit depending on the specified HighPrice & LowPrice
in the lower left corner
--- Buy - price levels for buy orders
--- Amount - the number of purchased coins in the corresponding order
--- Sell - levels of profit taking by the sum of market orders in the grid
--- $$$ - the sum of all orders in the grid, taking into account the last active order
--- TP - profit amount by the amount of orders in the grid
Custom IndexEnables users to create their own custom Stock Index with up to 29 tickers! Has included optionality to include/exclude certain sectors, plot sectors individually and measure in gold. Good for having a look at how your favorite tickers have performed (with your modification of course). Also has option to show Moving Averages for your convenience.
EPS Surprise (Working)Plots the EPS surprise between reported and estimate.
* This is a working version of the old EPS Surprise indicator here that seems to have been abandoned.
Forex Lot Size CalculatorTo use indicator you need to provide enter and stop prices(you can drag these lines also). Also you able to set your Account Size in USD, Risk in % and Commission you pay your broker per lot.
Indicator calculates all this information and provides you with Lot Size(with commission) you need to open a position and target prices for 2R and 3R(also includes commission).
Feel free to comment and request new features.
RELATIVE VALUE TRADE MANAGEMENT WEBHOOKThis script it's created to send open-close signals via webhook. It allows you to open a relative value position based in the relative graph. You can set the TP and SL levels and the script will send the signal to your exchange.
Due a pine limitations it is necessary apply the script in the 2 different actives and set the alerts. You can just do the relative analysis and then go to the first asset and set the script. Create your alert and then just go to the other asset and create the alert. It doesn't necessary to change anything in the script because the levels are the same.
It is also possible to do the analysis using the script, deploying the relative graph, but could be annoying sometimes due scales.
Positions will be placed at close always.
THIS IS IMPORTANT: I use Zignaly as a exhange so if you are using Binance or other YOU MUST CHANGE the code. If you know the JSON format that It requires would be easy.
Here is tips in all the important imputs. But let me explain the most important.
The MANDATORY fields are:
Ticker IDs: Here you must write the EXACT ID code for the active. Caps included.
Example : BINANCE:SUSHIUSDTPERP
It is also important select the correct market side. If you want to be long of ANY active you must write that ID in the LONG ID. For short positions is the same.
Time frame: Here you can select the time frame of the graph (not the current active graph, I mean the relative one.) The orders will be send using that time frame. I recommend to do the analysis in other window and then use the script to trigger the order in the time frame that you want.
Money management: In these fields you can select the qty that you will lose if the SL level is reach. Based in a determinated amount of currency or in a % of your capital.
Dates: It is important to select the start date. If the order is already open, we must look for the moment where the activation price was reached. If the order is unopened it is better to select the current date, so the order will be triggered when the entry level is reached.
Ids: If you have current open position you can set here that ID to send the correct order to the exchange.
To set the alert just call the function {{{strategy.order.alert_message}}}
Diversified Investment EMA Cross Strategy SimulatorThis simulating indicator proves that even if you use a simple strategy, you can reduce your risk by diversifying your investments.
The strategy itself is simple.(only long)
Buy when 50 days EMA crosses over 200 days EMA.
Sell when 50 days EMA crosses under 200 days EMA.
Or, stop loss when the asset falls by 2% (eg).
Using this simple strategy on an asset is just a test of your luck.
However, this capital change graph shows that risk can be reduced by diversifying investment into eight assets rather than one asset.
Options
Total Assets Capital Change represents the sum of capital changes for 8 assets. The gray line is the initial capital.
Each Asset Capital Change represents all eight asset capital changes. In this case, the gray line is displayed as the initial capital divided by 8.
The rest of the options show a graph of capital change for each asset, showing when buys and sells occurred.
And set the start date, initial capital, stop loss %, and commission.
And select the 8 assets you want to invest in and you are ready to go. To effectively reduce risk, uncoupled assets would be better if possible.
The table in the lower right shows the selected asset and color.
Please enjoy the simulation.
NK Sir's SRTFirst of all I would like to thanks Nitish Sir for teaching us the concept of SRT, which proves to be an excellent tool for Investing.
In a year, there are around 248 to 252 trading days .
On dividing the same by 2 we get 124. Even 125 / 126 can be taken.
We get SRT value by dividing Nifty Spot with 124 SMA value & SRT is applicable on Nifty in a Day Chart.
This value ranges in between 0.6 (Low) to 1.38/1.4/1.45/1.5 (High).
Ideal Entry in a stock will be at 0.6, which is very rare. You tend to buy at 0.7/0.8/0.9/1.10.
Exit from a stock will be at 1.3 - 1.5.
However generally we get a value of 0.8/0.9 and we should start investing 20 % of our capital that we have planned to invest. For every 0.1 decrease in SRT Value, we should add 20% to the stock portfolio.
Start Booking Profit if SRT value above 1.35 & book 50 % of the portfolio when SRT value is 1.45.
For Traders, as an when SRT value comes to 0.8/ 0.9. Buy when Hilega Milega gives us a clear BUY signal on Monthly Time Frame.
Stock bought at SRT value of 0.6 tend to double in a year. It generally quite rare to see a SRT Value of 0.6.
Koalafied Risk ManagementTables and labels/lines showing trade levels and risk/reward. Use to manage trade risk compared to portfolio size.
Initial design optimised for tickers denominated against USD.
Strategy Multiple Orders + Statistics Template - EducationalHello traders
It's been a while
We're back in a bear market so I have a bit more time to publish new Pine scripts for the TradingView community
Special thanks to @fikira for his Multiple Orders script () and to @carnagecain for allowing me to publish this script we worked together on
I got widely inspired by @fikira's script for that one
This script is for educational purposes only - I wanted to show how we can add multiple TPs/SL + a table with custom statistics
In this Strategy template, users can define multiple take-profit and multiple stop-loss levels.
Basically, we have 4 trades per trend and each trade has its own SL/TP
Statistics
Stats are split per trade direction (Long, Short) and then consolidated
I put custom stats in that table such as:
- Probability of Win
- Probability of Loss
- Avg Profit/Loss per Trade
- APPT: (Probability of Win * Average Gross Profit) - (Probability of Loss * Average Loss)
- Number of times each TP/SL has been hit
I'm catching up with all recent pinescript features as we speak - more educational scripts template to come soon
Best Regards
Dave