Wolf DCA CalculatorThe Wolf DCA Calculator is a powerful and flexible indicator tailored for traders employing the Dollar Cost Averaging (DCA) strategy. This tool is invaluable for planning and visualizing multiple entry points for both long and short positions. It also provides a comprehensive analysis of potential profit and loss based on user-defined parameters, including leverage.
Features
Entry Price: Define the initial entry price for your trade.
Total Lot Size: Specify the total number of lots you intend to trade.
Percentage Difference: Set the fixed percentage difference between each DCA point.
Long Position: Toggle to switch between long and short positions.
Stop Loss Price: Set the price level at which you plan to exit the trade to minimize losses.
Take Profit Price: Set the price level at which you plan to exit the trade to secure profits.
Leverage: Apply leverage to your trade, which multiplies the potential profit and loss.
Number of DCA Points: Specify the number of DCA points to strategically plan your entries.
How to Use
1. Add the Indicator to Your Chart:
Search for "Wolf DCA Calculator" in the TradingView public library and add it to your chart.
2. Configure Inputs:
Entry Price: Set your initial trade entry price.
Total Lot Size: Enter the total number of lots you plan to trade.
Percentage Difference: Adjust this to set the interval between each DCA point.
Long Position: Use this toggle to choose between a long or short position.
Stop Loss Price: Input the price level at which you plan to exit the trade to minimize losses.
Take Profit Price: Input the price level at which you plan to exit the trade to secure profits.
Leverage: Set the leverage you are using for the trade.
Number of DCA Points: Specify the number of DCA points to plan your entries.
3. Analyze the Chart:
The indicator plots the DCA points on the chart using a stepline style for clear visualization.
It calculates the average entry point and displays the potential profit and loss based on the specified leverage.
Labels are added for each DCA point, showing the entry price and the lots allocated.
Horizontal lines mark the Stop Loss and Take Profit levels, with corresponding labels showing potential loss and profit.
Benefits
Visual Planning: Easily visualize multiple entry points and understand how they affect your average entry price.
Risk Management: Clearly see your Stop Loss and Take Profit levels and their impact on your trade.
Customizable: Adapt the indicator to your specific strategy with a wide range of customizable parameters.
DCA
TTP Intelligent AccumulatorThe intelligent accumulator is a proof of concept strategy. A hybrid between a recurring buy and TA-based entries and exits.
Distribute the amount of equity and add to your position as long as the TA condition is valid.
Use the exit TA condition to define your exit strategy.
Decide between adding only into losing positions to average down or take a riskier approach by allowing to add into a winning position as well.
Take full profit or distribute your exit into multiple take profit exists of the same size.
You can also decide if you allow your exit conditions to close your position in a loss or require a minimum take profit %.
The strategy includes a default built-in TA conditions just for showcasing the idea but the final intent of this script is to delegate the TA entries and exists to external sources.
The internal conditions use RSI length 7 crossing below the BB with std 1 for entries and above for exits.
To control the number of orders use the properties from settings:
- adjust the pyramiding
- adjust the percentage of equity
- make sure that pyramiding * % equity equals 100 to prevent over use of equity (unless using leverage)
The script is designed as an alternative to daily or weekly recurring buys but depending on the accuracy of your TA conditions it might prove profitable also in lower timeframes.
The reason the script is named Intelligent is because recurring buy is most commonly used without any decision making: buy no matter what with certain frequency. This strategy seeks to still perform recurring buys but filtering out some of the potential bad entries that can delay unnecessarily seeing the position in profits. The second reason is also securing an exit strategy from the beginning which no recurring buy option offers out-of-the-box.
Grospector DCA V.4This is system for DCA with strategy and can trade on trend technique "CDC Action Zone".
We upgrade Grospector DCA V.3 by minimizing unnecessary components and it is not error price predictions.
This has 5 zone Extreme high , high , normal , low , Extreme low. You can dynamic set min - max percent every zone.
Extreme zone is derivative short and long which It change Extreme zone to Normal zone all position will be closed.
Every Zone is splitted 10 channel. and this strategy calculate contribution.
and now can predict price in future.
Idea : Everything has average in its life. For bitcoin use 4 years for halving. I think it will be interesting price.
Default : I set MA is 365*4 days and average it again with 365 days.
Input :
len: This input represents the length of the moving average.
strongLen: This input represents the length of the moving average used to calculate the strong buy and strong sell zone.
shortMulti: This input represents the multiplier * moveing average used to calculate the short zone.
strongSellMulti: This input represents the multiplier used to calculate the strong sell signal.
sellMulti: This input represents the multiplier * moveing average used to calculate the sell zone.
strongBuyMulti: This input represents the multiplier used to calculate the strong sell signal.
longMulti: This input represents the multiplier * moveing average used to calculate the long zone.
*Diff sellMulti and strongBuyMulti which is normal zone.
useDerivative: This input is a boolean flag that determines whether to use the derivative display zone. If set to true, the derivative display zone will be used, otherwise it will be hidden.
zoneSwitch: This input determines where to display the channel signals. A value of 1 will display the signals in all zones, a value of 2 will display the signals in the chart pane, a value of 3 will display the signals in the data window, and a value of 4 will hide the signals.
price: Defines the price source used for the indicator calculations. The user can select from various options, with the default being the closing price.
labelSwitch: Defines whether to display assistive text on the chart. The user can select a boolean value (true/false), with the default being true.
zoneSwitch: Defines which areas of the chart to display assistive zones. The user can select from four options: 1 = all, 2 = chart only, 3 = data only, 4 = none. The default value is 2.
predictFuturePrice: Defines whether to display predicted future prices on the chart. The user can select a boolean value (true/false), with the default being true.
DCA: Defines the dollar amount to use for dollar-cost averaging (DCA) trades. The user can input an integer value, with a default value of 5.
WaitingDCA: Defines the amount of time to wait before executing a DCA trade. The user can input a float value, with a default value of 0.
Invested: Defines the amount of money invested in the asset. The user can input an integer value, with a default value of 0.
strategySwitch: Defines whether to turn on the trading strategy. The user can select a boolean value (true/false), with the default being true.
seperateDayOfMonth: Defines a specific day of the month on which to execute trades. The user can input an integer value from 1-31, with the default being 28.
useReserve: Defines whether to use a reserve amount for trading. The user can select a boolean value (true/false), with the default being true.
useDerivative: Defines whether to use derivative data for the indicator calculations. The user can select a boolean value (true/false), with the default being true.
useHalving: Defines whether to use halving data for the indicator calculations. The user can select a boolean value (true/false), with the default being true.
extendHalfOfHalving: Defines the amount of time to extend the halving date. The user can input an integer value, with the default being 200.
Every Zone: It calculate percent from top to bottom which every zone will be splited 10 step.
To effectively make the DCA plan, I recommend adopting a comprehensive strategy that takes into consideration your mindset as the best indicator of the optimal approach. By leveraging your mindset, the task can be made more manageable and adaptable to any market
Dollar-cost averaging (DCA) is a suitable investment strategy for sound money and growth assets which It is Bitcoin, as it allows for consistent and disciplined investment over time, minimizing the impact of market volatility and potential risks associated with market timing
Greedy DCA█ OVERVIEW
Detect price crashes in volatile conditions. This is an indicator for a greedy dollar cost average (DCA) strategy. That is, for people who want to repeatedly buy an asset over time when its price is crashing.
█ CONCEPTS
Price crashes are indicated if the price falls below one or more of the 4 lower Bollinger Bands which are calculated with increasing multipliers for the standard deviation.
In these conditions, the price is far below the average. Therefore they are considered good buying opportunities.
No buy signals are emitted if the Bollinger Bands are tight, i.e. if the bandwidth (upper -lower band) is below the value of the moving average multiplied with a threshold factor. This ensures that signals are only emitted if the conditions are highly volatile.
The Bollinger Bands are calculated based on the daily candles, irrespective the chart time frame. This allows to check the strategy on lower time frames
DCA Liquidation Calculation [ChartPrime]The DCA Liquidation Calculator is a powerful table indicator designed for both manual and bot-assisted traders who practice Dollar Cost Averaging (DCA). Its primary objective is to help traders avoid getting liquidated and make informed decisions when managing their positions. This comprehensive table indicator provides essential information to DCA traders, enabling them to plan their trades effectively and mitigate potential risks of liquidation.
Key Features:
Liquidation Price Awareness: The DCA Liquidation Calculator calculates and displays the liquidation price for each trade within your position. This critical information empowers traders to set appropriate stop-loss levels and avoid being liquidated in adverse market conditions, especially in leveraged trading scenarios.
DCA Recommendations: Whether you are executing DCA manually or using a trading bot, the DCA Liquidation Calculator offers valuable guidance. It suggests optimal entry prices and provides insights into the percentage deviation from the current market price, helping traders make well-timed and well-informed DCA decisions.
Position Sizing: Proper position sizing is essential for risk management. The DCA Liquidation Calculator helps traders determine the percentage of capital to allocate to each trade based on the provided insights. By using the recommended position sizing, traders can protect their capital and potentially maximize profits.
Profit and Loss Visualization: Gain real-time visibility into your Profit and Loss (PnL) with the DCA Liquidation Calculator. This feature allows you to monitor your trades' performance, enabling you to adapt your strategies as needed and make data-driven decisions.
Margin Call Indicators: Anticipating potential margin calls is crucial for maintaining a healthy trading account. The DCA Liquidation Calculator's smart analysis helps you identify and manage potential margin call situations, reducing the risk of account liquidation.
Capital Requirements: Before entering a trade, it's vital to know the required capital. The DCA Liquidation Calculator provides you with this information, ensuring you are adequately prepared to execute your trades without overextending your resources.
Maximum Trade Limit: Considering your available capital, the DCA Liquidation Calculator helps you determine the maximum number of trades you can enter. This feature ensures you maintain a disciplined and sustainable trading approach aligned with your financial capabilities.
Color-Coded Risk Indicators:
Green Liquidation Price Cell: Indicates that the position is considered safe from liquidation at the given parameters.
Yellow Liquidation Price Cell: Warns traders of potential liquidation risk. Exercise caution and monitor the trade closely to avoid undesirable outcomes.
Purple Liquidation Price Cell: Shows the liquidation price, but it does not necessarily indicate an imminent liquidation. Use this information to make prudent risk management decisions.
Red Row: Signals that the trade cannot be executed due to insufficient capital. Consider alternative strategies or ensure adequate capitalization before proceeding.
Settings explained:
In conclusion, the DCA Liquidation Calculator equips traders with essential tools to make well-calculated decisions, minimize liquidation risks, and optimize their Dollar Cost Averaging strategy. By offering comprehensive insights into your trading position, this indicator empowers you to navigate the markets with confidence and increase your potential for successful and sustainable trading.
GDCA ScreenerThis is upgrated system for Screener to DCA from "Grospector DCA V.3".
This has 5 zone Extreme high , high , normal , low , Extreme low. You can dynamic set min - max percent every zone.
Extreme zone is derivative short and long which It change Extreme zone to Normal zone all position will be closed.
Every Zone is splitted 10 channel. and this strategy calculate contribution.
and now can predict price in future.
Price Type: Allows the user to select the price type (open, high, low, close) for calculations.
ALL SET
Length MA for normal zone: The length of the moving average used in the normal zone.
Length for strong zone: The length of the moving average used in the strong zone, which is averaged from the normal zone moving average.
Multiple for Short: The multiplication factor applied to determine the threshold for the short zone.
Multiple for Strong Sell: The multiplication factor applied to determine the threshold for the strong sell zone.
Multiple for Sell Zone: The multiplication factor applied to determine the threshold for the sell zone.
Multiple for Buy Zone: The multiplication factor applied to determine the threshold for the buy zone.
Multiple for Strong Buy: The multiplication factor applied to determine the threshold for the strong buy zone.
Multiple for Long: The multiplication factor applied to determine the threshold for the long zone.
ZONE
Start Short Zone %: The start percentage of the short zone.
End Short Zone %: The end percentage of the short zone.
Start Sell Zone %: The start percentage of the sell zone.
End Sell Zone %: The end percentage of the sell zone.
Start Normal Zone %: The start percentage of the normal zone.
End Normal Zone %: The end percentage of the normal zone.
Start Buy Zone %: The start percentage of the buy zone.
End Buy Zone %: The end percentage of the buy zone.
Start Long Zone %: The start percentage of the long zone.
End Long Zone %: The end percentage of the long zone.
DISPLAY
Show Price: Controls the visibility of the price column in the display table.
Show Mode: Controls the visibility of the mode column in the display table.
Show GDCA: Controls the visibility of the GDCA column in the display table.
Show %: Controls the visibility of the percentage column in the display table.
Show Short: Controls the visibility of the short column in the display table.
Show Strong Sell: Controls the visibility of the strong sell column in the display table.
Show Sell: Controls the visibility of the sell column in the display table.
Show Buy: Controls the visibility of the buy column in the display table.
Show Strong Buy: Controls the visibility of the strong buy column in the display table.
Show Long: Controls the visibility of the long column in the display table.
Show Suggestion Trend: Controls the visibility of the suggestion trend column in the display table.
Show Manual Custom Code: Controls the visibility of the manual custom code column in the display table.
Show Dynamic Trend: Controls the visibility of the dynamic trend column in the display table.
Symbols: Boolean parameters that control the visibility of individual symbols in the display table.
Mode: Integer parameters that determine the mode for each symbol, specifying different settings or trends.
My mindset has been customed = AAPL , MSFT
To effectively make the DCA plan, I recommend adopting a comprehensive strategy that takes into consideration your mindset as the best indicator of the optimal approach. By leveraging your mindset, the task can be made more manageable and adaptable to any market
Dollar-cost averaging (DCA) is a suitable investment strategy for sound money and growth assets which It is Bitcoin, as it allows for consistent and disciplined investment over time, minimizing the impact of market volatility and potential risks associated with market timing
Mizar_LibraryThe "Mizar_Library" is a powerful tool designed for Pine Script™ programmer’s, providing a collection of general functions that facilitate the usage of Mizar’s DCA (Dollar-Cost-Averaging) bot system.
To begin using the Mizar Library, you first need to import it into your indicator script. Insert the following line below your indicator initiation line: import Mizar_Trading/Mizar_Library/1 as mizar (mizar is the chosen alias).
In the import statement, Mizar_Trading.Mizar_Library_v1 refers to the specific version of the Mizar Library you wish to use. Feel free to modify mizar to your preferred alias name.
Once the library is imported, you can leverage its functions by prefixing them with mizar. . This will prompt auto-completion suggestions displaying all the available user-defined functions provided by the Mizar Library.
Now, let's delve into some of the key functions available in the Mizar Library:
DCA_bot_msg(_cmd)
The DCA_bot_msg function accepts an user-defined type (UDT) _cmd as a parameter and returns a string with the complete JSON command for a Mizar DCA bot.
Parameters:
_cmd (bot_params) : ::: User-defined type (UDT) that holds all the necessary information for the bot command.
Returns: A string with the complete JSON command for a Mizar DCA bot.
rounding_to_ticks(value, ticks, rounding_type)
The rounding_to_ticks function rounds a calculated price to the nearest actual price based on the specified tick size.
Parameters:
value (float) : ::: The calculated price as float type, to be rounded to the nearest real price.
ticks (float) : ::: The smallest possible price obtained through a request in your script.
rounding_type (int) : ::: The rounding type for the price: 0 = closest real price, 1 = closest real price above, 2 = closest real price below.
Returns: A float value representing the rounded price to the next tick.
bot_params
Bot_params is an user-defined type (UDT) that represents the parameters required for a Mizar DCA bot.
Fields:
bot_id (series string) : The ID number of your Mizar DCA bot.
api_key (series string) : Your private API key from your Mizar account (keep it confidential!).
action (series string) : The command to perform: "open" (standard) or "close" optional .
tp_perc (series string) : The take profit percentage in decimal form (1% = "0.01") optional .
base_asset (series string) : The cryptocurrency you want to buy (e.g., "BTC").
quote_asset (series string) : The coin or fiat currency used for payment (e.g., "USDT" is standard if not specified) optional .
direction (series string) : The direction of the position: "long" or "short" (only applicable for two-way hedge bots) optional .
To obtain the JSON command string for the alert_function call, you can use the DCA_bot_msg function provided by the library. Simply pass the cmd_msg UDT as an argument and assign the returned string value to a variable.
Here's an example to illustrate the process:
// Import of the Mizar Library to use the included functions
import/Mizar_Trading/Mizar_Library/1 as mizar
// Example to set a variable called “cmd_msg” and all of its parameters
cmd_msg = mizar.bot_params. new()
cmd_msg.action := "open"
cmd_msg.api_key := "top secret"
cmd_msg.bot_id := "9999"
cmd_msg.base_asset := "BTC"
cmd_msg.quote_asset := "USDT"
cmd_msg.direction := "long"
cmd_msg.tp_perc := "0.015"
// Calling the Mizar conversion function named “DCA_bot_msg()” with the cmd_msg as argument to receive the JSON command and save it in a string variable called “alert_msg”
alert_msg = mizar.DCA_bot_msg(cmd_msg)
Feel free to utilize (series) string variables instead of constant strings. By incorporating the Mizar Library into your Pine Script, you gain access to a powerful set of functions and can leverage them according to your specific requirements.
For additional help or support, you can join the Mizar Discord channel. There, you'll find a dedicated Pine Script channel where you can ask any questions related to Pine Script.
Simple Dollar Cost AverageThis simple DCS indicator shows:
Invested Amount
Portfolio Value
Profit
Assets
Cost per Share
Fees
You can define:
Starting Investment
Investment per Cycle
Fee Ratio
Cycle Frequency
Start and End Date
Simple_RSI+PA+DCA StrategyThis strategy is a result of a study to understand better the workings of functions, for loops and the use of lines to visualize price levels. The strategy is a complete rewrite of the older RSI+PA+DCA Strategy with the goal to make it dynamic and to simplify the strategy settings to the bare minimum.
In case you are not familiar with the older RSI+PA+DCA Strategy, here is a short explanation of the idea behind the strategy:
The idea behind the strategy based on an RSI strategy of buying low. A position is entered when the RSI and moving average conditions are met. The position is closed when it reaches a specified take profit percentage. As soon as the first the position is opened multiple PA (price average) layers are setup based on a specified percentage of price drop. When the price hits the layer another position with the same position size is is opened. This causes the average cost price (the white line) to decrease. If the price drops more, another position is opened with another price average decrease as result. When the price starts rising again the different positions are separately closed when each reaches the specified take profit. The positions can be re-opened when the price drops again. And so on. When the price rises more and crosses over the average price and reached the specified Stop level (the red line) on top of it, it closes all the positions at once and cancels all orders. From that moment on it waits for another price dip before it opens a new position.
This is the old RSI+PA+DCA Strategy:
The reason to completely rewrite the code for this strategy is to create a more automated, adaptable and dynamic system. The old version is static and because of the linear use of code the amount of DCA levels were fixed to max 6 layers. If you want to add more DCA layers you manually need to change the script and add extra code. The big difference in the new version is that you can specify the amount of DCA layers in the strategy settings. The use of 'for loops' in the code gives the possibility to make this very dynamic and adaptable.
The RSI code is adapted, just like the old version, from the RSI Strategy - Buy The Dips by Coinrule and is used for study purpose. Any other low/dip finding indicator can be used as well
The distance between the DCA layers are calculated exponentially in a function. In the settings you can define the exponential scale to create the distance between the layers. The bigger the scale the bigger the distance. This calculation is not working perfectly yet and needs way more experimentation. Feel free to leave a comment if you have a better idea about this.
The idea behind generating DCA layers with a 'for loop' is inspired by the Backtesting 3commas DCA Bot v2 by rouxam .
The ideas for creating a dynamic position count and for opening and closing different positions separately based on a specified take profit are taken from the Simple_Pyramiding strategy I wrote previously.
This code is a result of a study and not intended for use as a full functioning strategy. To make the code understandable for users that are not so much introduced into pine script (like myself), every step in the code is commented to explain what it does. Hopefully it helps.
Enjoy!
DCA Simulator A simple yet powerful Dollar Cost Averaging (DCA) simulator.
You just add the script to your chart, and you'll be able to see:
- Every single entry with its size
- The evolution of you average price in time (blue line)
- The profit and loss areas (where market price < average price the DCA is at loss, and the background is colored in red. At the contrary, where mkt price is > average price, it's profit area and the background is green).
- Max drawdown: the point in price and time where the DCA loss is maximum in the considered time interval. The drawdown amount is specified.
- Profit (or loss) and total cost at the end of the time interval or at the present day: the script shows how much the DCA is netting at a profit or loss, as well as the total cost of the DCA itself.
The parameters are:
- Date start and date end: time interval of the DCA simulation
- DCA period (you can choose between daily, weekly and monthly)
- Week day or month day if you choose those periods
- Single operation size (in base currency)
- Option to choose a DCA LONG or DCA SHORT (for uber bears)
- Option to include an exit strategy that partially closes your position (the % size closed can be chosen as well with the parameter "exit_close_perc") every time the DCA realizes a specific gain (choosable with the parameter "exit_gain_threshold"). If you choose "none" as an exit strategy, the script will assume to never close positions until the end of the period or the present day for simulation purpose.
NB: just ignore the TV strategy tester results, all the data are visible on the chart.
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: 仓位平均持仓成本
3Commas Bot DCA Backtester & Signals FREEThis is a DCA Strategy backtester + signals, built to emulate the 3Commas DCA bots. It uses your choice of 4 different buy signals, 2 of which can be adjusted in the settings. Everything is customizable so you can backtest specific settings with different buy signals and find the best performing strategy for your risk tolerance and capital. It can be used to backtest strategies on stocks as well, but just make sure your base order is larger than the share price for the entire backtesting range or it will not calculate properly.
You can use this template to code your own buy signals and then backtest them as a DCA strategy if you know some basic pine script.
The indicator shows all of your backtesting orders on the chart. The red line is your take profit level, the blue line is your average price level, the white line is your first order and the green lines are your average down orders. If you enable a stop loss in the settings your stop loss will be shown as an orange line once all of your average down orders have been hit, it will not be set until price has dipped below your covered trading range.
These levels update when things change during backtesting so you can visualize your strategy and how it would perform as well as see if your percentage deviation is large enough to cover dips. When backtesting trades are taken, the chart will show where they were taken(in backtesting) along with info on those trades such as the number each order is, the size of that order and the percentage deviation that order is from the initial buy.
SENDING SIGNALS TO 3COMMAS
Tradingview cannot sync this backtester to 3Commas and with the way alerts are setup for strategies on Tradingview, the best option for you to give signals to your bot would be to use this backtester to figure out what trigger you want to use and then setup that indicator separately to send alerts to your bot. All of the indicators used for signals in this backtester are available for free and can be configured to match this backtester and send alerts to 3Commas for you. Just make sure you set your alerts to once per bar close and don’t use less than a 15 second timeframe because then you could trigger the Tradingview threshold for alerts and get your alerts shut off.
You can also use this backtester with your own buy triggers if you know a little pine script. Just make copy of the script and code in your own buy signals and see how it backtests.
INFO PANEL FOR ANALYZING YOUR STRATEGY
The right hand side of the screen will show an info panel that shows a lot of different information so you can quickly see your bot settings and how it performed right on the screen.
In the top right corner you will see in purple your bot settings. These include your stoploss % if turned on, take profit %, average down order %, average down order % multiplier, volume multiplier, max number of orders allowed and size of your base order.
The top section of the first column “Current Trade” shows these stats: the open trade’s average price, the open trade’s take profit price, the open trade’s PNL, how far price is from your open tarde’s take profit level in percentage, your open position size and number of open orders.
The bottom section of the first column “Overall Performance” shows these stats: total number of trades taken during backtesting range, the largest amount of trades that were open at one time during backtesting, the max drawdown, the average number of bars per trade, gross profit, net profit, percent profit from your initial capital, current portfolio value and your initial capital.
CUSTOMIZABLE OPTIONS TO FIND THE PERFECT STRATEGY
Stoploss On/Off
This will turn your stoploss on or off. By default it is set to off and will not affect anything unless turned on.
Stoploss Percentage
This is the percentage below your final average down order price that will be set as a stoploss to keep your account from going too far in the red on big dips.
Take Profit Percentage - This is the percentage of profit you want the trade to hit before taking profit on your entire DCA trade. This level updates everytime you average down.
Average Down Percentage - This is the percentage that price has to drop from your initial order to initiate your first safety order. If the Average Down Percent Multiplier is set to 1 then this percentage will be the same for every average down order.
Average Down Percentage Multiplier - This multiplies your Average Down Percentage so each safety order needs a larger percentage deviation than the previous one. This keeps your buys closer together at the beginning and further apart when you hit more orders so you can extend your trading range but still be aggressive when price is going sideways.
Volume Multiplier Per New Order - This multiplies the size of each trade based on your base order. If you set it to a 2x multiplier then each average down order will be 2 times the size of the last one. So for example, a $100 base order with a 2x multiplier would have these values for the first 3 average down orders: 200, 400, 800.
Size Of Base Order - This is the size of your first position entry and will be used as a starting point for the volume multiplier. If your base order is $100 then it will buy $100 worth of whatever crypto you are backtesting this on. If you are looking at stock charts, you need to make sure your base order is higher than the share price across the entire backtesting range or it will not perform correctly.
Max Number Of Orders - This is the maximum number of orders the bot can take, including your base order. Adjust this to suit the amount of capital you are willing to allocate to your bot based on how much money it will require to run according to your bot settings.
TIPS ON HOW TO USE FOR BEST RESULTS
If you don’t have a lot of capital to work with, then use longer timeframes with a reasonable take profit percentage so that you don’t need a lot of average down orders. You can also try keeping the volume multiplier close to 1.
You can use the 3Commas dca bot settings page to see how much capital you will need for your strategy if you match it to the settings you have on this indicator. You can also check to see how much of a percentage deviation your bot is covering to make sure you have a reasonable range to trade in and orders to cover big dips. You can also check your coverage by seeing how far down the chart the green lines cover, which are your average down orders.
Make sure the initial capital in the properties tab of the settings has enough to cover all of your orders otherwise you will get unrealistic backtesting results. Also, make sure you leave the order size in the properties tab on contracts so it calculates your trades correctly. The only settings you need to touch in the properties tab is the initial capital. Unless you are trading somewhere that has lower commission fees, then you can change that to match, but leave all the other settings as is for it to function properly.
Increasing the volume multiplier will make your average price and take profit target follow the price action a lot closer as price falls, but it can also lead to having very large orders very quickly once you get into the 1.5-3x multiple range. Try using a high volume multiplier with less safety orders and you will get better results, however you need to have money on the sidelines to add on major dips to keep your bot turning a profit. Be very careful with this as greed and impatience will hurt your overall performance. This bot is meant to make money with lots of small wins so don’t get greedy and make sure you have enough money to cover large dips. If you are being aggressive with your bot, then I recommend only using 25% or less of your portfolio to trade aggressively and then use the smart trade feature on 3commas to add chunks of funds to your trades when price dips below your last safety order. Or if you want it to run without any supervision, then use lower volume multipliers and have lots of safety orders that can cover entire bear markets and still keep buying lower.
It’s a good idea to have some capital on the sidelines that you can add in when price dips quickly. This will help lower your average price and allow your bot to get out in profit quicker. 3Commas bot has a smart trade feature that will allow you to track your average price when adding extra funds and it will automatically update your other orders which is very convenient. Look at the longer timeframes when price dips and only add chunks at major areas where price is very likely to bounce. Or you can be aggressive when trading and add to your position when price dips and is at a likely bounce zone to maximize profits.
Only trade coins that have a good amount of liquidity as the larger your orders get, the harder it will be to sell if there isn’t much liquidity. Also, beware of how large your first order is as it will usually be a market order and can move the market if there is not much liquidity.
Since this bot takes a lot of trades and performs best when taking small profits consistently, you will need to factor in exchange fees. The bot is set to .5% commission(you can change this) on the buy and sell orders as most exchanges charge that amount. Some exchanges offer no fee trading on certain coins so be sure to look around for those so you can keep the commissions and maximize profits.
I strongly encourage you to try out a lot of different setting combinations across multiple different coins and do it across a few months to see how it would have performed under various market conditions. This will help you get a better idea of how much of a percentage deviation you’ll need to be able to cover to keep your bot running and making constant profits. You can also use the deep backtesting feature of the strategy panel to see how it would have done, but just beware that the info panel of the indicator will not reflect deep backtesting results, only the normal backtesting range.
MARKETS
This backtester can be used on any market including crypto, stocks, forex & futures. You just need to make sure your base order is larger than the share price when using this on things besides crypto.
TIMEFRAMES
This backtester can be used on all timeframes.
DCA After Downtrend v2 (by BHD_Trade_Bot)The purpose of the strategy is to identify the end of a short-term downtrend . So that you can easily to DCA certain amount of money for each month.
ENTRY
The buy orders are placed on a monthly basis for assets at the end of a short-term downtrend:
- Each month condition: In 1-hour time frame, each month has 24 * 30 candles
- The end of short-term downtrend condition: use MACD for less delay
CLOSE
The sell orders are placed when:
- Is last bar
The strategy use $1000 and trading fee is 1.1% for each order.
Pro tip: The 1-hour time frame has the best results on average:
- Total spent: $1000 x 33 = $33,000
- Total profit: $65,578
DCA After Downtrend (by BHD_Trade_Bot)The purpose of the strategy is to identify the end of a short-term downtrend . So that you can easily to DCA certain amount of money for each month.
ENTRY
The buy orders are placed on a monthly basis for assets at the end of a short-term downtrend:
- Each month condition: In 1-hour time frame, each month has 240 candles
- The end of short-term downtrend condition: use MACD for less delay
CLOSE
The sell orders are placed when:
- Is last bar
The strategy use $1000 and trading fee is 0.1% for each order.
Pro tip: The 1-hour time frame for TSLA has the best results on average:
- Total spent: $1000 x 85 = $85,000
- Total profit: $790,556
Crypto Force IndexIntroduction
The Crypto Force Index (CFI) indicator helps us understand the current strength and weakness of the price. It is very useful when used on high timeframes for investment purposes and not for short term trading.
To determine the strength and weakness of the price, a level grid based on the RSI indicator is used.
Based on the RSI value, red circles (oversold condition) and green circles (overbought condition) appear under the price candles. The more intense the color of the circles, the more that the current price is in an overbought or oversold condition.
The signal levels are all configurable to adapt the indicator across multiple instruments and markets.
The default configuration have been designed to obtain more accurate signals on Ethereum and Bitcoin, using the weekly timeframe.
Why Crypto Force Index?
The Crypto Force Index (CFI) is the consequence of my study of investments based on the accumulation plan. I wanted to demonstrate that I am improving the returns of the classic DCA ( dollar cost averaging ) and VA ( value averaging ).
After finding my own model of an accumulation plan, I decided to create the Crypto Force Index to help me visually enter the market.
The formulas of the indicator are very simple, but my studies confirm the power of this tool.
How are the signals to be interpreted?
The Crypto Force Index helps us to highlight the overbought and oversold areas, with the use of circles under the price of candles and with a thermometer inserted at the base of the graph, where all the phases of strength and weakness are highlighted.
As soon as the red circles start to appear on the chart, that may be a good time to enter LONG to the market and start accumulating. If the circles are green, we can consider decreasing the current exposure by selling part of your portfolio, or decide to stay flat.
I personally use these signals on the weekly timeframe, to decide to feed my accumulation plan at the beginning of each month.
I hope it can be of help to you! Please help me improve the Crypto Force Index! :)
3C QFL Mean reversalWhat is QFL trading strategy?
QFL stands for Quickfingersluc, and sometimes it is referred to as the Base Strategy or Mean Reversals. Its main idea is about identifying the moment of panic selling and buying below the base level and utilizing Safety orders.
What is Base level or Support Level?
Base level or Support Level refers to the lowest price level that was reached before the moment the price started increasing again. At that level, you can notice that buyers of some cryptocurrencies make a strong reaction.
In this strategy we can also reverse the strategy and go short. But i must warn you that that is alot riskier.
QFL is meant to be used on higher TF's like 1hr, 2hr and 4hr. But this strategy also work well on lower Timeframes.
The script also simulates DCA strategy with parameters used in 3commas DCA bots for futures trading.
Experiment with parameters to find your trading setup.
Beware how large your total leveraged position is and how far can market go before you get liquidated!
Do that with the help of futures liquidation calculators you can find online!
Included:
An internal average price and profit calculating, instead of TV`s native one, which is subject to severe slippage.
A graphic interface, so levels are clearly visible and back-test analyzing made easier.
Long & Short direction of the strategy.
Table display a summary of past trades
Vertical colored lines appear when the new maximum deviation from the original price has
been reached
All the trading happens with total account capital, and all order sizes inputs are expressed in percent.
Buy and hold strategyA simple buy and hold strategy. A short or a long position can be chosen. The start date will determine the date where your position will start and end date is the date it will end. This works well as a baseline to your other existing strategies since buy and hold is just the simplest strategy available.
Simple_PyramidingA simple Pyramiding / DCA Strategy. Everyday at a specified time a position is opened. The individual position is closed when a take profit is triggered. Optionally a stop loss can be activated, or the option to close the position at the and of the time frame. You can specify the max amount of open positions. The equity will be divided through the max amount of open positions.
This strategy is a result of an exploration into working with time sessions, pyramiding, for loops and possibilities to trigger individual take profits (profit) and stop loss levels (stop). This strategy is by no means a worked out and reliable strategy. Please feel free to experiment with the code in your indicators and strategies.
Krugman's Dynamic DCAThis script helps you create a DCA (dollar-cost averaging) strategy for your favorite markets and calculates the DCA value for each bar. This can be used to DCA daily, weekly, bi-weekly, etc.
Configuring the indicator:
- DCA Starting Price : the price you want to begin DCA'ing
- DCA Base Amount : the $ amount you will DCA when price is half of your starting price
- DCA Max Amount : the maximum amount you want to DCA regardless of how low price gets
The DCA scaling works exactly like the formula used to calculated the gain needed to recover from a given % loss. In this case it's calculated from the DCA Starting Price . The idea is to increase the DCA amount linearly with the increased upside potential.
MicroStrategy MetricsA script showing all the key MSTR metrics. I will update the script every time degen Saylor sells some more office furniture to buy BTC.
All based around valuing MSTR, aside from its BTC holdings. I.e. the true market cap = enterprise value - BTC holdings. Hence, you're left with the value of the software business + any premium/discount decided by investors.
From this we can derive:
- BTC Holdings % of enterprise value
- Correlation to BTC (in this case we use CME futures...may change this)
- Equivalent Share Price (true market cap divided by shares outstanding)
- P/E Ratio (equivalent share price divided by quarterly EPS estimates x 4)
- Price to FCF Ratio (true market cap divided by FCF (ttm))
- Price to Revenue (^ but with total revenue (ttm))
Co-relation and St-deviation Strategy - BNB/USDT 15minThis indicator based on statistical analysis. it uses standard deviation and its co-relation to price action to generate signals. and following indicators has been used to calculate standard deviation and its co-relation values. finally it is capable to identify market changes in bottoms to pic most suitable points.
1. Parabolic SAR (parabolic stop and reverse)
2. Supertrend
3. Relative strength index (RSI)
4. Money flow index (MFI)
5. Balance of Power
6. Chande Momentum Oscillator
7. Center of Gravity (COG)
8. Directional Movement Index (DMI)
9. Stochastic
10. Symmetrically weighted moving average with fixed length
11. True strength index (TSI)
12. Williams %R
13. Accumulation/distribution index
14. Intraday Intensity Index
15. Negative Volume Index
16. Positive Volume Index
17. On Balance Volume
18. Price-Volume Trend
19. True range
20. Volume-weighted average price
21. Williams Accumulation/Distribution
22. Williams Variable Accumulation/Distribution
23. Simple Moving Average
24. Exponential Moving Average
25. CCI (commodity channel index)
26. Chop Zone
27. Ease of Movement
28. Detrended Price Oscillator
29. Advance Decline Line
30. Bull Bear Power
Buy / Sell indicator light version [Crypto_BCT]The indicator is based on the search for the lowest bars in a given period (can be customized).
You can add a search for the highest bars to determine the closed order points.
You can add a filter by the value of the RSI (you can customized it separately for buying and selling).
Alerts for buying and selling are set.
It can be used to work with bots, for example 3COMMAS DCA bot.
--------------------------
Signal Condition Settings:
(Buy) Lowest Bar
The closing of the current bar is lower than the closing of the bars back in this range
(Buy) RSI value <
The RSI index is below this value
(Sell) Highest Bar
The closing of the current bar is higher than the closing of bars in this range
(Sell) RSI value >
The RSI index is higher than this value
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