Trend trader StrategyFirst I would like to thank to @JustUncleL since this strategy started from one of his scalper strategies
This strategy can be adapted to all time charts .
First it has the session where we want to trade, for this example I choosed the EURUSD so I only take in consideration london/neywork session.
Its made from 3 EMA :
normal
slow
ultra slow
It has has the capacity to use HA candles into consideration if its needed.
At the same time we have a price channel made from faster MAs, that act like a bollinger band .
Together with all of them, we establish which trend we have if its uptrend or downtrend
Then we check the candles if they are below or above the MA , and based on the condition if they crossed recently we can suggest if its a buy or a long condition
At the same time we have 2 options of stop conditions:
Through a trailing stop made from ATR or % based
And second, a SL/TP made from pip points or % based.
For this example I used % based.
Let me know what you think about it, and if you found some nice settings for it. So far I only adapted to EURUSD 1 min time.
Swingtrading
ATR_Trade_strategyATR Based Strategy
Identify the ATR range on Daily Chart.
ATR HIGH= Previous Close +ATR
ATR Low =Previous Close - ATR
Long when Close is above ATR High
Short when Close is below ATR Low
Exit when close moves below EMA(10) OR
a user-selected max loss
Swing trading StrategyThis indicator based on capturing historical swing. It predicts future swing based on historical swing data. This is very useful for short term swing trading and gives best result on 30 minute chart.
TradeSense Breakout Strategy v1TradeSense is a Renko brick breakout trading system for short-term or intraday trade. It is also a trend following strategy using a confluence of multiple MA's to spot the underlying trend. Exit and Stop Loss is based on dynamic ATR to predict possible target based on ticker's real time volatility.
So far this has been back-tested on major cyrptos, and the same concept is applicable to other asset types. It is more suitable for lower timeframes (such as the 30m, 15m, and 5m) though you may try adjusting the parameters for higher timeframes.
Feel free to backtest it and comment below!
Optimum parameters:
BTCUSD-15m
- Noise Filter: 1
- ATRLength : 15
- SL coefficient : 2.0
- TP coefficient : 1.5
ETHUSD-15m
- Noise Filter: 7
- ATRLength : 16
- SL coefficient : 2.0
- TP coefficient : 1.5
Simple Tops/Bottoms, [JackT]A percentage (pyramid) script for BTC/USD, Daily.
Breakdown
The script is following one simple rule:
- Percentage orders based on volume
This is a pyramid setup based on volume but I am handling each order manually which makes it a custom pyramid strategy.
Instead of doing 100% portfolio sell/buy orders this script focuses on the momentum of volume and calculates a percentage of the portfolio that should be traded.
The percentage rises with the level of continuous orders with the same type. This means that if a second sell order is emitted before any buy order the percentage to sell is gradually increased to be higher than the previous sell order. And vise verca with buy orders.
The calculation is exponential rising but it also makes sure that the trade rarely reaches 100%. This enables the script to stay in the market on almost all opportunties given by the indicators.
How to use
The script is created from 3 indicators including Lucid SAR which helps to indicate the major trend.
It is possible to change the settings of the script in order to change the outcome. The settings is fitted to work with BTC/USD and the same settings works somewhat okay with ETH/USD aswell. Though I would recommend to fit the settings to work better with other pairs.
As mentioned, the script focuses on volume , which mean that it works better with major coins.
Enjoy the script and please let me know your thoughts!
//JackT
Strategy - Bobo Intraday Swing Bot with filtersThis is an adapted version of my swing bot with additional filters that mean it works quite well on lower timeframes like 1min, 5 mins as long as you adjust the setting accordingly (reduce pivot timescale, band width)
Entry conditions are filtered by an invisible trend calculation running in the background so the bot doesn't repeatedly try and fail to fade a strong trend. It has just about everything you should need for basic use, stop losses and targets, automatically close trade at pivot.
I get good results on rangey instruments like major indices such as SPX / ES that kind of thing. Make sure you understand the minmum tick value of an index so the stop setting on the bot work properly
Hope it's useful!
Swing Algo V1.1Here I present an upgrade to 'Swing Algo V1'. For differences to V1, see below.
This indicator can be used for e.g. swing algorithmic trading. It will give Buy/Long and Sell/Short signals on the chart. This algorithm uses a combination of several (custom) functions and rules to find good entry points for trend trading. After many iterations and tests I came up with this particular setup, which is highly optimized for the $ETH/$USD trading pair on the daily (D) timeframe. It is however possible to change algorithmic parameters within the indicator settings to tune this swing algorithm for other assets and timeframes. You don't need any programming skills or similar abilities to navigate this indicator.
Also you can choose the backtest time interval to test the perfomance of this algorithm for different time windows and different trading pairs. Here various backtesting parameters (e.g. trading fees) can be customized. Additionally to the TradingView Strategy Tester you can also plot your equity directly on the chart to get a sense for the performance. For this you can also scale the equity graph to e.g. match the starting point of your equity with some price point on the chart to get a direct comparison to 'Buy & Hold' strategies over time.
Note: In general it seems that cryptocurrencies are rather swing-algorithm-friendly, while I cannot recommend trading classical assets like stock or indices (e.g. S&P 500) with this indicator (although you can of course try to find good setups).
This indicator (and all other content I provide) is no financial advice. If you use this indicator you agree to my Terms and Conditions which can be found on my Twitter profile linked on my TradingView profile or in my signature.
Differences to Swing Algo V1:
- Changed the oscillator part of the algorithm with a better suited one (at least) for the ETH/USD trading pair.
- Improved net profits by roughly 20% in comparison to V1 for ETH/USD on daily timeframe
- Reduced Max. Drawdown by roughly 1/4 in comparison to V1 for ETH/USD on daily timeframe
- However for other assets and timeframes V1 might perform better than V1.1. I leave you with both options to play so that you can find the best solution for a given trading pair.
For access please contact me via DM on TradingView or on Twitter (linked on my TradingView profile and my signature). People who purchased access to any 'Swing Algo 1.x' get access to all other 'Swing Algo V1.x' indicators automatically ('Swing Algo V1' counts as 'Swing Algo V1.0').
Swing Algo V1This indicator can be used for e.g. swing algorithmic trading. It will give Buy/Long and Sell/Short signals on the chart. This algorithm uses a combination of several (custom) functions and rules to find good entry points for trend trading. After many iterations and tests I came up with this particular setup, which is highly optimized for the $ETH/$USD trading pair on the daily (D) timeframe. It is however possible to change algorithmic parameters within the indicator settings to tune this swing algorithm for other assets and timeframes. You don't need any programming skills or similar abilities to navigate this indicator.
Also you can choose the backtest time interval to test the perfomance of this algorithm for different time windows and different trading pairs. Here various backtesting parameters (e.g. trading fees) can be customized. Additionally to the TradingView Strategy Tester you can also plot your equity directly on the chart to get a sense for the performance. For this you can also scale the equity graph to e.g. match the starting point of your equity with some price point on the chart to get a direct comparison to 'Buy & Hold' strategies over time.
Note: In general it seems that cryptocurrencies are rather swing-algorithm-friendly, while I cannot recommend trading classical assets like stock or indices (e.g. S&P 500) with this indicator (although you can of course try to find good setups).
This indicator (and all other content I provide) is no financial advice. If you use this indicator you agree to my Terms and Conditions which can be found on my twitter profile linked in my signature.
GMS: RSI StrategyThis is just a basic RSI strategy that it easy to use and quite comprehensive so you can quickly test out an idea based on RSI.
- I made it comprehensive in that you can select long, short, or both.
- There is a simple moving average trend filter. You can filter for trades above, below, or don't include it at all.
- The exit is based on a simple moving average.
The source code should be open if you want to see it or modify it for your own project. I hope it helps!
Andre
Global Market Signals
[astropark] Trend Is Your Friend V3 [strategy]Dear Followers,
today another awesome Swing and Scalping Trading Strategy indicator, runnable on a bot , which works great on High Timeframes (1D is suggested) but also on lower ones (just write me in order to help you find correct settings) and even better on 1m Renko chart!
If you are a scalper, you will love suggested entries for fast profit. You can run it on 1h timeframe (below is not suggested, there is "no-trend" below 1h!) if you are used to scalp trading and close each trade whenever you feel happy (a proper trailing stop strategy is suggested anyway).
This is not an evolution of "Trend Is Your Friend V1" or V2 , but a twin sister or the "Trend Is Your Friend V1" indicator you can see here below
and twin sister or the "Trend Is Your Friend V2" indicator you can see here below
This strategy differs for the engine used as basis, but has the same usage settings:
enable/disable signals on chart
enable/disable showing trend cloud
enable/disable bar coloring based on trend
enable/disable background coloring based on trend
edit trend period length (direct message me in order to help you fine best settings)
edit a smart variant option to enhance the trend cloud on your chart
enable/disable an option to smart enter trade
This strategy only trigger 1 buy or 1 sell. In order to get notified when a signal is triggered, you need to use the "alarms" version of this indicator.
Strategy results are calculated on the timeframe from December 2012 to now, so on 8 years, using 10000$ as initial capital and working at 1x leverage (so no leverage at all! If you like to use leverage, be sure to use a safe option, like 3x or 5x at most in order to have liquidation price very far).
This is not the "Holy Grail", so use a proper risk management strategy.
This script will let you backtest how the indicator will perform on any chart you may test. Of course results will be very different depending on the chart and timeframe you will open. I tested a lot of charts and always you can find a combination that keep this strategy in profit on swing trading style (and this means that if you can have a daily look at the chart you can always manage to maximize your profit on each trade!)
The alarms version of this indicator, which will let you set all notifications you may need in order to be alerted on each triggered signals, can be found by searching for the astropark's "trend is your friend v3" and then choosing the indicator with "alarms" suffix in the name.
This is a premium indicator , so send me a private message in order to get access to this script.
[astropark] Trend Is Your Friend V2 [strategy]Dear Followers,
today another awesome Swing and Scalping Trading Strategy indicator, runnable on a bot , which works great on High Timeframes (1D is suggested) but also on lower ones (just write me in order to help you find correct settings) and even better on 1m Renko chart!
If you are a scalper, you will love suggested entries for fast profit. You can run it on 1h timeframe (below is not suggested, there is "no-trend" below 1h!) if you are used to scalp trading and close each trade whenever you feel happy (a proper trailing stop strategy is suggested anyway).
This is a twin sister or the "Trend Is Your Friend V1" indicator you can see here below
This strategy differs for the engine used as basis, but has the same usage settings:
enable/disable signals on chart
enable/disable showing trend cloud
enable/disable bar coloring based on trend
enable/disable background coloring based on trend
edit trend period length (you have to increase it if you go on lower timeframes or you go on FOREX/Stocks market, direct message me in order to help you fine best settings)
This strategy only trigger 1 buy or 1 sell. In order to get notified when a signal is triggered, you need to use the "alarms" version of this indicator.
Strategy results are calculated on the timeframe from January 2015 to now, so on 5 years, using 10000$ as initial capital and working at 1x leverage (so no leverage at all! If you like to use leverage, be sure to use a safe option, like 3x or 5x at most in order to have liquidation price very far).
This is not the "Holy Grail", so use a proper risk management strategy.
This script will let you backtest how the indicator will perform on any chart you may test. Of course results will be very different depending on the chart and timeframe you will open. I tested a lot of charts and always you can find a combination that keep this strategy in profit on swing trading style (and this means that if you can have a daily look at the chart you can always manage to maximize your profit on each trade!)
The alarms version of this indicator, which will let you set all notifications you may need in order to be alerted on each triggered signals, can be found by searching for the astropark's "trend is your friend v2" and then choosing the indicator with "alarms" suffix in the name.
This is a premium indicator , so send me a private message in order to get access to this script.
[astropark] Trend Is Your Friend V1 [strategy]Dear Followers,
today another awesome Swing and Scalping Trading Strategy indicator, runnable on a bot , which works great on High Timeframes (1D is suggested) but also on lower ones (just write me in order to help you find correct settings) and even better on 1m Renko chart!
If you are a scalper, you will love suggested entries for fast profit. You can run it on 1h timeframe (below is not suggested, there is "no-trend" below 1h!) if you are used to scalp trading and close each trade whenever you feel happy (a proper trailing stop strategy is suggested anyway).
This strategy let's you edit following settings:
enable/disable signals on chart
enable/disable showing trend cloud
enable/disable bar coloring based on trend
enable/disable background coloring based on trend
enable a special option to enhance trend cloud on FOREX/Stocks charts (optional)
edit trend period length (you have to increase it if you go on lower timeframes, like 1h)
This strategy only trigger 1 buy or 1 sell. In order to get notified when a signal is triggered, you need to use the "alarms" version of this indicator.
Strategy results are calculated on the timeframe from August 2017 to now, so on almost 2 years and half, using 10000$ as initial capital and working at 1x leverage (so no leverage at all! If you like to use leverage, be sure to use a safe option, like 3x or 5x at most in order to have liquidation price very far).
This is not the "Holy Grail", so use a proper risk management strategy.
This script will let you backtest how the indicator will perform on any chart you may test. Of course results will be very different depending on the chart and timeframe you will open. I tested a lot of charts and always you can find a combination that keep this strategy in profit on swing trading style (and this means that if you can have a daily look at the chart you can always manage to maximize your profit on each trade!)
The alarms version of this indicator, which will let you set all notifications you may need in order to be alerted on each triggered signals, can be found by searching for the astropark's "trend is your friend" and then choosing the indicator with "alarms" suffix in the name.
This is a premium indicator , so send me a private message in order to get access to this script.
[astropark] Ichimoku Cloud StrategyDear Followers,
today a Great Swing Trading Strategy , runnable on a bot , which works great on High Timeframes (1D is suggested!) but also even better on 1m Renko chart.
If you are a scalper, you will love suggested entries for fast profit. You can run it on 1h timeframe (below is not suggested) if you are used to scalp trading and close each trade whenever you feel happy (a proper trailing stop strategy is suggested anyway).
This strategy is based on the Ichimoku Cloud Indicator and let's you set a lot of settings:
works on all timeframes (but 1D and above is suggested on normal candlesticks chart)
you can run this indicator on 1m Renko chart (be sure to enable the "USING RENKO CHART? ENABLE THIS OPTION" setting)
you can use 4 kind of Ichimoku Cloud (Custom, Slow, Standard and Fast - keep only one enabled)
you can make the Ichimoku Cloud show or not
you can enable showing the possibile re-entries
you can enable an heiking ashi analysis
you can enable a trailing stop strategy ("Auto Trailing Stop Loss" and "Close Trade When Price Breaks Above the Ichimoku Cloud" are two options very much suggested to keep enabled, especially on bot trading)
you can create your own trailing stop stategy and take profit strategy
you can enable a simple take profit strategy based on RSI Overbought and Oversold levels
This strategy only trigger 1 buy or 1 sell, but if you missed the possibility to open your long or short position don't get mad, but just enable the "show re-entry signals" option, so yout will be able to enter again (be sure to always use a proper money management ).
By the way, you can set any alarms you like in order to get notified when any kind of signal is triggered (you need to use the "alarms" version for this).
Strategy results are calculated on the timeframe from January 2016 to now, so on 3 years, using 10000$ as initial capital, doing only 6 trades (great swings!) and working at 1x leverage (so no leverage at all! perfect spot trading style!). If you like to use leverage, be sure tp use a safe option, like 3x or 5x at most in order to have liquidation price very far).
This is not the "Holy Grail", so use a proper risk management strategy.
This script will let you backtest how the indicator will perform on any chart you may test. Of course results will be very different depending on the chart you will open. I tested a lot of charts and always you can find a combination that keep this strategy in profit on swing trading style (and this means that if you can have a daily look at the chart you can always manage to maximize your profit on each trade!
The alarms version of this indicator, which will let you set all notifications you may need in order to be alerted on each triggered signals, can be found by searching for "astropark Ichimoku Cloud Strategy" and then choosing the "astropark" indicator with "alarms" suffix in the name.
This is a premium indicator , so send me a private message in order to get access to this script.
Donchain BreakoutIt is a long only strategy.
1. Buy when price breaks out of the upper band.
2. Exit has two options. Option 1 allows you to exit using lower band. Option 2 allows you to exit using basis line.
3. Slippage and commissions are not considered in the return calculation.
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).
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.
FiboStaircase by Solah AzmanThe band represents the range between local highest and local lowest and the layers are proportional to Fibonacci ratio. Suitable for 5 minutes charts.
JMOZ Swing Strat [XBTUSD, 4H]Swing strategy for XBTUSD (or other BTCUSD pairs) 4H.
It should catch the nice big BTC swings.
There is code that attempts to eliminated the chop from very low volatility periods.
As with all swing strategies it will get chopped up during choppy price periods.
The chart also prints crosses at good take profit points, which works off of RSI levels.
The backtest is set to 10k starting equity with 50% per trade.
TipTopTraders - #1 Swing Trader Inidicator - 1H+ guaranteed $$$$The specifics of this script are quite simple. Using comparisons of BTC, DXY, and Gold indexes, the MA changes color in the direction of the trend in such a way that you get near-perfect entries and exits.
I've used this new script of mine for the last few months to clock in huge profits in the pump to 12K and the dump down to $9K - refer to chart:
This indicator makes trading so easy, you barely need other confirmations to trade off of it. The higher the time frame the better, but anything below 1 Hour charts can get a bit hairy, in which I would recommend using other contribution indicators for confirmations of trends.
If you want access to this script and everything else currently in development, then please do not hesitate to ask about pricing and membership via a PM.
Thanks!!!!!!!!
APEX - Swing Aura StrategyA backtester of my new strat, it's a hybrid swing/scalp strat that really looks for quick low profits. Will keep it hidden as it's a bit of a work in progress right now. Working on it to perform well enough with the Apex Trading bot, ran it for a day now and it ended the day on a 1.78% portfolio profit, so I'm really pleased with that.
As for details it's based on Keltner Channels, Bolingers Bands and a Ichimoku cloud. To spice it up there's even a Wave trend in there as well!
All the settings for the bits and parts are changeable so feel free to mess around with them, but will keep my sell triggers fixed for now, so no editing of those from within the script unfortunately.
Enjoy!
Investing - Weekly EMA's mapped to Daily ChartWhen there isn't enough time in your day to day-trade, yet you want to utilise all the technical analysis skills you have... why not make a long term investing or swing trading indicator set to help you along the way!
So I did....
When it comes to long term investing and swing trading, I often find the weekly 12/26/52 EMA's do a great job in capturing the main market swings from bull to bear.
However, I like to use the Daily chart to see the candle patterns and shapes with more detail and divergences often show up better on the daily chart.
So I have decided to combine the two!
I have basically taken the EMA 12/26/52 from the weekly and transferred them over to the daily (mathematically they are not exact, but for me they are close enough).
I have also developed a simple scale in / scale out strategy for using these exponential moving averages. It isn't as simple as buying in on each signal, however I use my own special strategy to take advantage of the alerts.
Enjoy!