DCA Bot Long/Short Thanks to @TheTradingParrot for the inspiration and knowledge shared.
Thanks to @ericlin0122 for the original DCA Bot Emulator which is the backbone of this strategy.
The script 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!
I`ve added:
1) an internal average price and profit calculating, instead of TV`s native one, which is subject to severe slippage.
2) I`ve built a graphic interface, so levels are clearly visible and back-test analyzing made easier.
3) now both Long & Short direction of the strategy exist.
4) trailing TP which was featured in the initial script has been removed because TV`s execution model makes
it impossible to know how the real world trailing would have unfolded.
5) the table is self explanatory, and it is there to help you discover what happened and where.
6) 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.
Known issues:
When deviation is small, and the same candle triggers safety AND the close order, the initial orders are closed, but a
new one opens on the next candle. This is "resolved" by closing the unwanted trade forcefully on the next candle, affecting
profit calculating minimally and guaranteeing that what should be closed has been closed.
The code could be improved through use of arrays, making the table flexible so the number of rows should be dynamic depending
on the number of SOs.
!!!!! IMPORTANT!!!!!
This strategy script is made to receive a signal from an exterior study script, which should plot +100 for long or -100 for short
entry (that is by default - values can be changed in the strategy settings menu). That plot should be found in "Enter Trigger" input
dropdown menu at the bottom of strategy settings menu. Removing the "and trigger == long/short_trigger" condition from strategy entry
conditions makes the strategy open trades ASAP.
Cheers!
Bots
Zendog V2 backtest DCA bot 3commasHi everyone,
After a few iterations and additional implemented features this version of the Backtester is now open source.
The Strategy is a Backtester for 3commas DCA bots. The main usage scenario is to plugin your external indicator, and backtest it using different DCA settings.
Before using this script please make sure you read these explanations and make sure you understand how it works.
Features:
- Because of Tradingview limitations on how orders are grouped into Trades, this Strategy statistics are calculated by the script, so please ignore the Strategy Tester statistics completely
Statistics Table explained:
- Status: either all deals are closed or there is a deal still running, in which case additional info
is provided below, as when the deal started, current PnL, current SO
- Finished deals: Total number of closed deals both Winning and Losing.
A deal is comprised as the Base Order (BO) + all Safety Orders (SO) related to that deal, so this number
will be different than the Strategy Tester List of Trades
- Winning Deals: Deal ended in profit
- Losing deals: Deals ended with loss due to Stop Loss. In the future I might add a Deal Stop condition to
the script, so that will count towards this number as well.
- Total days ( Max / Avg days in Deal ):
Total Days in the Backtest given by either Tradingview limitation on the number of candles or by the
config of the script regarding "Limit Date Range".
Max Days spent in a deal + which period this happened.
Avg days spent in a deal.
- Required capital: This is the total capital required to run the Backtester and it is automatically calculated by
the script taking into consideration BO size, SO size, SO volume scale. This should be the same as 3commas.
This number overwrites strategy.initial_capital and is used to calculate Profit and other stats, so you don't need
to update strategy.initial_capital every time you change BO/SO settings
- Profit after commission
- Buy and Hold return: The PnL that could have been obtained by buying at the close of the first candle of the
backtester and selling at the last.
- Covered deviation: The % of price move from initial BO order covered by SO settings
- Max Deviation: Biggest market % price move vs BO price, in the other direction (for long
is down, for short it is up)
- Max Drawdown: Biggest market % price move vs Avg price of the whole Trade (BO + any SO), in the other
direction (for long price goes down, for short it goes up)
This is calculated for the whole Trade so it is different than List of Trades
- Max / Avg bars in deal
- Total volume / Commission calculated by the strategy. For correct commission please set Commission in the
Inputs Tab and you may ignore Properties Tab
- Close stats for deals: This is a list of how many Trades were closed at each step, including Stop Loss (if
configured), together with covered deviation for that step, the number of deals, and the percentage of this
number from all the deals
TODO: Might add deal avg value for each step
- Settings Table that can be enabled / disabled just to have an overview of your configs on the chart, this is a
drawn on bottom left
- Steps Table similar to 3commas, this is also drawn on bottom left, so please disable Settings table if you want
to see this one
TODO: Might add extra stats here
- Deal start condition: built in RSI-7 or plugin any external indicator and compare with any value the indicator plots
(main purpose of this strategy is to connect your own studies, so using external indicator is recommended)
- Base order and safety orders configs similar to 3commas (order size, percent deviation, safety orders,
percent scale and volume scale)
- Long and Short
- Stop Loss
- Support for Take profit from base order or from Total volume of the deal
- Configs help (besides self explanatory):
- Chart theme: Adjust according to the theme you run on. There is no way to detect theme at the moment.
This adjust different colors
- Deal Start Type: Either a builtin RSI7 or "External indicator"
- Indicator Source an value: If using External Indicator then select source, comparison and value.
For example you could start a deal when Volume is greater than xxxx, or code a custom indicator that plots
different values based on your conditions and test those values
- Visuals / Decimals for display: Adjust according to your symbol
- BO Entry Price for steps table: This is the BO start deal price used to calculate the steps in the table
Zendog Backtest-DCA-Bot-3commasHi everyone,
This is a strategy that serves as a basic Backtester for 3commas DCA bots.
You can plugin your own studies into the Backtester, play around with their parameters as well with the DCA parameters and see how they can provide best result on historical data.
Features:
- Meaningful statistics that actually group orders under the same deal.
(base order + safety orders are the same deal, but Tradingview Strategy Tester shows them as separate trades)
See how many safety orders were used for each deal.
- Deal start condition: built in RSI-7 or external indicator
(main purpose of this strategy is to connect your own studies, so using external indicator is recommended)
- Base order and safety orders configs similar to 3commas
(order size, percent deviation, safety orders, percent scale and volume scale)
- Support for Long strategy for now (plan to add Short)
3CCI & 3RSI for botsThis script is for trading grid bots. Only CCI and RSI are used, but there are three different timeframes available for each. When using it, you must select a chart with a period equal to or less than the minimum in the indicator settings. For example, the following periods are selected in the settings: 1 hour, 15 minutes, 5 minutes, so we use a 5-minute chart. A buy or sell signal will be received if the settings of all 6 indicators match. The default settings do not carry any information, use your own. The code is quite simple and may be of interest to a beginner like me.
Crypto Strategy for Bearish Markets (Binance, FTX, Futures...)BINANCE:BTCUSDTPERP
Even in months like May '21 you can win by going long on Bitcoin. This strategy proves it and is not overwhelmed by Elon's ...
The backtest was carried out during the month of May of this year and, as you can see, all the long operations opened during the fall were successful.
So if we are going to continue to have a bear market for some time, why not take advantage of it while we remain bulls?
This strategy uses Dollar-Cost-Average (DCA) to average the entry price. Thanks to this, it is able to close profitable trades even in times of great volatility and bearish pressure.
It includes alerts that can be configured that will be sent every time the conditions to operate are met. These alerts can also be linked with 3commas for a fully automatic operation.
For Leverage Futures or Margin traders, all you have to do is divide the initial capital by the leverage used.
Enjoy!
Alert for 3Commas Bollinger StrategyThis is just an alert for the 3Commas Bollinger Strategy written by tedwardd
Backtesting 3commas DCA Bot v2Updating previously published simulated 3commas DCA logic with a sexier insert and more meaningful default parameters.
Bollinger Bands + RSI Alerts for 3commas/DCA botHey Folks !
This is in indicator that generates buy alerts combining Bollinger Bands and RSI.
RSI validates the BB signal by confirming we are not in an oversold area.
Interval: 3m to 15m
Recommended settings for 3commas DCA bot
- TP/TTP: 0.3%/0.1%,
- Base Order: Your choice ,
- Safety Order: 1.2 * Your choice of base order
- Safety Order Volume Scale: 1.2,
- Safety Order Step Scale: 1.5,
- Price Deviation to Open Safety Order (% from initial order): 0.25%,
- Max Safety Trades Count: 7
- DO NOT USE STOP LOSS
> Create Alert with Buy Alert and link it to "Message for deal start signal"
LordPepe Stochastic SignalsThis is the Lord Pepe. Howdy. Basic buy/sell indicator to accumulate along a downtrend and release your stack during the uptrend and oversold levels of the stochastic. The buys should be used to stack, and sells indicate levels of profit taking, they do not signal a long term reversal, only < 25% of stack should be released on "OB" signals.
OB - overbought (sell)
OS - oversold (buy)
Quansium Series A BacktestThis comes with preconfigured setups or strategies. Simply choose one from our list based on the timeframe it was made for. Leverage can be changed; to keep trading safe, a maximum of 2 is allowed. In our findings, this was able to trade crypto (specifically BTC ), MES (Micro E-mini S&P 500 Index Futures ), and stocks. It is important to know that setups A, B, C, and D use variable position sizing, and dynamic stop loss/trailing stop/take profit, these parameters are provided through the alerts. The rest of the strategies were created with a simpler approach in mind, just plainly entry/exits signals.
Quansium as a framework:
Price reformat: we take the price source (Open, Close, High, Low) and remove any noise that affects the accuracy of our signals.
Time awareness: we take several time periods of the data on the chart such as start, end, and whole. We use this to add more depth to our signals.
Position size: our backtest tries to recreate as much as the real world trades as possible so our position is determined by the current equity. We also use the volatility of the market to increase or decrease our exposure or risk.
Risk awareness: stop loss, take profit, trailing stop are the risk exits we use to provide our users some peace of mind. These parameters are totally dynamic and follow the same behavior of the market.
Signals filtering: to make almost non-existent any errors and increase the quality of our trades, our indicators go through multiple phases, this avoid double entries or early exits, and help maintain a record of what has transpired and what’s currently taking place.
Indicators: whenever we can we use custom code or our own functions instead of the defaults ones provided. This gives us total control of what we’re trying to achieve. In many cases we tend to combine several indicators’ logic into one creating a more personalized take on it.
Easiness: since we started our main goal has been to provide the easiest and fastest way to alerts’ creation. It has taken us years to reach this level where now we already provide a list of preset strategies so the user doesn’t have to spend much time tinkering with scripts and more on other matters, because we know life is more than just trading.
Raw signals: we provide the option to turn off as much of our advanced features such as stop loss, take profit, trailing stop, dynamic sizing, etc, etc for a simple approach. Trade signals still go through the signals filtering method mentioned above,
Timeframe pairing: we take trading very seriously, by no way we’ll want the user to lose money (although such thing is expected because past results aren’t an indicative of futures ones), through years of experience we have found what are usually common mistakes the user makes, this feature allows us to only activate the strategy if the right timeframe is chosen.
Trend filters: through the years we have improved the arts of the trend. We like to keep things simple but yet powerful. We observe the macro and micro trend of the security. This helps confirm we are entering at the desirable timing. We also incorporate volume and volatility into decision making, we simply programmed it to trade when these are increasing and higher than the average values observed in both the short and long term. Finally we take into account the strength of the pair to make our final choice of whether to enter or wait, and if anything flashes contrary movement then we cancel the upcoming signal and stop monitoring until the next one comes along.
Full automated risk: stop loss, take profit, and trailing stops usually are set in percentages, and optimized even more using the current market behavior to become more adaptive. But always remains some sort of fixation, so the user must choose a value somewhere. This is where our framework shines the most, as previously mentioned before when we take time into our calculations, we use several periods to observe performance and get values that keep our risk exits natural and closest to the flow of the market itself.
Setups:
A: Centered oscillator with the difference of several moving averages with more sensitive settings. Momentum focused.
B: Centered oscillator using simple moving averages. Trend-Following focused.
C: Centered oscillator using smoothed data with the help of faster moving averages. Trend-Following focused.
D: Centered oscillator with the difference of several moving averages with less sensitive settings. Trend-Following focused.
E: Centered oscillator with the difference of moving averages where the standard deviation is applied first. It uses less sensitive settings. Trend-Following focused.
F: Finds the relationship between multiple readings of the price’s relative strength to better pin-point downs and ups. Trend-Following focused.
G: Centered oscillator with the difference of moving averages where the standard deviation is applied first. It uses more sensitive settings. Momentum focused.
H: Multiple centered oscillators using various moving averages. Trend-Following focused.
I: Centered oscillator using simple moving averages. Momentum focused.
Note: The framework is composed of almost 1000 lines of code as compared to each indicator that makes up the setup which is around 10. The power from Quansium doesn't come from the strategies themselves but rather the overall system that turns simple signals into complex and advanced trades.
Strategy Tester:
Initial Capital: chosen value is $20,000, as an approximate to Bitcoin’s ATH (All-Time High). In previous iterations we noticed some trades won’t go through if the capital was less than the ATH.
Order Size: 100% of equity (although the script controls this, and this is of no regards to the results).
Pyramiding: 1, system doesn’t place multiple entries in a row, only one at a time.
Commission: This simulates order execution with custom trading fees. Commissions are turned off by default because this script works in various markets and each operates differently. In order to reach results that are close to real world conditions, it is imperative the user fills this based upon their broker or exchange data.
When we started, we were focused on finding the best indicator, or creating it ourselves. After years we came to realize that the secret is not in which indicator you use but the framework behind it. All strategies have bad, good, best, worst performance periods. The key of a good system is to help keep you safe when it’s down and maximize your potential when it’s up. We hope this material at the very minimum inspires you to keep going and not lose faith, because it is not the smartest who win but those who persevere.
ck - EMA Cross with AlertsDisplays 5 popular EMAs (you can hide any you don’t want to see from the “Styles” screen when editing the config).
Set the values for your EMAs by clicking the cog after adding this indicator to your chart.
A Long or Short signal is fired when EMA1 crosses EMA2 - a cross up is a Long signal, a cross down is a Short signal.
Connect to your Bots (3commas / 3C.exchange recommended) to automate buys and sells!
SuperFast M1 - STUDYScript developed for automated trading (autoview).
Start of backtest: Jan 01 2020.
Way of acting:
SMA , EMA and HullMA analysis.
Must be used on the 3 minute chart.
Supports leverage up to x50 with certain security.
-------------------- PT-BR -------------------
Script desenvolvido para trading automatizado (autoview).
Início do backtest: Jan 01 2020.
Forma de atuação:
Analise de SMA , EMA e HullMA.
Deve ser usado no gráfico de 3 minutos.
Suporta alvancagem de até x50 com certa segurança.
SuperFast M3 - STRATEGGYScript developed for automated trading (autoview).
Start of backtest: Jan 01 2020.
Way of acting:
SMA, EMA and HullMA analysis.
Must be used on the 3 minute chart.
Supports leverage up to x50 with certain security.
-------------------- PT-BR -------------------
Script desenvolvido para trading automatizado (autoview).
Início do backtest: Jan 01 2020.
Forma de atuação:
Analise de SMA, EMA e HullMA.
Deve ser usado no gráfico de 3 minutos.
Suporta alvancagem de até x50 com certa segurança.
BITMEX Bybit binance HUOBI OKCOIN BTC DMI ATR DPO TREND AlertBITMEX Bybit binance HUOBI OKCOIN BTC DMI ATR DPO TREND Alert
This is a very effective trend strategy.
Strategy principle
HOW TO USE
set long position when a green arrow appears in the chart.
set short position when a red arrow appears in the chart.
For the long position and the short direction, you can set the stop profit & stop loss or trailing profit stop & trailing stop loss respectively.
When a purple arrow appears to close a position, an aggressive trader can go in the opposite direction when it is purple.
Strategy applicability
The default setting is for bitmex perpetual swap contract XBTUSD , bybit BTCUSD perpetual futures contract ,binance btcusdt Spot,Bitfinex BTCUSD Spot,bitflyer BTCJPY Spot,bithumb BTCKRW Spot,bitso BTCMXN Spot, bitstamp BTCUSD Spot,bittrex BTCUSDT Spot,Coinbase BTCUSD spot, deribit BTCPERP perpetual futures contract,gemini BTCUSD Spot,Hitbit BTCUSDT Spot,huobi BTCUSDT Spot KRAKEN XBTUSD spot,OKCOIN OKEX BTCUSD3M BTCUSD BTCUSD2W,Poloniex BTCUSDT Spot etc btc symbol with 30 minutes timeframe.
This indicator has broad applicability and can be applied to multiple different symbols.
This indicator also applies to the ETHUSD symbol etc, just adjust the default configuration.
Using the alert of the indicator, it can work well on the trading robot like Gunbot,autoview, without repaint false signals.
这是非常有效的趋势策略。
如何使用
在图表中出现绿色箭头就做多。
在图表中出现红色箭头就做空。
对于多头头寸和空头方向,您可以分别设置止损和止损或尾随利润止损和尾随止损;当出现紫色箭头时平仓,激进的交易者,可以在紫色时就做反方向。
策略适用性
默认设置是针对bitmex交易所 XBTUSD永久掉期合约,BYBIT交易所 BTCUSD永续期货合约,binance币安交易所 btcusdt现货,Bitfinex交易所 BTCUSD现货,bitflyer交易所 BTCJPY现货,bithumb交易所 BTCKRW现货,bitso交易所 BTCMXN现货,bitstamp交易所 BTCUSD现货,bittrex交易所 BTCUSDT现货,Coinbase交易所 BTCUSD现货,deribit交易所 BTCPERP永续期货合约,gemini双子星交易所 BTCUSD现货,Hitbit交易所 BTCUSDT现货,huobi火币交易所 BTCUSDT现货,KRAKEN交易所 XBTUSD现货,OKCOIN OKEX交易所 BTCUSD3M OK BTC季度合约 BTCUSD BTCUSD2W OK BTC次周合约,Poloniex BTCUSDT现货等2小时区间的btc交易。
Bitmex XBTUSD 30分钟 比特币期货 30 minutes Futures
这个指标具有广泛的适用性,可以适用多个不同交易品种。
该指标还适用于ETHUSD,ETHBTC,ADABTC,TRXBTC,XRPBTC交易品种等,只需调整默认配置即可。
Bitmex ETHUSD 30分钟 以太币期货 30 minutes Futures
使用该指标的警报设置,它可以在自动交易机器人上很好地工作,而无重绘错误的信号。
ck - Ultimate Oscillator & RSI Indicator v1Hi,
This is an indicator that combines the Ultimate Oscillator with RSI.
Currently it displays signals on the screen when the RSI crosses from low to high (to open and close a long) and vice versa for short signals.
Further signals will be developed for Ultimate Oscillator longs/shorts.
Stay tuned!
ck - CryptoSniper (Indicator) v1Due to popular demand, here is an Indicator version on Cryptosniper v1 (with alerts).
This indicator repaints and should be used with a confirmation indicator as part os your strategy.
3 EMAs with Crossing Alerts & 2 SMAsHi all,
This is a simple indicator that plots 3 EMA lines and 2MAs of your choice to the screen and has built in alert triggers.
Features:
1) Alerts are triggered when EMAs 1 (Signal line) and 2 (Baseline) cross - a Long signal is called if the cross is above EMA 3 ( Trendline ), a short if the cross is below EMA3
2) Signals are represented visually as a triangle on the chart, below the candles is a long, above is a short
3) TradingView Alerts can be easily set as I have labelled the signals clearly as many other Indicators like this aren’t easy to work out if trying to create alerts to trigger a 3commas bot, for example!
Each EMA is fully customisable and if you wish to take advantage of the alerts, only a few simple rules need to be followed:
EMA1 needs to be less than EMA2.
EMA2 needs to be the same or greater than EMA3
That’s it, happy trading!
ck - CryptoSniper (Strategy) v2.1This strategy is radically different to the v1 script previously released.
It has ***NO REPAINTING*** - as such the algorithm had to change to remove it’s reliance on HMAs from future timeframes to establish trend, this is now accomplished with EMAs.
It is completely written in Pinescript v4.
It has integrated Stoploss and you can plot this & with the recommended Entry on the chart.
WARNING - This strategy has to be “tuned” to the instrument you are trading, for example, Bitcoin. The default settings work well for BTC/USD, XBT/USD on 15m chart timeframe but not for ETH/USD - it is possible the default settings will work with other crypto’s but I haven’t had time to test - if you find good settings PLEASE share them!
How to use:
1) Load up your favourite chart/instrument and select your favourite timeframe
2) Adjust the “signal” EMA and “baseline” EMA settings until you get the majority of uptrending moves highlighted with a green background and the majority of downtrending moves with a red background. The signal has to be faster (that is a lower number) than the baseline.
3) Adjust the “Sensitivity” - this will plot more green & orange Trigger points on the chart.
The strategy waits until in a trend, for example, a Long (green background) then waits for first green cross before opening a deal. It will Trigger a sell if the background turns red (downtrend) and a orange cross is printed.
4) Fine tuning:
A) Increase your profits by changing the Stoploss value - getting this right protects you from bad trades but also resets the indicator to provide another alert faster
B) You can increase the delay positions are opened or closed with the “Bar(s) offset to open position” and “Bar(s) offset to close position” settings. When you adjust these, 0 will buy/sell immediately when a Trigger cross is printed, 2 will wait until 2 bars/candles AFTER the Trigger cross prints to strat/close a position.
TIP: When adjusting indicator settings, load your chart and timeframe first.
Add the indicator/strategy (if you haven’t already).
Click the Strategy Tester tab at the bottom of the chart window so it is visible.
Open the strategy/indicator settings so you can see this wind AND the Strategy Tester display
Change a setting and click into a different setting input box, this will update the test results WITHOUT closing the settings window! This will save you a lot of time!
Write down any OK settings you find, you can come back later to fine tune them!
Please provide any feedback & let’s share the best settings for different crypto’s!
Brandon BollSecond day at Pinescript and I am attempting to tweak the Bollinger Bands directed strategy to send alerts to Zignaly in order to automate long buy/sells.
I've left in the short script though for completeness.
The buy and sell instructions work perfectly but I don't know how to do a cancel order alert (as included in the original strategy)
ck - CryptoSniper Longs Only (Strategy) v1Hey all,
This is a new script I have been working on and is in Beta testing stage.
It is best used for scalping 1/3/5/10/15 minutes.
Default settings are great for scalping, changing the “Period” will allow you to tweak for swing trades.
To use manually, you will get a Green triangle to alert you to be prepared to place an order.
This will happen 1 candle before the strategy paints an “open long” label on the chart.
ck - Inner Bars Indicator with Alerts and Trailing Stop v1*** Please check out the matching Strategy to accompany this Indicator to allow you to fully backtest! ***
Inner Bar trading strategy is where the "inside" bar (or candle to the right) within a pair is smaller and within the high to low range of the prior bar, as this pattern tends to be somewhat predictable; especially in "chop" or sideways trading, it is useful to have in your tool box.
Features include:
Complimentary strategy you can add as well as the indicator to backtest and tune your settings before live trading
Trailing Stoploss to wring every cent from a trade
Clear Alert labels have been coded in for use with trading bots, 3commas is recommended.
Enable/Disable Shorts in addition to Longs
Visual chart shapes - Pink Triangle = Long, Purple Triangle = Short, Thin Green Arrow = Profit, Thin Red Arrow = Loss
Realtime Deal Status - Plotlines include Yellow = Entry Price, Green = Trailing Stop Profit, Red - Hard Stoploss
A further feature is that you can disable Shorts (therefore only Longing) for use with exchanges
that only allow you to Long, such as Binance & Coinbase.
Additionally, this Indicator will close a trade before opening the next, so a single exchange
account (BitMEX for example) is all that is required versus having separate accounts to long or
short on the same chart.
This strategy is intended to use $100 of capital, traded at 2.5% per order with 10x lev on Bitmex.
If you like my work, please use my referral links (you will receive discounts!)
3commas trading bots (now with Bitmex support and a lot more!) - 3commas.io
BitMEX - www.bitmex.com
If you have any comments or suggestions, please message me via TradingView.
Based on the core "Inner Bars" concept found at:
backtest-rookies.com
with original inspiration/idea from babypips.com