Economic Profit (YavuzAkbay)The Economic Profit Indicator is a Pine Script™ tool for assessing a company’s economic profit based on key financial metrics like Return on Invested Capital (ROIC) and Weighted Average Cost of Capital (WACC). This indicator is designed to give traders a more accurate understanding of risk-adjusted returns.
Features
Customizable inputs for Risk-Free Rate and Corporate Tax Rate assets for people who are trading in other countries.
Calculates Economic Profit based on ROIC and WACC, with values shown as both plots and in an on-screen table.
Provides detailed breakdowns of all key calculations, enabling deeper insights into financial performance.
How to Use
Open the stock to be analyzed. In the settings, enter the risk-free asset (usually a 10-year bond) of the country where the company to be analyzed is located. Then enter the corporate tax of the country (USCTR for the USA, DECTR for Germany). Then enter the average return of the index the stock is in. I prefer 10% (0.10) for the SP500, different rates can be entered for different indices. Finally, the beta of the stock is entered. In future versions I will automatically pull beta and index returns, but in order to publish the indicator a bit earlier, I have left it entirely up to the investor.
How to Interpret
We see 3 pieces of data on the indicator. The dark blue one is ROIC, the dark orange one is WACC and the light blue line represents the difference between WACC and ROIC.
In a scenario where both ROIC and WACC are negative, if ROIC is lower than WACC, the share is at a complete economic loss.
In a scenario where both ROIC and WACC are negative, if ROIC has started to rise above WACC and is moving towards positive, the share is still in an economic loss but tending towards profit.
A scenario where ROIC is positive and WACC is negative is the most natural scenario for a company. In this scenario, we know that the company is doing well by a gradually increasing ROIC and a stable WACC.
In addition, if the ROIC and WACC difference line goes above 0, the company is now economically in net profit. This is the best scenario for a company.
My own investment strategy as a developer of the code is to look for the moment when ROIC is greater than WACC when ROIC and WACC are negative. At that point the stock is the best time to invest.
Trading is risky, and most traders lose money. The indicators Yavuz Akbay offers are for informational and educational purposes only. All content should be considered hypothetical, selected after the facts to demonstrate my product, and not constructed as financial advice. Decisions to buy, sell, hold, or trade in securities, commodities, and other investments involve risk and are best made based on the advice of qualified financial professionals. Past performance does not guarantee future results.
This indicator is experimental and will always remain experimental. The indicator will be updated by Yavuz Akbay according to market conditions.
COST
Scale In : Scale OutScale In : Scale Out strategy is an adaptation and extension of dollar-cost-averaging.
As the name implies it not only scales in - allocates a given percentage of available capital to buy at each bar - it also scales out - sells a given percentage of holdings at each bar when a target profit level is reached.
The strategy can potentially mitigate risks associated with market timing.
Although dollar-cost-averaging is often recommended as a strategy for building a position, the management of taking and retaining profits is not often addressed. This strategy demonstrates the potential benefits of managing both the building and (full or partial) liquidation of an investment.
We do not provide any mechanism for managing stop losses. We assume a scale in/out strategy will typically be applied to investing in assets with a high conviction thesis based on criteria external to the strategy. If the strategy does not perform, then the thesis may need to be re-evaluated, and the position liquidated. Even in this case, scaling out should still be considered.
Position Cost DistributionThe Position Cost Distribution indicator (also known as the Market Position Overview, Chip Distribution, or CYQ Algorithm) provides an estimate of how shares are distributed across different price levels. Visually, it resembles the Volume Profile indicator, though they rely on distinct computational approaches.
🟠 Principle
The Position Cost Distribution algorithm is based on the principle that a security's total shares outstanding usually remains constant, except under conditions like stock splits, reverse splits, or new share issuance. It views all trading activity as simply exchanging share positions between holders at different price points.
By analyzing daily trade volume and the prior day's distribution, the algorithm infers the resulting share distribution after each day. By tracking these inferred transpositions over time, the indicator builds up an aggregate view of the estimated share concentration at each price level. This provides insights into potential buying and selling pressure zones that could form support or resistance areas.
Together with the Volume Profile, the Position Cost Distribution gives traders multiple lenses for examining market structure from both a volume and positional standpoint. Both can help identify meaningful technical price levels.
🟠 Algorithm
The algorithm initializes by allocating all shares to the price range encompassed by the first bar displayed on the chart. Preferably, the chart window should include the stock's IPO date, allowing the model to distribute shares specifically to the IPO price.
For subsequent trading sessions, the indicator performs the following calculations:
1. The daily turnover ratio is calculated by dividing the bar's trading volume by total outstanding shares.
2. For each price level (bucket), the number of shares is reduced by the turnover amount to represent shares transferring from existing holders.
3. The bar's total volume is then added to buckets corresponding to that period's price range.
Currently, the model assumes each share has an equal probability of being exchanged, regardless of how long ago it was acquired or at what price. Potential optimizations could incorporate factors like making shares held longer face a smaller chance of transfer compared to more recently purchased shares.
────────────────────────────────────────────
中文介绍:该指标为“筹码分布”的一个 TradingView 实现 :)
Anchored VWAP+This indicator is an enhanced version of the Anchored VWAP indicator with additional functions:
1. Anchored AP (average price). It removes the volume weighting step in Anchored VWAP, and can display the average price over a period of time. For example, if the price of the stock in the last 3 days is 100, 200, 300, then AP is their average value of 200
2. Anchored AC (average cost). The average cost over time can be displayed. For example, if the price of the stock in the last 2 days is 100,300, then AC is (1+1)/(1/100+1/300)=150
When using the indicator, you need to choose a starting point, then the indicator will start to calculate the subsequent VWAP, AP and AC from this starting point, and draw 3 lines in the graph
These three lines can be regarded as the average cost line of the market, with potential support and resistance effects
We have filled the shadow between VWAP and AP, which can be regarded as a potential support resistance band
===========================中文版本===========================
该指标为增强版本的Anchored VWAP指标。在Anchored VWAP基础上增加了额外功能:
1. Anchored AP。其去掉了Anchored VWAP中成交量加权的步骤,可以显示一段时间的平均价格。举个例子,假如股票最近3天的价格为100,200,300,那么AP为他们的平均值200
2. Anchored AC。可以显示一段时间的平均成本。举个例子,假如股票最近2天的价格为100,300,那么AC为(1+1)/(1/100+1/300)=150
使用指标时你需要先选择一个起点,随后指标将会以该起点开始计算后续的VWAP、AP和AC,并且在图中绘制3根线
这3根线均可以视作是市场的平均成本线,具有潜在的支撑和阻力效果
我们让VWAP和AP之间填充了阴影,该阴影可以视作潜在的支撑阻力带
Average Cost (Costo Promedio)ENGLISH
This 'Average Cost' script allows the user to input and visualize profit or loss for different stocks (up to 50) with average cost and quantity data on a single chart. This is useful for tracking the profit or loss of each stock in real-time.
To use this script, the user should follow these steps:
1. Add the 'Average Cost' script to your TradingView chart.
2. In the script's configuration window, input the tickers, average costs, and quantity of shares for each ticker you want to monitor.
3. Click 'Accept' to apply the changes.
This script is primarily designed for stock markets, but can also be useful in other financial markets where the user is interested in tracking the performance of multiple assets.
ESPAÑOL
Este script de "Costo Promedio" permite al usuario ingresar y visualizar si hay ganancia o perdida para diferentes acciones (hasta 50) con los datos de costos promedio y cantidad de acciones en un solo gráfico. Esto es útil para realizar un seguimiento de la ganancia o pérdida de cada acción en tiempo real.
Para utilizar este script, el usuario debe seguir estos pasos:
1. Agregue el script "Costo Promedio" a su gráfico en TradingView.
2. En la ventana de configuración del script, ingrese los tickers, costos promedio y cantidad de acciones para cada ticker que desee monitorear.
3. Haga clic en "Aceptar" para aplicar los cambios.
Este script está diseñado principalmente para los mercados de acciones, pero también puede ser útil en otros mercados financieros donde el usuario esté interesado en rastrear el rendimiento de múltiples activos.
Blockchain Fundamentals: Electricity Cost of BTC [CR] Blockchain Fundamentals: Electricity Cost of BTC
After a hiatus, now a return to publishing tools and scripts for the community. This is my first script in over and year, and I have a number more coming soon as well! (so Stay Tuned!)
This is a simple calculator to estimate the cost of Bitcoin miners to mine one bitcoin. It works on all timeframes (doesnt have to be on daily).
By entering the inputs of total TH's, kWh used, cost of electricity per kWh (in USD cents) we can generate the electricity cost.
But miners also have other costs of operation including HVAC, maintenance, rent, etc. In light of that we include a multiplier that accounts for these extra costs. First, type in what percent of your total operating costs come from the electricity. Then check the enable total cost plot option and you will also see total costs in addition to electricity costs.
Its a simple model and gives anyone curious a starting point for their own testing and research.
FunctionDynamicTimeWarpingLibrary "FunctionDynamicTimeWarping"
"In time series analysis, dynamic time warping (DTW) is an algorithm for
measuring similarity between two temporal sequences, which may vary in
speed. For instance, similarities in walking could be detected using DTW,
even if one person was walking faster than the other, or if there were
accelerations and decelerations during the course of an observation.
DTW has been applied to temporal sequences of video, audio, and graphics
data — indeed, any data that can be turned into a linear sequence can be
analyzed with DTW. A well-known application has been automatic speech
recognition, to cope with different speaking speeds. Other applications
include speaker recognition and online signature recognition.
It can also be used in partial shape matching applications."
"Dynamic time warping is used in finance and econometrics to assess the
quality of the prediction versus real-world data."
~~ wikipedia
reference:
en.wikipedia.org
towardsdatascience.com
github.com
cost_matrix(a, b, w)
Dynamic Time Warping procedure.
Parameters:
a : array, data series.
b : array, data series.
w : int , minimum window size.
Returns: matrix optimum match matrix.
traceback(M)
perform a backtrace on the cost matrix and retrieve optimal paths and cost between arrays.
Parameters:
M : matrix, cost matrix.
Returns: tuple:
array aligned 1st array of indices.
array aligned 2nd array of indices.
float final cost.
reference:
github.com
report(a, b, w)
report ordered arrays, cost and cost matrix.
Parameters:
a : array, data series.
b : array, data series.
w : int , minimum window size.
Returns: string report.
DCA Bot IndicatorName: DCA Bot Indicator
Category: Dollar Cost Average.
Operating mode: Alerts at a specific time, day of the week and day of the month.
Trades duration: N/A.
Timeframe: 1H
Suggested usage: long-term investing DCA strategies.
Entry: Only indicates the time and then the day of the week or the day of the month to buy.
Exit: As per long-term Investor’s strategy.
Usage: If you want to perform a Dollar Cost Averaging approach with:
- Daily purchases (at a specific time)
- Weekly purchases (at a specific time and day of the week)
- Monthly purchases (at a specific time and day of the month)
It is then possible to set the alert text with a preferred message or for use with trade automation systems. The green background identify the specific time chosen.
It is possible to identify through the Bias Analyzer the best time for the daily purchase.
Configuration:
- Buy Time: hour you would like to buy, please consider that the script is executed at the end of the defined time, so if you would like to buy at 2, have to put 1.
- Buy only Days of the Week: you can select the day you want.
- Buy only on Day of Month, you can specify a specific day.
Credits:
- dsteaves for inspiration
Cost of SpreadAdd to a quote, set the current total transaction cost (i.e. Spread (%) to 0.04 if BTCUSDT binance future, Spread (base) 0.0001 if trading EURUSD with 1 pip net spread).
Both lines indicate the relative volatility corrected cost of trading (ATR as orange line, StdDev as cyan).
ETF / Stocks / Crypto - DCA Strategy v1Simple "benchmark" strategy for ETFs, Stocks and Crypto! Super-easy to implement for beginners, a DCA (dollar-cost-averaging) strategy means that you buy a fixed amount of an ETF / Stock / Crypto every several months. For instance, to DCA the S&P 500 (SPY), you could purchase $10,000 USD every 12 months, irrespective of the market price. Assuming the macro-economic conditions of the underlying country remain favourable, DCA strategies will result in capital gains over a period of many years, e.g. 10 years. DCA is the safest strategy that beginners can employ to make money in the markets, and all other types of strategies should be "benchmarked" against DCA; if your strategy cannot outperform DCA, then your strategy is useless.
Recommended Chart Settings:
Asset Class: ETF / Stocks / Crypto
Time Frame: H1 (Hourly) / D1 (Daily) / W1 (Weekly) / M1 (Monthly)
Necessary ETF Macro Conditions:
1. Country must have healthy demographics, good ratio of young > old
2. Country population must be increasing
3. Country must be experiencing price-inflation
Necessary Stock Conditions:
1. Growing revenue
2. Growing net income
3. Consistent net margins
4. Higher gross/net profit margin compared to its peers in the industry
5. Growing share holders equity
6. Current ratios > 1
7. Debt to equity ratio (compare to peers)
8. Debt servicing ratio < 30%
9. Wide economic moat
10. Products and services used daily, and will stay relevant for at least 1 decade
Necessary Crypto Conditions:
1. Honest founders
2. Competent technical co-founders
3. Fair or non-existent pre-mine
4. Solid marketing and PR
5. Legitimate use-cases / adoption
Default Robot Settings:
Contribution (USD): $10,000
Frequency (Months): 12
*Robot buys $10,000 worth of ETF, Stock, Crypto, regardless of the market price, every 12 months since its founding time.*
*Equity curve can be seen from the bottom panel*
Risk Warning:
This strategy is low-risk, however it assumes you have a long time horizon of at least 5 to 10 years. The longer your holding-period, the better your returns. The only thing the user has to keep-in-mind are the macro-economic conditions as stated above. If unsure, please stick to ETFs rather than buying individual stocks or cryptocurrencies.
Bitcoin Production CostBitcoin's Production Cost
Based on raw data from CBECI.
Follow me to read more about the calculation logic.
Mining Cash Flow LineTakes QUANDL Bitcoin blockchain difficulty data, three variables (hashrate in THs/sec, power consumption in kWh, and electricity costs in cents/kWh) and calculates the base line for cash flow in US dollars. The default is an AntMiner S15 at 10 cents/kWh.
When price is above this line, miners with the given conditions have positive cash flow (i.e. they make more money mining than their running costs), and when below the line, they would be better off turning their rigs off (if this simple model can be applied to their particular circumstance).
Assumptions:
1. All costs are consolidated into one "electricity cost" variable, including things like rent and wages for mining farms.
2. 12.5 BTC/block emission schedule (update source code upon next halving).
Warnings:
It is likely that actual costs to miners varies in complex ways. This indicator only shows a cash flow calculation for a very simple set of parameters that will generally apply to miners, but not necessarily all of them. (For example, a miner may be locked into a prepaid contract for cheap electricity, or sell exhaust heat in the winter for extra revenue.)
Positive cash flow is also different from ROI, as this model does not take into account the cost of acquiring an ASIC mining rig.