3C Demark DCA

Kveie Premium Обновлено   
This Strategy provides the Demark 9 indicator and EMA50 combined.

The Setup Indicator was created by Tom Demark and this is one of many steps in his Sequential Indicator.
This strategy was designed for minor trend reversals and as you can see in my example chart, it gives many more buy and sell signals.
Not all are perfect of course but it does a pretty good job in identifying minor price reversals overall. Using Safety orders will help you close trades in profit.
This indicator looks for downtrends or uptrends that exist for a certain amount of time to determine price reversal points.

It opens long or short positions. I haven't yet figured out how to enable the long and short at the same time on the chart.
The ideal timeframe for this scalp strategy is 5 minutes on low price coins with momentum and volume .

- "Demark9 shows tops and bottoms of the market, before a price reversion."

The components are:

- EMA50: Exponential moving average (EMA50)
- Demark9


- If demark9 Buy and above EMA50, open a Long position
- If demark9 Sell or below EMA9, Open a short position

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!


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.

Информация о релизе: Added 3 commas connector

How to use:
- Add the script to the current chart
- Open the strategy settings
-Tweak the settings to to your liking.
-Make a SIMPLE bot in 3commas and use the same settings as you did in tradingview. The strategy will only send signal to start the deal and 3 commas will handle the rest. (I will look into the script making entry, safety and deal close later)
- Insert bot details using the deal start condition message found in your 3commas bot.
- When happy, right click on the "..." next to the study name, then "Add alert'".
- Under "Condition", on the second line, chose "Any alert () function call". Add the webhook from 3commas( https://3commas.io/trade_signal/trading_... ), give it a name, and "create".

Since this is a strategy script containg both strategy.entry() and alert() you will get alerts every time a buy or sell signal is plotted, but dont worry the script will send only one signal to 3commas. So as long you have deal running it will not open another.
If anyone have a solution to the alert not sending a message evry time a signal is plotted give me a heads up :)
Информация о релизе: Pretty huge update from last time.
- Updated the backtester, so that you can use whatever BO and SO you want. PNL will be based of max allocation. (Remember to use leverage calculator if trading futures)

- Stoploss is added.(Must be below last safety to trigger)

- Added support for Take Profit Type: "From Base order" (fixed amount based on BO size) and "From Total Volume" (Amount increases as more SO are placed)

- Added a table with DCA Settings for easier overview on the chart (Off by default it needs to be enabled in Settings)

- Safety order command for 3commas bot. This is implemented using Add funds in the quote currency (for pair BTCUSDT the quote currency is USDT)
The SO size is calculated using the configuration of steps, for exact order size (and price) use the built-in Steps table. IMPORTANT! This only works on spot. If you trade futures check only "deal start" and configure rest in 3 commas as before.
Because of this i had to update the 3commas connector.

- Fixed bug where safety would only be placed on next candle.
- Minor change in demark config wich gives way better signals.

Overview of the script features:
Dealstart is Demark (4 by default) combined with a EMA Crossover(50 by default)

- 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

- 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

Please let me know if you encounter any bugs, or you have suggestions for improvments
Информация о релизе: Fixed a bug in the 3commas connector
Информация о релизе: Did some altering on the logic.

Скрипт с открытым кодом

В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения. Вы можете добавить этот скрипт в избранное и использовать его на графике.

Отказ от ответственности

Все виды контента, которые вы можете увидеть на TradingView, не являются финансовыми, инвестиционными, торговыми или любыми другими рекомендациями. Мы не предоставляем советы по покупке и продаже активов. Подробнее — в Условиях использования TradingView.

Хотите использовать этот скрипт на графике?