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.
Statistics
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
Australian Gross Domestic ProductAustralian Gross Domestic Product. Useful to know when looking at how the economy is going.
Percentage Movement MarkerThis indicator works on Data on closing basis and can be used to identify day wise price movements on the applied charts.
E.g. You want to find the Thursdays on which a particular script has given more than 2% Bullish Move.
You select 'Thursday' in the selected day setting and put 2% in the Bullish move setting.
This will mark Thursday on the chart as 'X' and mark those those Thursdays with a green arrow where the % Move was more than 2 %.
Money Velocity(GDP/M2)V=GDP/M2
Major world economy's money supply velocity. Compare how each country's monetary policy has played out and current trajectory in comparison to others. The velocity of money is a measure of the number of times that the average unit of currency is used to purchase goods and services within a given time period. The concept relates the size of economic activity to a given money supply, and the speed of money exchange is one of the variables that determine inflation.
Relevant Populations GroupedUSPOP Same idea as my previous grouped GDP indicator but now population sizes. Goes to show how a small portion of the world is responsible for most of what we consider economic productivity.
US/CA Bond Yield CurveEasy Viewing of 4 different duration bond yields for US and Canada. Bond prices and bond yields are excellent indicators of the economy as a whole, and of inflation in particular. A bond's yield is the discount rate that can be used to make the present value of all of the bond's cash flows equal to its price. Good as part of a macro set.
Expected DCA PriceShowing the expected price of the DCA strategy in half a year / one year / two years, weighted by the USD supply (M2) by default
.srb Alt.D excl.BTC,ETH,USDT,USDCThis is
Alt.Dominance chart excl.BTC, ETH, USDT, USDC.
You can see... pure alt.dominance chart...
Calc is
Alt.D excl.BTC, ETH, USDT, USDC = ( (CRYPTOCAP:TOTAL3 - CRYPTOCAP:USDT - CRYPTOCAP:USDC ) / CRYPTOCAP:TOTAL ) *100