USDT+USDC+BUSD Market CapThis Pine Script indicator visualizes the combined market capitalization of three prominent stablecoins: USDT, USDC, and BUSD, on a daily basis.
It fetches the daily closing market caps of these stablecoins and sums them. The resulting line graph is displayed in its own separate pane below the main price chart.
The line is color-coded: green on days when the market cap is increasing compared to the previous day, and red when it's decreasing.
BTC-D
High/Low of week: Stats & Day of Week tendencies// Purpose:
-To show High of Week (HoW) day and Low of week (LoW) day frequencies/percentages for an asset.
-To further analyze Day of Week (DoW) tendencies based on averaged data from all various custom weeks. Giving a more reliable measure of DoW tendencies ('Meta Averages').
-To backtest day-of-week tendencies: across all asset history or across custom user input periods (i.e. consolidation vs trending periods).
-Education: to see how how data from a 'hard-defined-week' may be misleading when seeking statistical evidence of DoW tendencies.
// Notes & Tips:
-Only designed for use on DAILY timeframe.
-Verification table is to make sure HoW / LoW DAY (referencing previous finished week) is printing correctly and therefore the stats table is populating correctly.
-Generally, leaving Timezone input set to "America/New_York" is best, regardless of your asset or your chart timezone. But if misaligned by 1 day =>> tweak this timezone input to correct
-If you want to use manual backtesting period (e.g. for testing consolidation periods vs trending periods): toggle these settings on, then click the indicator display line three dots >> 'Reset Points' to quickly set start & end dates.
// On custom week start days:
-For assets like BTC which trade 7 days a week, this is quite simple. Pick custom start day, use verification table to check all is well. See the start week day & time in said verification table.
-For traditional assets like S&P which trade only 5 days a week and suffer from occasional Holidays, this is a bit more complicated. If the custom start day input is a bank holiday, its custom 'week' will be discounted from the data set. E.g.1: if you choose 'use custom start day' and set it to Monday, then bank holiday Monday weeks will be discounted from the data set. E.g.2: If you choose 'use custom start day' and set it to Thursday, then the Holiday Thursday custom week (e.g Thanksgiving Thursday >> following Weds) would be discounted from the data set.
// On 'Meta Averages':
-The idea is to try and mitigate out the 'continuation bias' that comes from having a fixed week start/end time: i.e. sometimes a market is trending through the week start/end time, so the start/end day stats are over-weighted if one is trying to tease out typical weekly profile tendencies or typical DoW tendencies. You'll notice this if you compare the stats with various custom start days ('bookend' start/end days are always more heavily weighted). I wanted to try to mitigate out this 'bias' by cycling through all the possible new week start/end days and taking an average of the results. i.e. on BTC/USD the 'meta average' for Tuesday would be the average of the Tuesday HoW frequencies from the set of all 7 possible custom weeks(Mon-Sun, Tues-Mon, Weds-Tues, etc etc).
// User Inputs:
~Week Start:
-use custom week start day (default toggled OFF); Choose custom week start day
-show Meta Averages (default toggled ON)
~Verification Table:
-show table, show new week lines, number of new week lines to show
-table formatting options (position, color, size)
-timezone (only for tweaking if printed DoW is misaligned by 1 day)
~Statistics Table:
-show table, table formatting options (position, color, size)
~Manual Backtesting:
-Use start date (default toggled OFF), choose start date, choose vline color
-Use end date (defautl toggled OFF), choose end date, choose vline color
// Demo charts:
NQ1! (Nasdaq), Full History, Traditional week (Mon>>Friday) stats. And Meta Averages. Annotations in purple:
NQ1! (Nasdaq), Full History, Custom week (custom start day = Wednesday). And Meta Averages. Annotations in purple:
Quantitative Trend Strategy- Uptrend longTrend Strategy #1
Indicators:
1. SMA
2. Pivot high/low functions derived from SMA
3. Step lines to plot support and resistance based on the pivot points
4. If the close is over the resistance line, green arrows plot above, and vice versa for red arrows below support.
Strategy:
1. Long Only
2. Mutable 2% TP/1.5% SL
3. 0.01% commission
4. When the close is greater than the pivot point of the sma pivot high, and the close is greater than the resistance step line, a long position is opened.
*At times, the 2% take profit may not trigger IF; the conditions for reentry are met at the time of candle closure + no exit conditions have been triggered.
5. If the position is in the green and the support step line crosses over the resistance step line, positions are exited.
How to use it and what makes it unique:
Use this strategy to trade an up-trending market using a simple moving average to determine the trend. This strategy is meant to capture a good risk/reward in a bullish market while staying active in an appropriate fashion. This strategy is unique due to it's inclusion of the step line function with statistics derived from myself.
This description tells the indicators combined to create a new strategy, with commissions and take profit/stop loss conditions included, and the process of strategy execution with a description on how to use it. If you have any questions feel free to PM me and boost if you enjoyed it. Thank you, pineUSERS!
TTP NVT StudioNVT Studio is an indicator that aims to find areas of reversal of the Bitcoin price based on the extreme areas of Network Value Transaction.
Instructions:
- We recommend using it on INDEX:BTCUSD
- Use the daily or weekly timeframe
The indicator works as an oscillator and offers to visualisation modes.
1) Showing the short term oscillations of NVT showing signals in potential areas of reversal.
2) The actual value of NVT displayed. When in green is an area of value and in red when its overextended.
This indicator can be used based on the signals or based on breakouts of trend lines drawn in the oscillator mode.
Red/green dots: signal type 1 - extremes with confirmation, these might trigger late
Yellow/Orange: signal type 2 - extremes without confirmation, might trigger too soon
TTP Breaking PointThis signal uses information from BITFINEX:BTCUSDLONGS and BITFINEX:BTCUSDSHORTS to forecast tops and bottoms.
The idea behind is very simple.
We calculate the RSI of the ratio of longs vs shorts and find areas where both the SMA of this RSI and the RSI itself are overextended.
You might notice that the win rate is not high but most of the wins provide a decent move that, if combined with proper risk management, can be used to build profitable strategies.
The signal offers a backtesting stream: 1 for buy and 2 for sell.
Shortly I'll be adding new features including: alerts, support for other symbols, filters, etc.
Fierytrading: Volatility DepthDear Tradingview community,
I'd like to share one of my staple indicators with you. The volatility depth indicator calculates the volatility over a 7-day period and plots it on your chart.
This indicator only works for the DAILY chart on BTC/USD.
Colors
I've color coded the indicator as follows:
- Red: Extreme Volatility
- Orange: High Volatility
- Yellow: Normal Volatility
- Green: Low Volatility
Red: extreme changes in price. Often during local tops and bottoms.
Orange: higher than average moves in price. Often before or after a "red" period. Often seen in the middle of bear or bull markets.
Yellow: normal price action. Often seen during early stage bull-markets and late stage bear-markets.
Green: very low price movement. Often during times of indecision. Once this indicator becomes green, you can expect a big move in either direction. Low volatility is always followed by high volatility.
In a long-term uptrend, a green period often signals a bullish break out. In a long-term downtrend it often signals a bearish break out.
How to use
Save the indicator and apply it to your chart. You can change the length in the settings, but it's optimized for 7 days, so no need to change it.
I've build in alerts for all 4 different volatility periods. In most cases, the low volatility alert is enough.
Good luck!
Correlation Coefficient - DXY & XAUPublishing my first indicator on TradingView. Essentially a modification of the Correlation Coefficient indicator, that displays a 2 ticker symbols' correlation coefficient vs, the chart presently loaded.. You can modify the symbols, but the default uses DXY and XAU, which have been displaying strong negative correlation.
As with the built-in CC (Correlation Coefficient) indicator, readings are taken the same way:
Positive Correlation = anything above 0 | stronger as it moves up towards 1 | weaker as it moves back down towards 0
Negative Correlation = anything below 0 | stronger moving down towards -1 | weaker moving back up towards 0
This is primarily created to work with the Bitcoin weekly chart, for comparing DXY and Gold (XAU) price correlations (in advance, when possible). If you change the chart timeframe to something other than weekly, consider playing with the Length input, which is set to 35 by default where I think it best represents correlations with Bitcoin's weekly timeframe for DXY and Gold.
The intention is that you might be able to determine future direction of Bitcoin based on positive or negative correlations of Gold and/or the US Dollar Index. DXY has been making peaks and valleys prior to Bitcoin since after March 2020 black swan event, where it peaked just after instead. In the future, it may flip over again and Bitcoin may hit major highs or lows prior to DXY, again. So, keep an eye on the charts for all 3, as well as the indicator correlations.
Currently, we've moved back into negative correlation between Bitcoin and DXY, and positive correlation with Bitcoin and Gold:
Negative Correlation b/w Bitcoin and DXY - if DXY moves up, Bitcoin likely moves down, or if DXY moves down, Bitcoin likely moves up (or if Bitcoin were to move first before DXY, as it did on March 2020, instead)
Positive Correlation b/w Bitcoin and Gold - Bitcoin and Gold will likely move up or down with each other.
DXY is represented by the green histogram and label, Gold is represented by the yellow histogram and label. Again, you can modify the tickers you want to check against, and you can modify the colors for their histograms / labels.
The inspiration from came from noticing areas of same date or delayed negative correlation between Bitcoin and DXY, here is one of my most recent posts about that:
Please let me know if you have any questions, or would like to see updates to the indicator to make it easier to use or add more useful features to it.
I hope this becomes useful to you in some way. Thank you for your support!
Cheers,
dudebruhwhoa :)
Buy / Sell Fractal Algorithm with SL Line GenerationThis algorithm is designed for usage across indices.
How it works?
The algorithm uses a variation of fractals, momentum, RSI and LRSI to determine a trends direction.
The Relative Strength Index (RSI) is a momentum-based oscillator used to measure the speed (velocity) and change (magnitude) of directional price movements. It provides a visual means to monitor both the current and historical strength and weakness of a particular market. The strength or weakness is based on closing prices over the duration of a specified trading period, creating a reliable metric of price and momentum changes
Momentum in trading refers to the direction and magnitude of price. Momentum plays a key role in assessing trend strength, and it is important to know when a trend is slowing down. Less momentum does not always lead to a reversal, but it does signal that something is changing, and the trend may consolidate or reverse
Fractals are patterns within price changes which are repeated across thousands of bars. Examples of fractals include the golden ratio, PHI and the spirals of the milk way. They are quite literally a universal concept.
Basics of usage:
When a bullish trend is detected; the algorithm will generate a green "SL Line" at a calculated point, which can be interpreted as an invalidation line.
If the price goes below this line, the bullish trend is invalidated. So long as it holds, the bullish trend is true until the next detection change.
When a bearish trend is detected; the algorithm will generate a red "SL Line", at a calculated point, which can be interpreted as an invalidation line.
If the prices goes above this line, the bearish trend is invalidated. So long as it holds, the bearish trend is true until the next detection change.
When a given trend is invalidated, the SL Line turns yellow and you enter a "pause zone", where neither a bearish nor bullish trend is calculated.
This resets itself on the next trend detection.
Additional information:
I have coded my own backtest to this algorithm, along with plotting the profit / loss of each generated trade.
The profit is calculated by the difference between the open bar of the trade after a long ( or short ) and the following trade.
If we are calculating a short, the resulting value is then multiplied by -1 to get a positive integer.
For calculating a loss we take the value of the open bar of the trade that generates a long, and take the difference between this and the SL line, and similarly for short positions. The code assumes the user is placing their SL at the indicated line.
Within the input settings there are a few customisation options:
Alpha & Fractal Energy Length & Source - Should not be changed.
Highly bands crossover? - Has no visible effect whether on or off. It refers to the fractal chart which in this iteration is not visible and rather a backend mechanic.
Apply fractal energy? - Should generally be left turned on. This is a noise reduction. Disabling will result in over-trading.
Apply normalization? - Has no impact, is solely used to make the fractal values more human-readable rather than decimal format.
Offset - refers to the offset value of the SL Line generations. This should be set to a value that gives you enough breathing room, and remember to include any spreads! Default is 0.2, written in %
Trading hours - This simply gives a session input for the trading hours you want to trade within, and then colours the background green for that session. Trading 24/7 is never a wise strategy, stick to whatever is most optimal for you.
Leverage - Whatever leverage you are using. Default is x20. This will affect the profit / loss calculations accordingly.
Start equity - refers to the equity value you want to backtest with. Some assets will generate NA for this in the backtest label explained later.
Label customisation options.
Note that the backtest label is by default hidden, and appears when you hover over the black label at the current bar. When enabled to visible, it will show a large text label that may cover your chart screen more than you wish.
Alerts -
There are dozens of alert functionalities here; first are the timeframe assignments for each alert, set by default to 2hrs.
These timeframes then affect the asset you select in the corresponding setting.
In total there are 8 additional assets you can set alerts for.
Once you have assigned the timeframe and asset for an alert, you can then check the tick box for that individual alert.
Once done, you set the alert as normal through the tradingview alerts window. Remember to set "alert function calls only"
-
Timers:
I have added some functionality for timers to be set, values are in minutes. These work on the exact time of placement. Do not change the extra symbol formula option.
-
Note that this backtest is not intended as a replacement for tradingview backtest, nor is there a guarantee that historical results are to be replicated in the future. Trading is inherently risky.
Correlation prix [SP500, TESLA, BTCBefore you see this post I want to thank all the TradingView team. Every day that passes I learn better and better to use Pine script and I owe this to all those who publish and to the philosophy of TradingView. Thanks from Amos
This trading indicator compares the prices of the S&P 500 Index (SP500), Tesla (TSLA), and Bitcoin (BTC) to find correlations between them. To make the prices of SP500 and Tesla comparable to the price of Bitcoin, the indicator multiplies the closing price of Tesla by 114 and the closing price of the S&P 500 Index by 5.6.
In this way we can superimpose the prices on the BTC chart and see what happens.
Average BTC price/ tesla price = 114, so if we multiply the tesla price by 114 times we can superimpose it on the BTC price
At average BTC/SPX price = 5.6, also in this case we multiply the price of SPX by 5.6 to overlay the graph and see any correlations.
The indicator then calculates the average price between SP500 and Tesla, using the formula (SP500 + Tesla) / 2. This calculation creates a new line on the chart that represents the average price between these two assets.
The BTC_SP_TE variable is then calculated as the average of the closing price of Bitcoin and the previously calculated average price of SP500 and Tesla, using the formula (Btc + SP_TE) / 2. This calculation creates another line on the chart that represents the average price between Bitcoin and the previously calculated average between SP500 and Tesla.
The idea behind calculating these averages is to find correlations and patterns between the prices of these assets, which can help identify potential trading opportunities. By comparing the average prices of different assets, the trader can look for trends and patterns that might not be apparent when looking at each asset individually.
The indicator plots these prices on a chart and fills the area between them with either green or fuchsia, depending on which one is higher. The strategy suggests buying Bitcoin when the average price of SP500 and Tesla is higher than the current price of Bitcoin, and selling when it is lower.
To add visual cues to the trading strategy, the indicator uses the plotchar function to display a small triangle below the chart when it detects a potential buying opportunity. This is done with the following parameters:
Value: BTC_SP_TE < Btc and Btc > Btc1 and Btc1 > Btc , which is a logical expression that checks whether the average price of SP500 and Tesla is less than the current price of Bitcoin (BTC_SP_TE < Btc), and whether the current price of Bitcoin is higher than the price 10 bars ago (Btc > Btc1 ) and higher than the price on the previous bar (Btc1 > Btc ).
Text: "Moyen BTC_SP_Te", which is the text to display inside the marker.
Symbol: "▲", which is the symbol to use for the marker. In this case, it is a small triangle pointing upwards.
Location: location.belowbar, which specifies that the marker should be placed below the bar.
I hope this is an example of how to create an indicator on TradingView, remember that correlations do not always last, it is possible that when you see the graph this correspondence no longer exists, do your studies and get inspired.
Rsi strategy for BTC with (Rsi SPX)
I hope this strategy is just an idea and a starting point, I use the correlation of the Sp500 with the Btc, this does not mean that this correlation will exist forever!. I love Trading view and I'm learning to program, I find correlations very interesting and here is a simple strategy.
This is a trading strategy script written in Pine Script language for use in TradingView. Here is a brief overview of the strategy:
The script uses the RSI (Relative Strength Index) technical indicator with a period of 14 on two securities: the S&P 500 (SPX) and the symbol corresponding to the current chart (presumably Bitcoin, based on the variable name "Btc_1h_fixed"). The RSI is plotted on the chart for both securities.
The script then sets up two trading conditions using the RSI values:
A long entry condition: when the RSI for the current symbol crosses above the RSI for the S&P 500, a long trade is opened using the "strategy.entry" function.
A short entry condition: when the RSI for the current symbol crosses below the RSI for the S&P 500, a short trade is opened using the "strategy.entry" function.
The script also includes a take profit input parameter that allows the user to set a percentage profit target for closing the trade. The take profit is set using the "strategy.exit" function.
Overall, the strategy aims to take advantage of divergences in RSI values between the current symbol and the S&P 500 by opening long or short trades accordingly. The take profit parameter allows the user to set a specific profit target for each trade. However, the script does not include any stop loss or risk management features, which should be considered when implementing the strategy in a real trading scenario.
Kimchi Premium StrategyThis strategy is based on the Korea Premium, also known as the “Kimchi Premium,” which indicates how expensive or cheap the price of Bitcoin in Korean Won on a Bitcoin exchange in South Korea is relative to the price of Bitcoin being traded in USD or Tether. Inverse Kimchi Premium RSI was newly defined to create a strategy with Kimchi Premium. Assuming that the larger the kimchi premium, the greater the individual's purchasing power. In this case, if the Inverse Kimchi Premium RSI falls and closes the candle below the bear level, a short is triggered. Long is the opposite.
This strategy defaults to a combination of the traditional RSI and the Inverse Kimchi Premium RSI. If the user wishes to unlock the Inverse Kimchi Premium RSI combination and only use it as a traditional RSI strategy, the following settings can be used.
Use Combination of Inverse Kimchi Premium RSI: Uncheck
Resolution: Chart (4hr Candle)
Source: Close
Length of RSI: 14
Bull Level: 74
Bear Level: 25
__________________________________________________________________________________
김치프리미엄(김프) 전략은 달러 혹은 테더로 거래되고 있는 비트코인 가격 대비 한국에 있는 비트코인 거래소의 비트코인 원화 가격이 얼마나 비싸고 싼 지를 나타내는 코리아 프리미엄, 일명 "김치 프리미엄" 지표를 기반으로 만들어졌습니다. 김치 프리미엄을 가지고 전략을 만들기위해 Inverse Kimchi Premium RSI를 새롭게 정의하였습니다. 김치 프리미엄이 커질수록 개인의 매수세가 커진다고 가정하고, 이 경우 Inverse Kimchi Premium RSI이 하락하여 Bear Level 아래에서 캔들 마감을 하면 Short을 트리거 합니다. Long은 그 반대입니다.
이 전략은 전통적인 RSI와 Inverse Kimchi Premium RSI을 조합하여 기본값을 설정하였습니다. 유저가 원한다면 Inverse Kimchi Premium RSI의 조합을 해제하고 전통적인 RSI 전략으로만 사용하려면 아래 다음의 설정값을 사용할 수 있습니다.
Use Combination of Inverse Kimchi Premium RSI: 체크 해제
Resolution: Chart (4hr Candle)
Source: Close
Length of RSI: 14
Bull Level: 74
Bear Level: 25
ATR Mean Reversion Strategy V1**Long Only Strategy**
When Price drops below the ATR band below it will enter a buy on the next candle open
SL at current price minus ATR* ATR multiplier
TP at Mean EMA or if higher than Mean EMA and current candle low is below previous candle low or if price is above ATR
NB: I would highly recommend a low fee broker (I use ICmarkets raw spread account) due to the fact that this is a decently high frequency trading strategy you will rack up a lot of commission, if you use and exchange like Bybit or Binance the strategy will not be profitable due to the high commissions.
Altcoin Dominance (without ETH) Excluding Stablecoins UnsymetricAltcoin Dominance (without ETH) Excluding Stablecoins Unsymetric
The purpose of the script is to show Altcoin's strength without Ethereum once we exclude stablecoins.
So we look into all altcoins besides eth and besides stablecoins divided by a value of eth+btc
BTC Pair Change %This script makes it easier to quickly check how the BTC pair of the current symbol is performing on any pair.
It adds a " change percentage widge t" (of the BTC pair ) to the top right of the chart.
(Refer to the image for an example.)
The change percentage calculation is performed as described here:
www.tradingview.com
To match the "Chg%" that appears on TradingView watchlists, a 24H (1440min) timeframe is used, as described here:
money.stackexchange.com
In short, this script:
Searches for the BTC pair of the current symbol
Calculates the change % using the above described logic (links)
Adds a " change percentage widget " (of the BTC pair) to the top right of the chart
Allows for using 24H timeframe or the current timeframe (enable " Use current timeframe " under the script options)
PSAR BBPT ZLSMA BTC 1minLong entry:
PSAR gives buy signal
BBPT prints green histogram
ZLSMA is below the price
ZLSMA has uptrend
SL is smaller than the max SL
Optional Sessions and EMA filters
Short entry
PSAR gives sell signal
BBPT prints red histogram
ZLSMA is above the price
ZLSMA has downtrend
SL is smaller than the max SL
Optional Sessions and EMA filters
SL:
Placed below ZLSMA + offset on long
Placed above ZLSMA + offset on short
TP1:
1x the SL by default
Takes no profit by default, 50% is also a good setting
TP2:
2x the SL by default
Take out all remaining position size.
If price reaches TP1, the SL is set to the entry price.
BitCoin RSI TrendWhat is it?
This indicator will plot the RSI of BTC with a red or green background based on the top and bottom values which you can set.
How to use it?
For example, you want to trade only if the RSI of BTC is between 50 and 70, so the top value is 70 and bottom is 50. If the RSI value between those values the background will be green, else it will be red.
Why to use it?
The buy and sell strength of the BTC controls the other coins, and it is noticeable when the BTC is over sold and the RSI exceeding the 70, the price will reverse its movement to down, thus it is advisable to not open long position if the RSI of BTC is above the 70-75. Also, if the RSI is under 50 there is a big possibility to move down further to the over bought areas. The best is to buy a altcoins when the BTC RSI is between 50 and 70.
For example, I could avoid a bad long trade on MATICUSDT when the RSI of BTC is going under 50
Or, get a good long trade on MATICUSDT when the RSI of BTC is between 50 and 70
True Bitcoin Value USD - Mario MThe average mining costs of one bitcoin equals to the true intrinsic value
Globally, the Bitcoin network uses around 0.5% of the world’s electrical power supply.
The sheer amount of electrical power and complex hardware required to operate a mining farm has intrinsic value.
This gives bitcoin a fundamental cost to create, and thus intrinsic value.
RSI and MA with Trailing Stop Loss and Take Profit (by Coinrule)The relative strength index is a momentum indicator used in technical analysis. It measures the speed and magnitude of a coin's recent price changes to evaluate overvalued or undervalued conditions in the price of that coin. The RSI is displayed as an oscillator (a line graph essentially) on a scale of zero to 100. When the RSI reaches oversold levels, it can provide a signal to go long. When the RSI reaches overbought levels, it can mark a good exit point or alternatively, an entry for a short position. Traditionally, an RSI reading of 70 or above indicates an overbought situation. A reading of 30 or below indicates an oversold condition.
A moving average (MA) calculates the average of a selected range of prices, usually closing prices, by the number of periods in that range. Essentially it is used to help smooth out price data by creating a constantly updated average price.
The Strategy enters and closes trades when the following conditions are met:
Entry Conditions:
RSI is greater than 50
MA9 is greater than MA50
RSI increases by 5
Exit Conditions:
Price increases by 1% trailing
Price decreases by 2% trailing
This strategy is back-tested from 1 January 2022 to simulate how the strategy would work in a bear market. The strategy provides good returns.
The strategy assumes each order is using 30% of the available coins to make the results more realistic and to simulate you only ran this strategy on 30% of your holdings. A trading fee of 0.1% is also taken into account and is aligned to the base fee applied on Binance.
Time Based Crypto DayTrade StrategyThis is a time based strategy, designed to enter and exit within the same day of the week, using different hours for entry and exit.
The script is long only direction, and it has no risk management inside, so use it with caution.
At the same time you can also calculate each individual hour return within a certain day, and make your own idea about the best moments to be enter.
In order to filter a bit from the bad trades, I have applied an ATR filter, to check if that volatility is rising in order to help eliminate some of the bad trades when there is no volatility around.
For this example, on BTC, it seems that for the last years, on tuesday and thursday, enterring at the beginning of the daily candle, 01:00hours and exit at 00:00 hours, seems to give positive results giving the idea that can be converted in some sort of edge into our favor.
However dont take this entirelly for granted and conduct your own searches
Trend Following based on Trend ConfidenceThis is a Trend Following strategy based on the Trend Confidence indicator.
The goal of this strategy is to be a simple Trend Following strategy, but also to be as precise as possible when it comes to the question 'how confident are we that a linear trend is ongoing?'. For this we calculate the 'confidence' of a linear trend in the past number of closing prices. The idea of this strategy is that past a certain confidence, the ongoing linear trend is more likely to continue than not.
Trend Confidence:
The Trend Confidence shows us how strong of a linear trend the price has made in the past number (given by Length parameter) of closing prices. The steepness of the price change makes the Trend Confidence more extreme (more positive for an uptrend or more negative for a downtrend), and the deviation from a straight line makes the Trend Confidence less extreme (brings the confidence closer to 0). This way we can filter out signals by wild/sudden price moves that don't follow a clear linear trend.
Math behind the Trend Confidence:
A linear fit is made on the past number of closing prices, using Ordinary Linear Regression. We have the steepness of the linear fit: b in y=a+bx . And we have the standard deviation of the distances from the closing prices to the linear fit: sd . The Trend Confidence is the ratio b/sd .
Entries and Exits:
For entry and exit points we look at how extreme the Trend Confidence is. The strategy is based on the assumption that past a certain confidence level, the ongoing linear trend is more likely to continue than not.
So when the Trend Confidence passes above the 'Long entry" threshold, we go Long. After that when the Trend Confidence passes under the 'Long exit' threshold, we exit. The Long entry should be a positive value so that we go Long once a linear uptrend with enough confidence has been detected.
When the Trend Confidence passes below the 'Short entry' threshold, we go Short. After that when the Trend Confidence passes above the 'Short exit' threshold, we exit. The Short entry should be a negative value so that we go Short once a linear downtrend with enough confidence has been detected.
Default Parameters:
The strategy is intended for BTC-USD market, 4 hour timeframe. The strategy also works on ETH-USD with similar parameters.
The Length is arbitrarily set at 30, this means we look at the past 30 closing prices to determine a linear trend. Note that changing the length will change the range of Trend Confidence values encountered.
The default entry and exit thresholds for Longs and Shorts do not mirror each other. This is because the BTC-USD market goes up more heavily and more often than it goes down. So the ideal parameters for Longs and Shorts are not the same.
The positive results of the strategy remain when the parameters are slightly changed (robustness check).
The strategy uses 100% equity per trade, but has a 10% stop loss so that a maximum of 10% is risked per trade.
Commission is set at 0.1% as is the highest commission for most crypto exchanges.
Slippage is set at 5 ticks, source for this is theblock.co.
Ichimoku Cloud with MACD and Trailing Stop Loss (by Coinrule)The Ichimoku Cloud is a collection of technical indicators that show support and resistance levels, as well as momentum and trend direction. It does this by taking multiple averages and plotting them on a chart. It also uses these figures to compute a “cloud” that attempts to forecast where the price may find support or resistance in the future.
The Ichimoku Cloud was developed by Goichi Hosoda, a Japanese journalist, and published in the late 1960s. It provides more data points than the standard candlestick chart. While it seems complicated at first glance, those familiar with how to read the charts often find it easy to understand with well-defined trading signals.
The Ichimoku Cloud is composed of five lines or calculations, two of which comprise a cloud where the difference between the two lines is shaded in.
The lines include a nine-period average, a 26-period average, an average of those two averages, a 52-period average, and a lagging closing price line.
The cloud is a key part of the indicator. When the price is below the cloud, the trend is down. When the price is above the cloud, the trend is up.
The above trend signals are strengthened if the cloud is moving in the same direction as the price. For example, during an uptrend, the top of the cloud is moving up, or during a downtrend, the bottom of the cloud is moving down.
The MACD is a trend following momentum indicator and provides identification of short-term trend direction. In this variation it utilises the 12-period as the fast and 26-period as the slow length EMAs, with signal smoothing set at 9.
This strategy combines the Ichimoku Cloud with the MACD indicator to better enter trades.
Long/Exit orders are placed when three basic signals are triggered.
Long Position:
Tenkan-Sen is above the Kijun-Sen
Chikou-Span is above the close of 26 bars ago
Close is above the Kumo Cloud
MACD line crosses over the signal line
Exit Position:
Price increases 3% trailing
Price decreases 3% trailing
The script is backtested from 1 June 2022 and provides good returns.
The strategy assumes each order is using 30% of the available coins to make the results more realistic and to simulate you only ran this strategy on 30% of your holdings. A trading fee of 0.1% is also taken into account and is aligned to the base fee applied on Binance.
BTC Indicator By Megalodon TradingThis indicator is designed help you see the potential reversal zones and it helps you accumulate for the long run.
This combines price data on any chart. The chart isolates between 0 and -100. Below -80 is a buy, above -20 is a sell location.
In these locations, try to Slowly Buy and Slowly Sell (accumulate...)
Story Of This Indicator
~I was always obsessed with Fibonacci and used Fibonacci all the time. Thus, i wanted to make a tool to see buying locations and selling locations.
Instead of drawing fibonacci's and manually interpreting buy/sell locations, i wanted algorithms to do the job for me. So, i created this algorithm and many more like it.
If you think i did a good job and want to do further work with me, feel free to contact.
I have a ton of other tools that can change everything for your trading/investing.
Best wishes
~Megalodon
Linear EDCA v1.2Strategy Description:
Linear EDCA (Linear Enhanced Dollar Cost Averaging) is an enhanced version of the DCA fixed investment strategy. It has the following features:
1. Take the 1100-day SMA as a reference indicator, enter the buy range below the moving average, and enter the sell range above the moving average
2. The order to buy and sell is carried out at different "speed", which are set with two linear functions, and you can change the slope of the linear function to achieve different trading position control purposes
3. This fixed investment is a low-frequency strategy and only works on a daily level cycle
----------------
Strategy backtest performance:
BTCUSD (September 2014~September 2022): Net profit margin 26378%, maximum floating loss 47.12% (2015-01-14)
ETHUSD (August 2018~September 2022): Net profit margin 1669%, maximum floating loss 49.63% (2018-12-14)
----------------
How the strategy works:
Buying Conditions:
The closing price of the day is below the 1100 SMA, and the ratio of buying positions is determined by the deviation of the closing price from the moving average and the buySlope parameter
Selling Conditions:
The closing price of the day is above the 1100 SMA, and the ratio of the selling position is determined by the deviation of the closing price and the moving average and the sellSlope parameter
special case:
When the sellOffset parameter>0, it will maintain a small buy within a certain range above the 1100 SMA to avoid prematurely starting to sell
The maximum ratio of a single buy position does not exceed defInvestRatio * maxBuyRate
The maximum ratio of a single sell position does not exceed defInvestRatio * maxSellRate
----------------
Version Information:
Current version v1.2 (the first officially released version)
v1.2 version setting parameter description:
defInvestRatio: The default fixed investment ratio, the strategy will calculate the position ratio of a single fixed investment based on this ratio and a linear function. The default 0.025 represents 2.5% of the position
buySlope: the slope of the linear function of the order to buy, used to control the position ratio of a single buy
sellSlope: the slope of the linear function of the order to sell, used to control the position ratio of a single sell
sellOffset: The offset of the order to sell. If it is greater than 0, it will keep a small buy within a certain range to avoid starting to sell too early
maxSellRate: Controls the maximum sell multiple. The maximum ratio of a single sell position does not exceed defInvestRatio * maxSellRate
maxBuyRate: Controls the maximum buy multiple. The maximum ratio of a single buy position does not exceed defInvestRatio * maxBuyRate
maPeriod: the length of the moving average, 1100-day MA is used by default
smoothing: moving average smoothing algorithm, SMA is used by default
useDateFilter: Whether to specify a date range when backtesting
settleOnEnd: If useDateFilter==true, whether to close the position after the end date
startDate: If useDateFilter==true, specify the backtest start date
endDate: If useDateFilter==true, specify the end date of the backtest
investDayofweek: Invest on the day of the week, the default is to close on Monday
intervalDays: The minimum number of days between each invest. Since it is calculated on a weekly basis, this number must be 7 or a multiple of 7
The v1.2 version data window indicator description (only important indicators are listed):
MA: 1100-day SMA
RoR%: floating profit and loss of the current position
maxLoss%: The maximum floating loss of the position. Note that this floating loss represents the floating loss of the position, and does not represent the floating loss of the overall account. For example, the current position is 1%, the floating loss is 50%, the overall account floating loss is 0.5%, but the position floating loss is 50%
maxGain%: The maximum floating profit of the position. Note that this floating profit represents the floating profit of the position, and does not represent the floating profit of the overall account.
positionPercent%: position percentage
positionAvgPrice: position average holding cost
--------------------------------
策略说明:
Linear EDCA(Linear Enhanced Dollar Cost Averaging)是一个DCA定投策略的增强版本,它具有如下特性:
1. 以1100日SMA均线作为参考指标,在均线以下进入定买区间,在均线以上进入定卖区间
2. 定买和定卖以不同的“速率”进行,它们用两条线性函数设定,并且你可以通过改变线性函数的斜率,以达到不同的买卖仓位控制的目的
3. 本定投作为低频策略,只在日级别周期工作
----------------
策略回测表现:
BTCUSD(2014年09月~2022年09月):净利润率26378%,最大浮亏47.12%(2015-01-14)
ETHUSD(2018年08~2022年09月):净利润率1669%,最大浮亏49.63%(2018-12-14)
----------------
策略工作原理:
买入条件:
当日收盘价在 1100 SMA 之下,由收盘价和均线的偏离度,以及buySlope参数决定买入仓位比例
卖出条件:
当日收盘价在 1100 SMA之上,由收盘价和均线的偏离度,以及sellSlope参数决定卖出仓位比例
特例:
当sellOffset参数>0,则在 1100 SMA以上一定范围内还会保持小幅买入,避免过早开始卖出
单次买入仓位比例最大不超过 defInvestRatio * maxBuyRate
单次卖出仓位比例最大不超过 defInvestRatio * maxSellRate
----------------
版本信息:
当前版本v1.2(第一个正式发布的版本)
v1.2版本设置参数说明:
defInvestRatio: 默认定投比例,策略会根据此比例和线性函数计算得出单次定投的仓位比例。默认0.025代表2.5%仓位
buySlope: 定买的线性函数斜率,用来控制单次买入的仓位倍率
sellSlope: 定卖的线性函数斜率,用来控制单次卖出的仓位倍率
sellOffset: 定卖的偏移度,如果大于0,则在一定范围内还会保持小幅买入,避免过早开始卖出
maxSellRate: 控制最大卖出倍率。单次卖出仓位比例最大不超过 defInvestRatio * maxSellRate
maxBuyRate: 控制最大买入倍率。单次买入仓位比例最大不超过 defInvestRatio * maxBuyRate
maPeriod: 均线长度,默认使用1100日MA
smoothing: 均线平滑算法,默认使用SMA
useDateFilter: 回测时是否要指定日期范围
settleOnEnd: 如果useDateFilter==true,在结束日之后是否平仓所持有的仓位平仓
startDate: 如果useDateFilter==true,指定回测开始日期
endDate: 如果useDateFilter==true,指定回测结束日期
investDayofweek: 每次在周几定投,默认在每周一收盘
intervalDays: 每次定投之间的最小间隔天数,由于是按周计算,所以此数字必须是7或7的倍数
v1.2版本数据窗口指标说明(只列出重要指标):
MA:1100日SMA
RoR%: 当前仓位的浮动盈亏
maxLoss%: 仓位曾经的最大浮动亏损,注意此浮亏代表持仓仓位的浮亏情况,并不代表整体账户浮亏情况。例如当前仓位是1%,浮亏50%,整体账户浮亏是0.5%,但仓位浮亏是50%
maxGain%: 仓位曾经的最大浮动盈利,注意此浮盈代表持仓仓位的浮盈情况,并不代表整体账户浮盈情况。
positionPercent%: 仓位持仓占比
positionAvgPrice: 仓位平均持仓成本