Beta CalculatorBeta is a measure of an asset's volatility relative to the market (the S&P500 is the most widely used index for this). A beta of 1 indicates that the asset moves exactly like the market, a beta < 1 indicates that the asset is less volatile than the market, and a beta > 1 means that the asset amplifies market movements.
This tool is used to calculate easily the Beta coefficient of an asset using 4 parameters :
- Symbol : The Asset's Ticker
- Reference : The Market Index Ticker
- Lookback Candles : The number of candles to include in the calculation
- (Implict) Resolution : The timeframe you are using, defines the precision
Statistics
Chart gain/lossis not my code actually its a example in
Pine Script™ and charts become better acquainted
becaus is can useful and it unpublished i just publish that without any channges
As a trader scrolls or zooms on their chart – causing the range of visible bars on the chart to change – scripts using either of these new built-ins will automatically re-execute so that calculations and visuals can adapt to the new context. This opens the door to a whole new variety of scripts that dynamically adjust to changes in the range of visible bars.
This indicator draws an arrow from the open of the first visible bar to the close of the last, and shows the gain/loss for that range
Gotobi TeriyakiUSDJPY Anomaly.
This anomaly originated in Japan.
Buy from 2:00 pm Japan time.
Sell at 9:55 Japan time.
Japanese importers often settle payments to suppliers in dollars, and exchange yen for dollars on settlement days (days falling on a 5 or 10, so-called goto days).
Therefore, on goto days, there is sometimes a shortage of dollars held by financial institutions. This is called the "middle price shortage," and financial institutions purchase dollars through the foreign exchange market to resolve the middle price shortage.
As a result, the dollar currency is bought and USD/JPY depreciates against the yen. Since the yen has historically appreciated against the dollar, exporting companies make forward exchange contracts with financial institutions as a risk hedge.
Financial institutions are therefore forced to procure dollars in the market because they do not have enough dollars in their balance sheets to deliver to exporters.
Five days is called "GO" in Japanese.
Ten days is called "TO" in Japanese.
In Japanese, a day is called "BI".
Now I can eat teriyaki all day long :)
ドル円ゴトー日ストラテジーを作ってみました。
Overloaded Volume-Canddle v1This indicator will detect the candle has volume "too strong" base on "n" previous candle.
The Yellow Line is avg volume base n candle previous.
The Red line show over power volume of canlde.
Important : This indicator can use for forex, but i recommend it for binary options only.
Greater Currency Correlation Matrix (Forex)Other available matrixes I found have a limited number of forex symbols. Consequentially, you need to keep switching them if you want to do a proper analysis. As a result of that, I produced my own currency matrix.
Correlation studies relationships between different price charts.
High correlation may be completely random in the short term, but it may signify a fundamental relationship between the two symbols if calculated over the long term.
For example, the currency of an oil-producing country may rally along with oil, whereas the importer's currency may drop. This means that watching the oil price chart may be worth it for such pairs.
The script includes all Major and Minor pairs with the addition of Gold (XAUEUR) and two optional symbols.
▬▬▬▬
To avoid too frequent use of security(), I decided to calculate all symbol values from EUR pairs. It should improve performance and keep room for some additional symbols in the future.
Please report any bugs.
BTC - Novel RPPI IndicatorHey Everyone,
This is a collab effort between me (a statistician) and @Stein3d (A coder). So if you like this indicator, be sure to also give him the credit!
This a novel indicator theorized by me and applied by Stein3d. We are calling it the RPPI indicator, standing for Regression based Price Prediction Indicator.
This is specifically coded for BTC and cannot be used for alt coins or ETH.
This is pretty beta so your feedback and comments are encouraged!
I will keep it brief, but here is the run down:
What does it do:
The indicator does 3 main things:
1. Predicts bullish targets;
2. Predicts bearish targets;
3. Predicts close price
Who is it applicable for:
This is generally targeted to day trades, but it can have swing trade applications as well. Feel free to get creative with combining it with other indicators that you feel complement it well.
How does it work:
It uses statistical based regressive analysis of BTC to compare current price action to previous price action and determine where the natural high and lows will fall intra-day based on the current price action of the day.
How to use it:
This does not omit the need for technical analysis and chart interpretation; however, it sets realistic expectations of intra-day bullish and bearish price targets as well as its best guess of where the current day close is most likely to fall. Take a look at some of the images below:
The image is pretty self explanatory but you see that there are 2 bull and bear targets. The bull targets, of course, are listed in Green and the bear targets are listed in Red.
There is a dummy neutral support and resistance target which is listed in yellow and the close price is in the purple dotted line.
Of course these are all customizable.
I think that pretty much covers it in a nut shell but let us know if you have any other questions and also please provide feedback!
Thanks for checking it out!
Bar Count for BacktestingHello!
Not much special about this script; you can use date & time, or bar count, to ascertain the number of bars in a time period for backtesting.
This script can be used in conjunction with large scripts incorporating complex intricacies that won't load on 20,000+ bar data sets.
If your script's load time transcends the TV allotted load time - use this script to quickly determine the number of bars in the data set.
Through trial & error you should be able to determine the approximate number of bars your script can execute on without exceeding the imposed time limit!
The image above shows a user-defined time window and, consequently, the script returns the number of bars that constitute the time period.
You can drag the white vertical lines to efficiently configure the calculated time period.
The image above shows functionality for the "Bars Back" feature.
Enjoy!
Binance Futures Swap-Spot Basis LabelNote: This script will only work with Binance Futures Symbols
This script calculates the basis between the Binance Future and Binance Spot market for the coin you are currently viewing and paints a label on the chart which displays the percentage difference between future and spot. If the future is trading below the spot market the text will be red indicating backwardation and if the future is trading above spot, it will be green indicating contango. Please note this script will only work on Binance perps against Binance spot. The script will change based on what perp you are looking at, no inputs are required.
Candle ImbalanceIndicator that shows the imbalance between bearish and bullish candles for a given period.
Average, Median, Mode, Biggest: Pip Range Measures & LabelsApply various simple statistical measures to series of full candle ranges over user input length (in bars).
Choose between AVERAGE, MEDIAN, MODE, BIGGEST.
All calculations derive from the high-low range of a candle.
Default length = 260, the number of daily candles in a year.
MODE is calculated from pip ranges rounded to reasonable increments (to nearest 10pips foreign currencies; to nearest 100 pips for DXY ; nearest $10 for other assets). Best only use MODE for the major FX pairs encoded, and on Daily timeframe .
User input 'unit multiplier' only applies when asset is NOT a major Forex pair (unit and multiplier is auto applied for for major FX pairs).
© twingall
Future PreviewFuture Preview
Calculate real-time future order profit with open price, leverage and commission fee. Simple and straight forward. If you need any additional feature, please leave a comment below. I am glad to help.
Usage:
When adding Future Preview to chart, it will ask order open time and open price on the chart by clicking with left mouse on the desired value. These value can be changed lately, as well as the leverage and commission fee. Default leverage is 10 and default commission fee is 0.06% (taker).
There will be two horizontal lines. The solid longer line is the open price line, it shows the order open price. The shorter line moving with real-time price is the current price line, it shows the current price. There will be preview data shows on top or below the price line. Open price line is red for short order and green for long order. The current price line is red when the order is losing and it is green when it profiting. The back ground color follows the color of current price line. Background color transparency and gain/loss color can be changed in options.
There will be one horizontal line on the left if the option of showing open time is on (default is on). It shows the time stamp when current order opened.
After adding Future Preview to chart, there is option to add Taking Profit(TP) or Stop Loss(SL) to the chart.
Font size can be changed in option
Weighted Harrell-Davis Quantile Estimator with AD Oscillatorxel_arjona
Licensing:
This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International Copyright (c) 2021 ( CC BY-NC-SA 4.0)
Copyright's & Mentions:
The Gamma Functions & Beta Probability Density Functions C# implementations by the Math.NET Numerics, part of the Math.NET Project.
The Regularized Incomplete (Left) Beta Function C# implementation by the SAMTools, htslib project.
The Weighted Harrell-Davis Quantile estimator; C# & R implementations by Andrey Akinshin.
External PineScript code, methods, support & consultancy by @PineCoders staff with special mention for:
+ "ma sorter ('sort by array' example)- JD" by @Duyck.
+ Porting, mods, compilation and debugging for this script by @XeL_Arjona for the TradingView's @PineCoders community.
I made it an oscillator. Features include normalization, line display, and smoothing. :DDD Enjoy!
(Ive been wanting to do this for a while but I wanted to make the library first but you know what this was fun so there you go its here now)
Gap Size Outcome Statistics [vnhilton]This indicator displays a table with statistics showing the outcomes of gap ups or downs based on your threshold (i.e. does the day end in green or red?). This can be useful for trading, where you're using relevant ETFs & see that they've gapped up/down, & can assume based on statistics that the ETF will end in green/red depending on which has the higher probability (however, you can use these on any other instruments such as stocks to find edges e.g. seeing whether stock XYZ is more likely to end in green/red when it gaps up 100%).
The table also includes sample sizes for your threshold tests for more confidence in the statistics, & also displays average gap up & downs & their respective sample sizes as well. This indicator is intended to be used on the daily timeframe, but can be used on lower or higher timeframes if you prefer.
In the chart snapshot image above, we can see that when the SPY gaps up > 1%, the day is more likely to end in green than in red. But when the SPY gaps down < -1%, it's also more likely to end in green than in red.
( IMPORTANT NOTE : There's 1 limitation with this indicator & it's that it assumes that days where close=open are green days, & that 0% gaps exact are considered gap ups.)
% Per BarThis script compute the average price swing per bar (between High and low)
It does not include gaps between bars in the calcul
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
4 main Stablecoin MarketCapThis indicator summarized 4 main stablecoin marketcap (USDT, USDC , BUSD, DAI).
It is given that most of the transactions of cryptocurrencies are traded by stablecoins, and USDT, USDC , BUSD and DAI shared 90%+ of the stablecoins market capacity. Therefore, by summarizing these 4 main stablecoins total market capacity, can reflect the overall demand power.
When the indicator goes up, it is expected that the overall market demand will increase.
When the indicator goes down, it is expected that the cryptocurrencies market might be in a recession.
This indicator could be more useful in a longer timeframe, day-trade or even shorter might not be the suitable timeframe.
-----------------------------------------
V2 update
Separate 4 sectors and shadowed in different colors for 4 different stablecoins for more accurated view.
XBT Average Electricity CostXBT Average Electricity Cost
Cambridge Bitcoin Electricity Consumption Index (CBECI) - Bitcoin's global electricity consumption in TwH.
Note: Uses MONTHLY averages of raw data from CBECI. TV script run-time is too slow with Daily/Weekly data here.
This requires manual updating once a month for ongoing accuracy.
Source
My_PortfolioDisplays all time high/low/mean prices and average cost with lines; and the price changes relative to the average cost in percentages.
This does not calculate average cost. This is just a fast way of viewing the current situation of one's portfolio.
Parities invested in and average costs for them have to be manually entered in the settings or by editing the script.
Should work with all parities.
Integral (Area)This indicator calculates the area under a pre specified length of candles (Interval Integral)
When the area go high and the start dropping it will be an indication the we were in a correction and it's about to end.
AdxlLibrary "Adxl"
Functions to calculate the Average Directional Index
getDirectionUp(bar, lookback)
Bar high changed from open for bar
Parameters:
bar : series int The bar to calculate at
lookback : series int The lookback period
Returns: series float
getDirectionDown(bar, lookback)
Bar low changed from open for bar
Parameters:
bar : series int The bar to calculate at
lookback : series int The lookback period
Returns: series float
getPositiveDirectionalMovement(bar, lookback)
Positive directional movement for bar during lookback
Parameters:
bar : series int The bar to calculate at
lookback : series int The lookback period
Returns: series float
getNegativeDirectionalMovement(bar, lookback)
Negative directional movement for bar during lookback
Parameters:
bar : series int The bar to calculate at
lookback : series int The lookback period
Returns: series float
getTrueRangeMovingAverage(bar, lookback)
True range moving average for bar during lookback
Parameters:
bar : series int The bar to calculate at
lookback : simple int The lookback period
Returns: series int
getDirectionUpIndex(bar, lookback)
Direction up index for bar during lookback
Parameters:
bar : series int The bar to calculate at
lookback : simple int The lookback period
Returns: series int
getDirectionDownIndex(bar, lookback)
Direction down index for bar during lookback
Parameters:
bar : series int The bar to calculate at
lookback : simple int The lookback period
Returns: series int
getTotalDirectionIndex(bar, lookback)
Total direction index for bar during lookback
Parameters:
bar : series int The bar to calculate at
lookback : simple int The lookback period
Returns: series int
getAverageDirectionalIndex(bar, lookback)
Average Directional Index (ADX) for bar during lookback
Parameters:
bar : series int The bar to calculate at
lookback : simple int The lookback period
Returns: series int
Hash Ribbons OverlayThis is a modified Hash Ribbons indicator. You can get the original indicator for free at this link:
Differences from the original indicator
1) This is overlay version
2) Pointers appear under candlesticks, which is more visual
3) PineScript v5.0 was used
AdxCalcHourlyLibrary "AdxCalcHourly"
getBars()
getBars: Returns the number of bars to use in the historical lookback period
Returns: simple int
directionDown()
directionDown: Calculates the direction down for bar_index
Returns: series float
directionUp()
directionUp: Calculates the direction up for bar_index
Returns: series float
trueRangeMovingAverage()
trueRangeMovingAverage: Calculates the true range moving average over the historical lookback period
Returns: series float
positiveDirectionalMovement()
positiveDirectionalMovement: Calculates the positive direction movement for bar_index
Returns: series float
negativeDirectionalMovement()
negativeDirectionalMovement: Calculates the begative direction movement for bar_index
Returns: series float
totalDirectionDown()
totalDirectionDown: Calculates the total direction down for the historical lookback period
Returns: series float
totalDirectionUp()
totalDirectionUp: Calculates the total direction up for the historical lookback period
Returns: series float
totalDirection()
totalDirection: Calculates the total direction movement for the historical lookback period
Returns: series float
averageDirectionalIndex()
averageDirectionalIndex: Calculates the average directional index (ADX) based on the trend for the historical lookback period
Returns: series float
getAdxHistoricalAverage()
getAdxHistoricalAverage: Calculates the average directional index (ADX) for the historical lookback period
Returns: series float
getAdxHistoricalHigh()
getAdxHistoricalHigh: Calculates the historical high of the directional index (ADX) for the historical lookback period
Returns: series float
getAdxHistoricalLow()
getAdxHistoricalLow: Calculates the historical low of the directional index (ADX) for the historical lookback period
Returns: series float
getAdxOpinion()
getAdxOpinion: Calculatesa recomendation for the directional index (ADX) based on the historical lookback period
Returns: series float
Distance From Moving AverageThis indicator shows the distance between the current price and the Moving Average price.
Key Features:
Show the distance between price and Moving Average (Read Distance Calculation for more information)
Show Historic Highs and Lows
Show Highest High and Lowest Low
Show current Highest High, current Lowest Low and current distance
Key Indicator Settings:
1. Distance Calculation
There are two ways to calculate the distance:
Spread - Calculate the difference between the price and the moving average
Percentage - Calculate the percentage change between the price and the moving average
2. Moving Average Types
There are 5 different Moving Averages:
EMA
SMA
WMA
VWMA
HMA
3. Highest High and Lowest Low
You can show or hide the Highest High and the Lowest Low plots of the series
4. Historic Highs and Lows
You can show or hide past Highs and Lows of the series
Lookback Length - Let's you adjust the frequency of local highs and lows of the series
5. Current Values
You can show or hide current value labels