Zenith BladeThis script is based heavily on "Support/Resistance Zones x3" by Lij_MC
What I did is went and added alerts for when price breakouts the support line/zone.
You have the options to change if it is based on a zone breakout or a line breakout
You also can choose when it will go off, so for example you want an alert to trigger only between 7am and 8am then you can change that in the menu.
Lastly you can choose whither or not to show the Williams Alligator on the chart as I have found it beneficial in conjunction with the script since its based primarily on fractals to calculate Support and Resistance.
Bill Williams Indicators
All Instrument Swing Trader with Pyramids, DCA and Leverage
Introduction
This is my most advanced Pine 4 script so far. It combines my range trader algorithms with my trend following pyramids all on a single interval. This script includes my beta tested DCA feature along with simulated leverage and buying power calculations. It has a twin study with several alerts. The features in this script allow you to experiment with different risk strategies and evaluate the approximate impact on your account capital. The script is flexible enough to run on instruments from different markets and at various bar intervals. This strategy can be run in three different modes: long, short and bidirectional. The bidirectional mode has two split modes (Ping Pong and BiDir). It also generates a summary report label with information not available in the TradingView Performance report such as Rate Of Return Standard Deviation and other Sharpe Ratio input values. Notable features include the following:
- Swing Trading Paradigm
- Uni or Bidirectional trading modes
- Calculation presets for Crypto, Stocks and Forex
- Conditional Minimum Profit
- Hard stop loss field
- Two types of DCA (Positive and Negative)
- Discretionary Pyramid levels with threshold adjustment and limiter
- Consecutive loss counter with preset and label
- Reentry loss limiter and trade entry caution fields
- Simulated Leverage and margin call warning label (approximation only)
- Buying power report labels (approximation only)
- Rate Of Return report with input values for Sharpe Ratio, Sortino and others
- Summary report label with real-time status indicators
- Trend follow bias modes (Its still range trading)
- Six anti-chop settings
- Single interval strategy to reduce repaint occurrence
This is a swing trading strategy so the behavior of this script is to buy on weakness and sell on strength. As such trade orders are placed in a counter direction to price pressure. What you will see on the chart is a short position on peaks and a long position on valleys. Just to be clear, the range as well as trends are merely illusions as the chart only receives prices. However, this script attempts to calculate pivot points from the price stream. Rising pivots are shorts and falling pivots are longs. I refer to pivots as a vertex in this script which adds structural components to the chart formation (point, sides and a base). When trading in “Ping Pong” mode long and short positions are intermingled continuously as long as there exists a detectable vertex. Unfortunately, this can work against your backtest profitability on long duration trends where prices continue in a single direction without pullback. I have designed various features in the script to compensate for this event. A well configured script should perform in a range bound market and minimize losses in a trend. For a range trader the trend is most certainly not your friend. I also have a trend following version of this script for those not interested in trading the range.
This script makes use of the TradingView pyramid feature accessible from the properties tab. Additional trades can be placed in the draw-down space increasing the position size and thereby increasing the profit or loss when the position finally closes. Each individual add on trade increases its order size as a multiple of its pyramid level. This makes it easy to comply with NFA FIFO Rule 2-43(b) if the trades are executed here in America. The inputs dialog box contains various settings to adjust where the add on trades show up, under what circumstances and how frequent if at all. Please be advised that pyramiding is an advanced feature and can wipe out your account capital if your not careful. You can use the “Performance Bond Leverage” feature to stress test your account capital with varying pyramid levels during the backtest. Use modest settings with realistic capital until you discover what you think you can handle. See the“Performance Bond Leverage” description for more information.
In addition to pyramiding this script employs DCA which enables users to experiment with loss recovery techniques. This is another advanced feature which can increase the order size on new trades in response to stopped out or winning streak trades. The script keeps track of debt incurred from losing trades. When the debt is recovered the order size returns to the base amount specified in the TV properties tab. The inputs for this feature include a limiter to prevent your account from depleting capital during runaway markets. The main difference between DCA and pyramids is that this implementation of DCA applies to new trades while pyramids affect open positions. DCA is a popular feature in crypto trading but can leave you with large “bags” if your not careful. In other markets, especially margin trading, you’ll need a well funded account and much experience.
To be sure pyramiding and dollar cost averaging is as close to gambling as you can get in respectable trading exchanges. However, if you are looking to compete in a Forex contest or want to add excitement to your trading life style those features could find a place in your strategies. Although your backtest may show spectacular gains don’t expect your live trading account to do the same. Every backtest has some measure to data mining bias. Please remember that.
This script is equipped with a consecutive loss counter. A limit field is provided in the report section of the input dialog box. This is a whole number value that, when specified, will generate a label on the chart when consecutive losses exceed the threshold. Every stop hit beyond this limit will be reported on a version 4 label above the bar where the stop is hit. Use the location of the labels along with the summary report tally to improve the adaptability of system. Don’t simply fit the chart. A good trading system should adapt to ever changing market conditions. On the study version the consecutive loss limit can be used to halt live trading on the broker side (managed manually).
This script can simulate leverage applied to your account capital. Basically, you want to know if the account capital you specified in the properties tab is sufficient to trade this script with the order size, pyramid and DCA parameters needed. TradingView does not halt trading when the account capital is depleted nor do you receive notification of such an event. Input the leverage you intend to trade with and simulate the stress on your account capital. When the check box labeled “Report Margin Call” is enabled a marker will plot on the chart at the location where the threshold was breached. Additionally, the Summary Report will indicated such a breach has occurred during the backtest. Please note that the margin calculation uses a performance bond contract model which is the same type of leverage applied to Forex accounts. This is not the same leverage as stock margin accounts since shares are not actually borrowed. It is also not applicable to futures contracts since we do not calculate maintenance margin. Also note that the account margin and buying power are calculated using the U.S. Dollar as a funding currency. Margin rules across the globe vary considerably so use this feature as an approximation. The “Report Margin Call” plot only appears on negative buying power which is well beyond the NFA enforced margin closeout price. Vary the order size and account capital and activate the buying power plot to get as close as you can to the desired margin call threshold. Also keep in mind that rollover fees, commissions, spreads, etc affect the margin call in actual live trading. This feature does not include any of those costs.
Inputs
The script input dialog box is divided into five sections. The last section, Section 5, contains all of the script reporting options. Notable reporting options are the inputs which provide support for calculating actual Sharpe Ratios and other risk / performance metrics. The TradingView performance report does not produce a scalable Sharpe Ratio which is unfortunate considering the limited data supplied to the backtest. Three report fields made available in this section are intended to enable users to measure the performance of this script using various industry standard risk metrics. In particular, The Sharpe Ratio, Sortino Ratio, Alpha Calculation, Beta Calculation, R-Squared and Monthly Standard Deviation. The following fields are dedicated to this effort:
– ROR Sample Period - Integer number which specifies the rate of return period. This number is a component of the Sharpe Ratio and determines the number of sample periods divisible in the chart data. The number specified here is the length of the period measured in bar intervals. Since the quantity of TradingView historical data is limited this number should reflect the scalar value applied to your Sharpe calculation. When the checkbox “Report Period ROR” is enabled red boxes plot on the dates corresponding to the ROR sample period. The red boxes display information useful in calculating various risk and performance models. Ongoing buying power is included in the period report which is especially useful in assessing the DCA stress on account capital. Important: When the “ROR Sample Period” is specified the script computes the ROR mean value and displays the result in the summary report label on the live end of the chart. Use this number to calculate the historical standard deviation of period returns.
– Return Mean Value - This is the ROR mean value which is displayed in the summary report field “ROR Mean”. Enter the value shown in the summary report here in order to calculate the standard deviation of returns. Once calculated the result is displayed in the summary report field “Standard Dev”. Please note that ROR and standard deviation are calculated on the quote currency of the chart and not the account currency. If you intend to calculate risk metrics based on other denominated returns use the period calculations in a spreadsheet. Important: Do not change the account denomination on the properties tab simply to force a dollar calculation. It will alter the backtest itself since the minimum profit, stop-loss and other variables are always measured in the quote currency of the chart.
– Report Period ROR - This checkbox is used to display the ROR period report which plots a red label above the bars corresponding to the ROR sample period. The sample period is defined by the value entered into the “ROR Sample Period” field. This checkbox only determines if the period labels plot on the chart. It does not enable or disable the ROR calculation itself. Please see input description“ROR Sample Period” for a detailed description of this feature.
Design
This script uses twelve indicators on a single time frame. The original trading algorithms are a port from a much larger program on another trading platform. I’ve converted some of the statistical functions to use standard indicators available on TradingView. The setups make heavy use of the Hull Moving Average in conjunction with EMAs that form the Bill Williams Alligator as described in his book “New Trading Dimensions” Chapter 3. Lag between the Hull and the EMAs form the basis of the entry and exit points. The vertices are calculated using one of five featured indicators. Each indicator is actually a composite of calculations which produce a distinct mean. This mathematical distinction enables the script to be useful on various instruments which belong to entirely different markets. In other words, at least one of these indicators should be able generate pivots on an arbitrarily selected instrument. Try each one to find the best fit.
The entire script is around 2200 lines of Pine code which pushes the limits of what can be created on this platform given the TradingView maximums for: local scopes, run-time duration and compile time. This script incorporates code from both my range trader and trend following published programs. Both have been in development for nearly two years and have been in beta test for the last several months. During the beta test of the range trading script it was discovered that by widening the stop and delaying the entry, add on trading opportunities appeared on the chart. I determined that by sacrificing a few minor features code space could be made available for pyramiding capability in the range trader. The module has been through several refactoring passes and makes extensive use of ternary statements. As such, It takes a full three minutes to compile after adding it to a chart. Please wait for the hovering dots to disappear before attempting to bring up the input dialog box. For the most part the same configuration settings for the range script can be applied to this script.
Inputs to the script use cone centric measurements in effort to avoid exposing adjustments to the various internal indicators. The goal was to keep the inputs relevant to the actual trade entry and exit locations as opposed to a series of MA input values and the like. As a result the strategy exposes over 70 inputs grouped into long or short sections. Inputs are available for the usual minimum profit and stop-loss as well as safeguards, trade frequency, pyramids, DCA, modes, presets, reports and lots of calibrations. The inputs are numerous, I know. Unfortunately, at this time, TradingView does not offer any other method to get data in the script. The usual initialization files such as cnf, cfg, ini, json and xml files are currently unsupported.
I have several example configuration settings that I use for my own trading. They include cryptocurrencies and forex instruments on various time frames.
Indicator Repainting and Anomalies
Indicator repainting is an industry wide problem which mainly occurs when you mix backtest data with real-time data. It doesn't matter which platform you use some form of this condition will manifest itself on your chart over time. The critical aspect being whether live trades on your broker’s account continue to match your TradingView study.
Based on my experience with Pine, most of the problems stem from TradingView’s implementation of multiple interval access. Whereas most platforms provide a separate bar series for each interval requested, the Pine language interleaves higher time frames with the primary chart interval. The problem is exacerbated by allowing a look-ahead parameter to the Security function. The goal of my repaint prevention is simply to ensure that my signal trading bias remains consistent between the strategy, study and broker. That being said this is what I’ve done address this issue in this script:
1. This script uses only 1 time frame. The chart interval.
2. Every entry and exit condition is evaluated on closed bars only.
3. No security functions are called to avoid a look-ahead possibility.
4. Every contributing factor specified in the TradingView wiki regarding this issue has been addressed.
5. Entry and exit setups are not reliant on crossover conditions.
6. I’ve run a 10 minute chart live for a week and compared it to the same chart periodically reloaded. The two charts were highly correlated with no instances of completely opposite real-time signals. I do have to say that there were differences in the location of some trades between the backtest and the study. But, I think mostly those differences are attributable to trading off closed bars in the study and the use of strategy functions in the backtest.
The study does indeed bring up the TV warning dialog. The only reason for this is because the script uses an EMA indicator which according to TradingView is due to “peculiarities of the algorithm”. I use the EMA for the Bill Williams Alligator so there is no way to remove it.
One issue that comes up when comparing the strategy with the study is that the strategy trades show on the chart one bar later than the study. This problem is due to the fact that “strategy.entry()” and “strategy_exit()” do not execute on the same bar called. The study, on the other hand, has no such limitation since there are no position routines.
Please be aware that the data source matters. Cryptocurrency has no central tick repository so each exchange supplies TradingView its feed. Even though it is the same symbol the quality of the data and subsequently the bars that are supplied to the chart varies with the exchange. This script will absolutely produce different results on different data feeds of the same symbol. Be sure to backtest this script on the same data you intend to receive alerts for. Any example settings I share with you will always have the exchange name used to generate the test results.
Usage
The following steps provide a very brief set of instructions that will get you started but will most certainly not produce the best backtest. A trading system that you are willing to risk your hard earned capital will require a well crafted configuration that involves time, expertise and clearly defined goals. As previously mentioned, I have several example configs that I use for my own trading that I can share with you. To get hands on experience in setting up your own symbol from scratch please follow the steps below.
The input dialog box contains over 70 inputs separated into five sections. Each section is identified as such with a makeshift separator input. There are three main areas that must to be configured: long side, short side and settings that apply to both. The rest of the inputs apply to pyramids, DCA, reporting and calibrations. The following steps address these three main areas only. You will need to get your backtest in the black before moving on to the more advanced features.
Step 1. Setup the Base currency and order size in the properties tab.
Step 2. Select the calculation presets in the Instrument Type field.
Step 3. Select “No Trade” in the Trading Mode field.
Step 4. Select the Histogram indicator from Section 2. You will be experimenting with different ones so it doesn’t matter which one you try first.
Step 5. Turn on Show Markers in Section 2.
Step 6. Go to the chart and checkout where the markers show up. Blue is up and red is down. Long trades show up along the red markers and short trades on the blue.
Step 7. Make adjustments to “Base To Vertex” and “Vertex To Base” net change and roc in Section 3. Use these fields to move the markers to where you want trades to be.
Step 8. Try a different indicator from Section 2 and repeat Step 7 until you find the best match for this instrument on this interval. This step is complete when the Vertex settings and indicator combination produce the most favorable results.
Step 9. Go to Section 3 and enable “Apply Red Base To Base Margin”.
Step 10. Go to Section 4 and enable “Apply Blue Base To Base Margin”.
Step 11. Go to Section 2 and adjust “Minimum Base To Base Blue” and “Minimum Base To Base Red”. Observe the chart and note where the markers move relative to each other. Markers further apart will produce less trades but will reduce cutoffs in “Ping Pong” mode.
Step 12. Return to Section 3 and 4 and turn off “Base To Base Margin” which was enabled in steps 9 and 10.
Step 13. Turn off Show Markers in Section 2.
Step 14. Put in your Minimum Profit and Stop Loss in the first section. This is in pips or currency basis points (chart right side scale). Percentage is not currently supported. This is a fixed value minimum profit and stop loss. Also note that the profit is taken as a conditional exit on a market order not a fixed limit. The actual profit taken will almost always be greater than the amount specified (due to the exit condition). The stop loss, on the other hand, is indeed a hard number which is executed by the TradingView broker simulator when the threshold is breached. On the study version, the stop is executed at the close of the bar.
Step 15. Return to step 3 and select a Trading Mode (Long, Short, BiDir, Ping Pong). If you are planning to trade bidirectionally its best to configure long first then short. Combine them with “BiDir” or “Ping Pong” after setting up both sides of the trade individually. The difference between “BiDir” and “Ping Pong” is that “Ping Pong” uses position reversal and can cut off opposing trades less than the specified minimum profit. As a result “Ping Pong” mode produces the greatest number of trades.
Step 16. Take a look at the chart. Trades should be showing along the markers plotted earlier.
Step 17. Make adjustments to the Vertex fields in Section 2 until the TradingView performance report is showing a profit. This includes the “Minimum Base To Base” fields. If a profit cannot be achieved move on to Step 18. Other adjustments may make a crucial difference.
Step 18. Improve the backtest profitability by adjusting the “Entry Net Change” and “Entry ROC” in Section 3 and 4.
Step 19. Enable the “Mandatory Snap” checkbox in Section 3 and 4 and adjust the “Snap Candle Delta” and “Snap Fractal Delta” in Section 2. This should reduce some chop producing unprofitable reversals.
Step 20. Increase the distance between opposing trades by adding an “Interleave Delta” in Sections 3 and 4. This is a floating point value which starts at 0.01 and typically does not exceed 2.0.
Step 21. Increase the distance between opposing trades even further by adding a “Decay Minimum Span” in Sections 3 and 4. This is an absolute value specified in the symbol’s quote currency (right side scale of the chart). This value is similar to the minimum profit and stop loss fields in Section 1.
Step 22. Improve the backtest profitability by adjusting the “Sparse Delta” in Section 3 and 4.
Step 23. Improve the backtest profitability by adjusting the “Chase Delta” in Section 3 and 4.
Step 24. Improve the backtest profitability by adjusting the “Adherence Delta” in Section 3 and 4. This field requires the “Adhere to Rising Trend” checkbox to be enabled.
Step 25. Try each checkbox in Section 3 and 4. See if it improves the backtest profitability. The “Caution Lackluster” checkbox only works when “Caution Mode” is enabled.
Step 26. Enable the reporting conditions in Section 5. Look for long runs of consecutive losses or high debt sequences. These are indications that your trading system cannot withstand sudden changes in market sentiment.
Step 27. Examine the chart and see that trades are being placed in accordance with your desired trading goals. This is an important step. If your desired model requires multiple trades per day then you should be seeing hundreds of trades on the chart. Alternatively, you may be looking to trade fewer steep peaks and deep valleys in which case you should see trades at major turning points. Don’t simply settle for what the backtest serves you. Work your configuration until the system aligns with your desired model. Try changing indicators and even intervals if you cannot reach your simulation goals. Generally speaking, the histogram and Candle indicators produce the most trades. The Macro indicator captures the tallest peaks and valleys.
Step 28. Apply the backtest settings to the study version and perform forward testing.
This script is open for beta testing. After successful beta test it will become a commercial application available by subscription only. I’ve invested quite a lot of time and effort into making this the best possible signal generator for all of the instruments I intend to trade. I certainly welcome any suggestions for improvements. Thank you all in advance.
One final note. I'm not a fan of having the Performance Overview (blue wedge) automatically show up at the end of the publish page since it could be misleading. On the EUR/USD backtest showing here I used a minimum profit of 65 pips, a stop of 120 pips, the candle indicator and a 5 pyramid max value. Also Mark Pyramid Levels (blue triangles) are enabled along with a 720 ROR Sample Period (red labels).
Market Facilitation Index (MFI) in combination with VolumeMarket Facilitation Index indicator taken from "Trading Chaos" by Bill Williams.
MFI must be used in combination with volume:
GREEN = Volume up + MFI up (indicated by a green diamond)
SQUAT = Volume up + MFI down (indicated by a purple star)
FAKE = Volume down + MFI up (indicated by a red x)
FADE = Volume down + MFI down (indicated by a grey circle)
PS you can hide the orange MFI histogram in settings since you already have signals shown.
ChaosSN Breakout SignalsThis signal indicator combines some key turning points including Fractals, Volume , Moving average and Momentum to try and pinpoint the moments a breakout or reversal is likely.
Purple Arrows:
Shows a possible breakout/breakdown is pending. Wait for the close and only pay attention to the most recent arrows. Place a long/short sell above or below the purple price line which will be generated at the time of the signal generated.
An ideal setup will include watching the AO/AC/Oscillator to make sure they align with the direction of the entry.
v2:
-Added labels to arrows
-Added optional rules for stricter fractal identification
-Added more toggling options to help with cleaner charting
Ace Pro Custom Williams %R Indicator [FREE]The Ace Pro Custom Williams %R Indicator comes preset with most of Ace’s favorite options in one: the Williams %R, the LSMA, and the EMA, and horizontal lines.
Adding these options manually can take up lots of time and space, so this indicator is designed to help traders save both.
Special note about selecting colors:
Order of items in the menu:
1. %R = %R
2. Plot = LSMA
3. Plot = EMA
To confirm, the first plot option is for the color of the LSMA, while the second plot option is for the color of the EMA.
SNAC - AccelerationAcceleration / Deceleration Oscillator (AC) measures the acceleration and deceleration of the current momentum.
Bill Williams says that before the price behaviour changes, the momentum changes and, even before the momentum, we see the change in the acceleration.
A buy above the zero line signal is generated when there are two consecutive green histogram bars. Opposite is true for a sell signal.
ChaosSN-AOAwesome Oscillator (AO) determines market momentum at a given time on the last 5 bars, comparing them to the momentum on the last 34 bars. There are many ways it can be used but in a nutshell, it quickly shows the current bearish/bullish trend (green = bull, red = bear).
The background is highlight red/green to highlight bars matching the "Saucer" criteria (1 of the many ways it can be used)
Awesome Oscillator Saucer buy signal:
Generated when the histogram which is above the zero line changes its direction from falling to rising. Once the signal has been generated, place a Buy Stop one tick above the high of the price bar that's highlighted. The most recent saucer signal cancels all previous ones (do not forget to delete pending orders after the signal is cancelled).
Opposite is true for an AO "Saucer" sell signal.
Williams Fractal (equals fixed)In contrast to the default Williams Fractal generator, this one also shows fractals if the two candles before or after are equal (>=, <=).
BITMEX Bybit binance Bitfinex BTC ETH AO DMI TREND AlertBITMEX Bybit binance Bitfinex Coinbase OKCOIN BTC ETH AO DMI TREND Alert
This is a very effective trend strategy.
BITMEX Bybit binance Bitfinex BTC ETH AO DMI 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 2H 比特币期货 2 hours Bitcoin Futures
Bitmex XBTUSD 30分钟 比特币期货 30 minutes Bitcoin Futures
这个指标具有广泛的适用性,可以适用多个不同交易品种。
该指标还适用于ETHUSD交易品种等,只需调整默认配置即可。
Bybit ETHUSD 30分钟 以太币合约 30分钟 ETHUSD Futures
使用该指标的警报设置,它可以在自动交易机器人上很好地工作,而无重绘错误的信号。
BITMEX Bybit binance Bitfinex BTC ETH AO DMI TREND strategyBITMEX Bybit binance Bitfinex Coinbase OKCOIN BTC ETH AO DMI TREND strategy
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 2H 比特币期货 2 hours Bitcoin Futures
Bitmex XBTUSD 30分钟 比特币期货 30 minutes Bitcoin Futures
这个指标具有广泛的适用性,可以适用多个不同交易品种。
该指标还适用于ETHUSD交易品种等,只需调整默认配置即可。
Bybit ETHUSD 30分钟 以太币合约 30分钟 ETHUSD Futures
使用该指标的警报设置,它可以在自动交易机器人上很好地工作,而无重绘错误的信号。
[OBV] [MACD] [Accelerator/Awesome Oscillator] + PivDiv 2Here is an indicator with 4 options:
- OBV
- MACD (uses default EMA, you can change this to SMA)
- AC
- AO
All accompanied with my "Divergences (Pivots)" with 3 settings:
- 'Long Period', default checks 19 bars to the Left (="History") and 1 bar to the Right (="Future")
- 'Medium Period', default checks 14 bars to the Left (="History") and 1 bar to the Right (="Future")
- 'Short Period', default checks 9 bars to the Left (="History") and 1 bar to the Right (="Future")
When choosing an indicator, it comes with their accompanying "Divergences"!
Each Bar checks an amount of Bars at the Left (="History") and Bars to the Right (="Future"), insuring this particular Bar is the Highest or Lowest of them all at "close",
this is compared to the or or and so we have our Divergences.
There is always a slight delay (number of Bar(s) at the Right side (="Future")
If you like a setting, where the amount of “RightBars” equals the ”LeftBars” you can enable the " > Only change 'LeftBars'" button.
Then you only have to adjust the amount of “LeftBars” and the amount of “RightBars” automatically will be the same.
Bullish divergences are "Green"
- 'Short' - 'Medium' "period" > "▲"
- 'Long' "period" > "⇧"
Bearish divergences are "Red"
- 'Short' - 'Medium' "period" > "▼"
- 'Long' "period" > "⇩"
Hidden divergences ( Bullish and Bearish ) are:
- 'Short' - 'Medium' "period" > "▲▼" - "White"
- 'Long' "period" > "⬆︎⬇︎" - "Yellow"
Since for me, at this moment, it is impossible to let this indicator work as our eyes work, it will miss sometimes. I've tried to solve this by putting 3 different "Periods",
but it is not perfect, so look at it as an aiding tool, a "hint" so you can look in detail if there is something of importance or not.
What also helps is to switch timeframes.
For example on a 1 hour chart a "Highest" point can be missed sometimes, but could be perfectly visible on a 2 or 4 hour chart.
Also, try to change the numbers in a way that suits you the best.
Enjoy!
ChaosVChaosV- Chaos Volume, is another Bill Williams' style indicator. It's essentially the Profitunity Candles, but in a Volume Bar setup. It incorporates MFI, to determine if a bar meets the Green, Squat, Fade or Fake requirements, as set by Bill Williams in his book Trading Chaos.
ProfitunityCandlesProfitunity Candles have 4 labels, based off Bill Williams' work, particularly in his "Trading Chaos" book....Candles will generally be a Green, Squat, Fade or Fake. This is determined by Volume and MFI....Basically alerting you to the efficiency of the market at any given moment. You can research the meaning of the 4 types on your own, Google is your Friend.
Full Range Trading Study with Alerts and DCA
Introduction
This is the study version of my range trading strategy. It is designed to be a “drop in” replacement for its twin strategy. I have replicated the analysis logic and entry and exit procedures to produce a nearly identical result set to the strategy. Other than the properties tab, the inputs dialog is exactly the same. Backtest the strategy to determine the best inputs to trade. Then apply the same inputs to this study to forward test. Alerts are available for trade entry, take profit close and stop-loss exit. Please see the strategy version for a complete description of the trading behavior of this script.
In brief, this script is intended to benefit from a range bound market. The trading behavior is to buy on weakness and sell on strength. As such trade orders are placed in a counter direction to price pressure. What you will see on the chart is a short position on peaks and a long position on valleys. This is accomplished by calculating pivot points from the price stream. Rising pivots are shorts and falling pivots are longs. I refer to pivots as a vertex in the inputs dialog box. The cone based measurement adds a peak, sides and a base to the calculation elements. This allows the inputs to focus on adjusting the location of trades and not just trend lines. The pivot points can be plotted on the backtest. You can use the vertex input values to move the pivots where you want trades to be. This script can be traded in four different modes: Long, Short, BiDir, and Ping Pong. When trading in “Ping Pong” mode long and short positions are intermingled continuously as long as there exists a detectable vertex. I also have a trend following version of this script for those not interested in trading the range.
This script employs a DCA feature which enables users to experiment with loss recovery techniques in the backtest. Here in the study the summary report displays the “Debt Sequence” number which can be used to manually increase the order size on subsequent trades at the broker. The script keeps track of debt incurred from losing trades. When the debt is recovered the “Debt Sequence” resets to zero so orders can return to the base size. Be sure to set the limiter to prevent your account from depleting capital during runaway markets.
Consecutive loss limit can be set to report a breach of the threshold value. Every stop hit beyond this limit will be reported on a version 4 label above the bar where the stop is hit. Use the consecutive loss limit to manually halt live trading on the broker side.
Design
This script uses twelve indicators on a single time frame and is approximately 1800 lines of Pine 4 code. The original trading algorithms are a port from a much larger program on another trading platform. I’ve converted some of the statistical functions to use standard indicators available on TradingView. The setups make heavy use of the Hull Moving Average in conjunction with EMAs that form the Bill Williams Alligator as described in his book “New Trading Dimensions” Chapter 3. Lag between the Hull and the EMAs form the basis of the entry and exit points. The vertices are calculated using one of five featured indicators: Volume, Histogram, Fractal, Candle and Macro. The backtest is used to determine the best fit for your desired trading instrument. The incorporation of five distinct pivot point calculations broadens the scope of the markets where this tool can be beneficial.
Example configurations for various instruments along with a detailed PDF user manual is available.
Indicator Repainting
Please see the strategy script for a more detailed description of the repaint problem. The goal of my repaint prevention in the study script is simply to ensure that my signal trading bias remains consistent between the strategy, study and broker. This script employs the following conventions in effort to avoid indicator repainting:
1. This script uses only 1 time frame. The chart interval.
2. Every entry and exit condition is evaluated on closed bars only.
3. Entry and exit plots are not triggered off trend line crossovers.
4. No security functions are called to avoid a look-ahead possibility.
5. Every contributing factor specified in the TradingView wiki regarding this issue has been addressed. Except the use of the exponential moving average which is essential to my strategy.
6. I’ve run a 10 minute chart live for a week and compared it to the same chart periodically reloaded. The two charts were highly correlated with no instances of completely opposite real-time signals
This script does indeed bring up the TradingView warning dialog. The only reason for this is due to “peculiarities of the algorithm” regarding the EMA as stated in the wiki article.
The Bottom Line. Does this script repaint. Yes, it will repaint about as much as every other trading platform which combines backtest data with real time prices in a live trading scenario.
Usage
Please be aware that the purpose of the study script is to perform forward testing of the configuration established in the backtest process. Therefore, the usage here in the study begins with the backtest configuration parameters. The following steps provide instructions to get this study script connected to the TradingView alert notification system. For a detailed description of how to create a range trading system using this script please see the strategy version.
Step 1. Create a chart with the trading instrument and interval used in the backtest.
Step 2. Find this script in the “Invite Only” section of the Indicators Dialog and apply it to the current chart.
Step 3. Copy the values from the backtest input dialog to the study.
Step 4. Open the TradingView Alert window.
Step 5. In the “Condition” drop down field find and select the name of the script.
Step 6. A new drop down field will appear with the alerts available in the script. This script exposes the following six signals:
Long Entry Signal
Long Profit Signal
Long Stop-loss Signal
Short Entry Signal
Short Profit Signal
Short Stop-loss Signal
Select the signal for which you want notification.
Step 7. In the “Options” field select the frequency of the alert. Typically, "Once Per Bar" or "Once Per Bar Close" will be sufficient.
Step 8. Set the expiration date and time.
Step 9. Select the action of the alert. Currently TradingView offers six different actions:
Notify on App
Show Popup
Send Email
Webhook URL
Play Sound
Send Email to SMS
Step 10. Create a message to to transmitted with the alert. The script provides a default message which can be overridden with any custom description. The price, time and other reserved chart elements can be included in the message
Step 11. Click the “Create” button to generate this single alert.
Step 12. Repeat steps 1 through 11 for every signal you wish to receive.
This script is open for beta testing. After successful beta test it will become a commercial application available by subscription only. I’ve invested quite a lot of time and effort into making this the best possible signal generator for all of the instruments I intend to trade. I certainly welcome any suggestions for improvements. Thank you all in advance.
FractalsMLCombine 2 Fractals into one indicator with default left and right bars are 6 and 24 respectively.
It's for Forex Traders Vietnam group.
Full Range Trading Strategy with DCA - Crypto, Forex, Stocks
Introduction
This is a Pine 4 range trading strategy. It has a twin study with several alerts. The design intent is to produce a commercial grade signal generator that can be adapted to any symbol and interval. Ideally, the script is reliable enough to be the basis of an automated trading system web-hooked to a server with API access to crypto, forex and stock brokerages. The strategy can be run in three different modes: long, short and bidirectional.
As a range trading strategy, the behavior of the script is to buy on weakness and sell on strength. As such trade orders are placed in a counter direction to price pressure. What you will see on the chart is a short position on peaks and a long position on valleys. Just to be clear, the range as well as trends are merely illusions as the chart only receives prices. However, this script attempts to calculate pivot points from the price stream. Rising pivots are shorts and falling pivots are longs. I refer to pivots as a vertex in this script which adds structural components to the chart formation. When trading in “Ping Pong” mode long and short positions are intermingled continuously as long as there exists a detectable vertex. Unfortunately, this can work against your backtest profitability on long duration trends where prices continue in a single direction without pullback. I have designed various features in the script to compensate for this event. A well configured script should perform in a range bound market and minimize losses in a trend. I also have a trend following version of this script for those not interested in trading the range. Please be aware these are two types of traders. You should know who you are.
This script employs a DCA feature which enables users to experiment with loss recovery techniques. This is an advanced feature which can increase the order size on new trades in response to stopped out or winning streak trades. The script keeps track of debt incurred from losing trades. When the debt is recovered the order size returns to the base amount specified in the TV properties tab. The inputs for this feature include a limiter to prevent your account from depleting capital during runaway markets. This implementation of DCA does not use pyramid levels. Only the order size on subsequent new trades are affected. Pyramids on the other hand increase the size of open positions. If you are interested in seeing pyramids in action please see the trend version of this script which features both DCA and pyramids. While DCA is a popular feature in crypto trading, it can make you a “bag” holder if your not careful. In other markets, especially margin trading, you’ll need a well funded account and much trading experience to manage this feature safely.
Consecutive loss limit can be set to report a breach of the threshold value. Every stop hit beyond this limit will be reported on a version 4 label above the bar where the stop is hit. Use the location of the labels along with the summary report tally to improve the adaptability of system. Don’t simply fit the chart. A good trading system should adapt to ever changing market conditions. On the study version the consecutive loss limit can be used to halt live trading on the broker side (managed manually).
Design
This script uses twelve indicators on a single time frame. The original trading algorithms are a port from a much larger program on another trading platform. I’ve converted some of the statistical functions to use standard indicators available on TradingView. The setups make heavy use of the Hull Moving Average in conjunction with EMAs that form the Bill Williams Alligator as described in his book “New Trading Dimensions” Chapter 3. Lag between the Hull and the EMAs form the basis of the entry and exit points. The vertices are calculated using one of five featured indicators. Each indicator is actually a composite of calculations which produce a distinct mean. This mathematical distinction enables the script to be useful on various instruments which belong to entirely different markets. In other words, at least one of these indicators should be able generate pivots on an arbitrarily selected instrument. Try each one to find the best fit.
The entire script is around 1800 lines of Pine code which is the maximum incidental size given the TradingView limits: local scopes, run-time duration and compile time. I’ve been working on this script for nearly two years and have tested it on various instruments stocks, forex and crypto. It performs well on higher liquidity markets that have at least a year of historical data. Although the script can be implemented on any interval, it has been optimized for small time frames down to 5 minutes. The 10 minute BTC/USD produces around 500 trades in 2 ½ months. The 1 hour BTC/USD produces around 1300 trades in 1 ½ years. Originally, this script contained both range trading and trend following logic but had to be broken into separate scripts due to the aforementioned limitations.
Inputs to the script use cone centric measurements in effort to avoid exposing adjustments to the various internal indicators. The goal was to keep the inputs relevant to the actual trade entry and exit locations as opposed to a series of MA input values and the like. As a result the strategy exposes over 50 inputs grouped into long or short sections. Inputs are available for the usual minimum profit and stop-loss as well as safeguards, trade frequency, DCA, modes, presets, reports and lots of calibrations. The inputs are numerous, I’m aware. Unfortunately, at this time, TradingView does not offer any other method to get data in the script. The usual initialization files such as cnf, cfg, ini, json and xml files are currently unsupported.
Example configurations for various instruments along with a detailed PDF user manual is available.
Indicator Repainting And Anomalies
Indicator repainting is an industry wide problem which mainly occurs when you mix backtest data with real-time data. It doesn't matter which platform you use some form of this condition will manifest itself on your chart over time. The critical aspect being whether live trades on your broker’s account continue to match your TradingView study.
Tackling this repainting issue has been a major project goal of this script. Based on my experience with Pine, most of the problems stem from TradingView’s implementation of multiple interval access. Whereas most platform provide a separate bar series for each interval requested, the Pine language interleaves higher time frames with the primary chart interval. The problem is exacerbated by allowing a look-ahead parameter to the Security function. The goal of my repaint prevention is simply to ensure that my signal trading bias remains consistent between the strategy, study and broker. That being said this is what I’ve done address this issue in this script:
1. This script uses only 1 time frame. The chart interval.
2. Every entry and exit condition is evaluated on closed bars only.
3. No security functions are called to avoid a look-ahead possibility.
4. Every contributing factor specified in the TradingView wiki regarding this issue has been addressed.
5. I’ve run a 10 minute chart live for a week and compared it to the same chart periodically reloaded. The two charts were highly correlated with no instances of completely opposite real-time signals.
The study does indeed bring up the TV warning dialog. The only reason for this is because the script uses an EMA indicator which according to TradingView is due to “peculiarities of the algorithm”.
One issue that comes up when comparing the strategy with the study is that the strategy trades show on the chart one bar later than the study. This problem is due to the fact that “strategy.entry()” and “strategy_exit()” do not execute on the same bar called. The study, on the other hand, has no such limitation since there are no position routines.
Please be aware that the data source matters. Cryptocurrency has no central tick repository so each exchange supplies TradingView its feed. Even though it is the same symbol the quality of the data and subsequently the bars that are supplied to the chart varies with the exchange. This script will absolutely produce different results on different data feeds of the same symbol. Be sure to backtest this script on the same data you intend to receive alerts for. Any example settings I share with you will always have the exchange name used to generate the test results.
Usage
The following steps provide a very brief set of instructions that will get you started but will most certainly not produce the best backtest. A trading system that you are willing to risk your hard earned capital will require a well crafted configuration that involves time, expertise and clearly defined goals. As previously mentioned, I have several example configs that I use for my own trading that I can share with you along with a PDF which describes each input in detail. To get hands on experience in setting up your own symbol from scratch please follow the steps below.
The input dialog box contains over 50 inputs separated into five sections. Each section is identified as such with a makeshift separator input. There are three main areas that must to be configured: long side, short side and settings that apply to both. The rest of the inputs apply to DCA, reporting and calibrations. The following steps address these three main areas only. You will need to get your backtest in the black before moving on to the more advanced features.
Step 1. Setup the Base currency and order size in the properties tab.
Step 2. Select the calculation presets in the Instrument Type field.
Step 3. Select “No Trade” in the Trading Mode field.
Step 4. Select the Histogram indicator from Section 2. You will be experimenting with different ones so it doesn’t matter which one you try first.
Step 5. Turn on Show Markers in Section 2.
Step 6. Go to the chart and checkout where the markers show up. Blue is up and red is down. Long trades show up along the red markers and short trades on the blue.
Step 7. Make adjustments to “Base To Vertex” and “Vertex To Base” net change and roc in Section 3. Use these fields to move the markers to where you want trades to be.
Step 8. Try a different indicator from Section 2 and repeat Step 7 until you find the best match for this instrument on this interval. This step is complete when the Vertex settings and indicator combination produce the most favorable results.
Step 9. Go to Section 3 and enable “Apply Red Base To Base Margin”.
Step 10. Go to Section 4 and enable “Apply Blue Base To Base Margin”.
Step 11. Go to Section 2 and adjust “Minimum Base To Base Blue” and “Minimum Base To Base Red”. Observe the chart and note where the markers move relative to each other. Markers further apart will produce less trades but will reduce cutoffs in “Ping Pong” mode.
Step 12. Return to Section 3 and 4 and turn off “Base To Base Margin” which was enabled in steps 9 and 10.
Step 13. Turn off Show Markers in Section 2.
Step 14. Put in your Minimum Profit and Stop Loss in the first section. This is in pips or currency basis points (chart right side scale). Percentage is not currently supported. This is a fixed value minimum profit and stop loss. Also note that the profit is taken as a conditional exit on a market order not a fixed limit. The actual profit taken will almost always be greater than the amount specified. The stop loss, on the other hand, is indeed a hard number which is executed by the TradingView broker simulator when the threshold is breached. On the study version, the stop is executed at the close of the bar.
Step 15. Return to step 3 and select a Trading Mode (Long, Short, BiDir, Ping Pong). If you are planning to trade bidirectionally its best to configure long first then short. Combine them with “BiDir” or “Ping Pong” after setting up both sides of the trade individually. The difference between “BiDir” and “Ping Pong” is that “Ping Pong” uses position reversal and can cut off opposing trades less than the specified minimum profit. As a result “Ping Pong” mode produces the greatest number of trades.
Step 16. Take a look at the chart. Trades should be showing along the markers plotted earlier.
Step 17. Make adjustments to the Vertex fields in Section 2 until the TradingView performance report is showing a profit. This includes the “Minimum Base To Base” fields. If a profit cannot be achieved move on to Step 18.
Step 18. Improve the backtest profitability by adjusting the “Long Entry Net Change” and “Long Entry ROC” in Section 3.
Step 19. Improve the backtest profitability by adjusting the “Short Entry Net Change” and “Short Entry ROC” in Section 4.
Step 20. Improve the backtest profitability by adjusting the “Sparse Long Delta” in Section 3.
Step 21. Improve the backtest profitability by adjusting the “Chase Long Delta” in Section 3.
Step 22. Improve the backtest profitability by adjusting the “Long Adherence Delta” in Section 3. This field requires the “Adhere to Rising Trend” checkbox to be enabled.
Step 23. Try each checkbox in Section 3 and see if it improves the backtest profitability. The “Caution Lackluster Longs” checkbox only works when “Long Caution Mode” is enabled.
Step 24. Improve the backtest profitability by adjusting the “Sparse Short Delta” in Section 4.
Step 25. Improve the backtest profitability by adjusting the “Chase Short Delta” in Section 4.
Step 26. Improve the backtest profitability by adjusting the “Short Adherence Delta” in Section 4. This field requires the “Adhere to Falling Trend” checkbox to be enabled.
Step 27. Try each checkbox in Section 4 and see if it improves the backtest profitability. The “Caution Lackluster Shorts” checkbox only works when “Short Caution Mode” is enabled.
Step 28. Enable the reporting conditions in Section 5. Look for long runs of consecutive losses or high debt sequences. These are indications that your trading system cannot withstand sudden changes in market sentiment.
Step 29. Examine the chart and see that trades are being placed in accordance with your desired trading goals. This is an important step. If your desired model requires multiple trades per day then you should be seeing hundreds of trades on the chart. Alternatively, you may be looking to trade fewer steep peaks and deep valleys in which case you should see trades at major turning points. Don’t simply settle for what the backtest serves you. Work your configuration until the system aligns with your desired model. Try changing indicators and even intervals if you cannot reach your simulation goals. Generally speaking, the histogram and Candle indicators produce the most trades. The Macro indicator captures the tallest peaks and valleys.
Step 30. Apply the backtest settings to the study version and perform forward testing.
This script is open for beta testing. After successful beta test it will become a commercial application available by subscription only. I’ve invested quite a lot of time and effort into making this the best possible signal generator for all of the instruments I intend to trade. I certainly welcome any suggestions for improvements. Thank you all in advance.
Study Bot IgnaceThis INVIT-ONLY strategy is based on EMA / Fixe SL / William and you optimize for 1min scalping on bitmex
Please use comment section for any feedback.
I have also a study with alarms Long Entry / Long Exit / Short Entry / Short Exit
For any question DM me for any request.
## DISCLAIMER
1. I am not licensed financial advisors or broker dealers. I do not tell you when or what to buy or sell. I developed this software which enables you execute manual or automated trades multiple trades using TradingView. The software allows you to set the criteria you want for entering and exiting trades.
2. Do not trade with money you cannot afford to lose.
3. I do not guarantee consistent profits or that anyone can make money with no effort. And I am not selling the holy grail.
4. Every system can have winning and losing streaks.
5. Money management plays a large role in the results of your trading. For example: lot size, account size, broker leverage, and broker margin call rules all have an effect on results. Also, your Take Profit and Stop Loss settings for individual pair trades and for overall account equity have a major impact on results. If you are new to trading and do not understand these items, then I recommend you seek education materials to further your knowledge.
**YOU NEED TO FIND AND USE THE TRADING SYSTEM THAT WORKS BEST FOR YOU AND YOUR TRADING TOLERANCE.**
**I HAVE PROVIDED NOTHING MORE THAN A TOOL WITH OPTIONS FOR YOU TO TRADE WITH THIS PROGRAM ON TRADINGVIEW.**
Strategy Bot IgnaceThis INVIT-ONLY strategy is based on EMA / Fixe SL / William and you optimize for 1min scalping on bitmex
Please use comment section for any feedback.
I have also a study with alarms Long Entry / Long Exit / Short Entry / Short Exit
For any question DM me for any request.
## DISCLAIMER
1. I am not licensed financial advisors or broker dealers. I do not tell you when or what to buy or sell. I developed this software which enables you execute manual or automated trades multiple trades using TradingView. The software allows you to set the criteria you want for entering and exiting trades.
2. Do not trade with money you cannot afford to lose.
3. I do not guarantee consistent profits or that anyone can make money with no effort. And I am not selling the holy grail.
4. Every system can have winning and losing streaks.
5. Money management plays a large role in the results of your trading. For example: lot size, account size, broker leverage, and broker margin call rules all have an effect on results. Also, your Take Profit and Stop Loss settings for individual pair trades and for overall account equity have a major impact on results. If you are new to trading and do not understand these items, then I recommend you seek education materials to further your knowledge.
**YOU NEED TO FIND AND USE THE TRADING SYSTEM THAT WORKS BEST FOR YOU AND YOUR TRADING TOLERANCE.**
**I HAVE PROVIDED NOTHING MORE THAN A TOOL WITH OPTIONS FOR YOU TO TRADE WITH THIS PROGRAM ON TRADINGVIEW.**
Chaloke SystemChaloke System
Buy=Short>Middle and Close > Short ,barcolor(green)
Sell=Close < Long or Short<Long,barcolor(red)
Total Trend Follow Strategy with Pyramid and DCA
Introduction
This is a Pine 4 trend following strategy. It has a twin study with several alerts. The design intent is to produce a commercial grade signal generator that can be adapted to any symbol and interval. Ideally, the script is reliable enough to be the basis of an automated trading system web-hooked to a server with API access to crypto, forex and stock brokerages. The strategy can be run in three different modes: long, short and bidirectional.
As a trend following strategy, the behavior of the script is to buy on strength and sell on weakness. As such the trade orders maintain its directional bias according to price pressure. What you will see on the chart is long positions on the left side of the mountain and short on the right. Long and short positions are not intermingled as long as there exists a detectable trend. This is extremely beneficial feature in long running bull or bear markets. The script uses multiple setups to avoid the situation where you got in on the trend, took a small profit but couldn’t get back in because the logic is waiting for a pullback or some other intricate condition.
Deep draw-downs are a characteristic of trend following systems and this system is no different. However, this script makes use of the TradingView pyramid feature accessible from the properties tab. Additional trades can be placed in the draw-down space increasing the position size and thereby increasing the profit or loss when the position finally closes. Each individual add on trade increases its order size as a multiple of its pyramid level. This makes it easy to comply with NFA FIFO Rule 2-43(b) if the trades are executed here in America. The inputs dialog box contains various settings to adjust where the add on trades show up, under what circumstances and how frequent if at all. Please be advised that pyramiding is an advanced feature and can wipe out your account capital if your not careful. During the backtest use modest setting with realistic capital until you discover what you think you can handle.
In addition to pyramiding this script employs DCA which enables users to experiment with loss recovery techniques. This is another advanced feature which can increase the order size on new trades in response to stopped out or winning streak trades. The script keeps track of debt incurred from losing trades. When the debt is recovered the order size returns to the base amount specified in the TV properties tab. The inputs for this feature include a limiter to prevent your account from depleting capital during runaway markets. The main difference between DCA and pyramids is that this implementation of DCA applies to new trades while pyramids affect open positions. DCA is a popular feature in crypto trading but can leave you with large “bags” if your not careful. In other markets, especially margin trading, you’ll need a well funded account and much experience.
Consecutive loss limit can be set to report a breach of the threshold value. Every stop hit beyond this limit will be reported on a version 4 label above the bar where the stop is hit. Use the location of the labels along with the summary report tally to improve the adaptability of system. Don’t simply fit the chart. A good trading system should adapt to ever changing market conditions. On the study version the consecutive loss limit can be used to halt live trading on the broker side (Managed manually).
Design
This script uses nine indicators on two time frames. The chart (primary) interval and one higher time frame which is based on the primary. The higher time frame identifies the trend for which the primary will trade. I’ve tried to keep the higher time frame around five times greater than the primary. The original trading algorithms are a port from a much larger program on another trading platform. I’ve converted some of the statistical functions to use standard indicators available on TradingView. The setups make heavy use of the Hull Moving Average in conjunction with EMAs that form the Bill Williams Alligator as described in his book “New Trading Dimensions” Chapter 3. Lag between the Hull and the EMAs form the basis of the entry and exit points. The alligator itself is used to identify the trend main body.
The entire script is around 1700 lines of Pine code which is the maximum incidental size given the TradingView limits: local scopes, run-time duration and compile time. I’ve been working on this script for over a year and have tested it on various instruments stocks, forex and crypto. It performs well on higher liquidity markets that have at least a year of historical data. Though it can be configured to work on any interval between 5 minutes and 1 day, trend trading is generally a longer term paradigm. For day trading the 10 to 15 minute interval will allow you to catch momentum breakouts. For intraweek trades 30 minutes to 1 hour should give you a trade every other a day. Four hours and above are for seasoned deep pocket traders. Originally, this script contained both range trading and trend following logic but had to be broken into separate scripts due to the aforementioned limitations.
Inputs to the script use cone centric measurements in effort to avoid exposing adjustments to the various internal indicators. The goal was to keep the inputs relevant to the actual trade entry and exit locations as opposed to a series of MA input values and the like. As a result the strategy exposes over 50 inputs grouped into long or short sections. Inputs are available for the usual minimum profit and stop-loss as well as safeguards, trade frequency, DCA, modes, presets, reports and lots of calibrations. The inputs are numerous, I’m aware. Unfortunately, at this time, TradingView does not offer any other method to get data in the script. The usual initialization files such as cnf, cfg, ini, json and xml files are currently unsupported.
Example configurations for various instruments along with a detailed PDF user manual is available.
Indicator Repainting And Anomalies
Indicator repainting is an industry wide problem which mainly occurs when you mix backtest data with real-time data. It doesn't matter which platform you use some form of this condition will manifest itself on your chart over time. The critical aspect being whether live trades on your broker’s account continue to match your TradingView study. Since this trading system is featured as two separate scripts, indicator repainting is addressed in the study version. The strategy (this script) is intended to be used on historical data to determine the appropriate trading inputs to apply in the study. As such, the higher time frame of this strategy will indeed repaint. Please do not attempt to trade from the strategy. Please see the study version for more information.
One issue that comes up when comparing the strategy with the study is that the strategy trades show on the chart one bar later than the study. This problem is due to the fact that “strategy.entry()” and “strategy_exit()” do not execute on the same bar called. The study, on the other hand, has no such limitation since there are no position routines. However, alerts that are subsequently fired off when triggered in the study are dispatched from the TradingView servers one bar later from the study plot. Therefore the alert you actually receive on your cell phone matches the strategy plot but is one bar later than the study plot. A lot can happen in four hours if you are trading off a 240 bar.
Please be aware that the data source matters. Cryptocurrency has no central tick repository so each exchange supplies TradingView its feed. Even though it is the same symbol the quality of the data and subsequently the bars that are supplied to the chart varies with the exchange. This script will absolutely produce different results on different data feeds of the same symbol. Be sure to backtest this script on the same data you intend to receive alerts for. Any example settings I share with you will always have the exchange name used to generate the test results.
Usage
The following steps provide a very brief set of instructions that will get you started but will most certainly not produce the best backtest. A trading system that you are willing to risk your hard earned capital will require a well crafted configuration that involves time, expertise and clearly defined goals. As previously mentioned, I have several example configs that I use for my own trading that I can share with you along with a PDF which describes each input in detail. To get hands on experience in setting up your own symbol from scratch please follow the steps below.
The input dialog box contains over 50 inputs separated into seven sections. Each section is identified as such with a makeshift separator input. There are three main areas that must to be configured: long side, short side and settings that apply to both. The rest of the inputs apply to pyramids, DCA, reporting and calibrations. The following steps address these three main areas only. You will need to get your backtest in the black before moving on to the more advanced features
Step 1. Setup the Base currency and order size in the properties tab.
Step 2. Select the calculation presets in the Instrument Type field.
Step 3. Select “No Trade” in the Trading Mode field.
Step 4. Select the Histogram indicator from section 3. You will be experimenting with different ones so it doesn’t matter which one you try first.
Step 5. Turn on Show Markers in Section 3.
Step 6. Go to the chart and checkout where the markers show up. Blue is up and red is down. Long trades show up along the blue markers and short trades on the red.
Step 7. Make adjustments to Base To Vertex and Vertex To Base net change and roc in section 3. Use these fields to move the markers to where you want trades to be. Blue is long and red is short.
Step 8. Try a different indicator from section 3 and repeat Step 7 until you find the best match for this instrument on this interval. This step is complete when the Vertex settings and indicator combination produce the most favorable results.
Step 9. Turn off Show Markers in Section 3.
Step 10. Enable the Symmetrical and Deviation calculation models at the top of section 5 and 6 (Symmetrical, Deviation).
Step 11. Put in your Minimum Profit and Stop Loss in the first section. This is in pips or currency basis points (chart right side scale)
Step 12. Return to step 3 and select a Trading Mode (Long, Short, BiDir, Flip Flop). If you are planning to trade bidirectionally its best to configure long first then short. Combine them with BiDir or Flip Flop after setting up both sides of the trade individually.
Step 13. Trades should be showing on the chart.
Step 14. Make adjustments to the Vertex fields in section 3 until the TradingView performance report is showing a profit.
Step 15. Change indicators and repeat step 14. Pick the best indicator.
Step 16. Use the check boxes in sections 5 and 6 to improve the performance of each side.
Step 17. Try adding the Correlation calculation model to either side. This model can sometimes produce a negative result but can be improved by enabling “Adhere To Markers” or “Narrow Correlation Scope” in the sections 5 and 6.
Step 18. Enable the reporting conditions in section 7. Look for long runs of consecutive losses or high debt sequences. These are indications that your trading system cannot withstand sudden changes in market sentiment.
Step 19. Examine the chart and see that trades are being placed in accordance with your desired trading model.
Step 20. Apply the backtest settings to the study version and perform forward testing.
This script is open for beta testing. After successful beta test it will become a commercial application available by subscription only. I’ve invested quite a lot of time and effort into making this the best possible signal generator for all of the instruments I intend to trade. I certainly welcome any suggestions for improvements. Thank you all in advance.