INVITE-ONLY SCRIPT

Multi-Market Swing Trader Webhook Ready [HullBuster]

Mis à jour
snapshot
snapshot

Introduction

This is an all symbol swing trading strategy intended for webhook integration to live accounts. This script employs an adjustable bandwidth ping pong algorithm which can be run in long only, short only or bidirectional modes. Additionally, this script provides advanced features such as pyramiding and DCA. It has been in development for nearly three years and exposes over 90 inputs to accommodate varying risk reward ratios. Equipped with a proper configuration it is suitable for professional traders seeking quality trades from a cloud based platform. This is my most advanced Pine Script to date which combines my RangeV3 and TrendV2 scripts. Using this combination it tries to bridge the gap between range bound and trending markets. I have put a lot of time into creating a system that could transition by itself so as to require less human intervention and thus be able to withstand long periods in full automation mode.

As a Pine strategy, hypothetical performance can be easily back-tested. Allowing you to Iron out the configuration of your target instrument. Now with recent advancements from the Pine development team this same script can be connected to a webhook through the alert mechanism. The requirement of a separate study script has been completely removed. This really makes things a lot easier to get your trading system up and running. I would like to also mention that TradingView has made significant advancements to the back-end over the last year. Notably, compile times are much faster now permitting more complex algorithms to be implemented. Thank you TradingView!

I used QuantConnect as my role model and strived to produce a base script which could compete with higher end cloud based platforms while being attractive to similarly experienced traders. The versatility of the Pine Language combined with the greater selection of end point execution systems provides a powerful alternative to other cloud based platforms. At the very least, with the features available today, a modular trading system for everyday use is a reality. I hope you'll agree.

This is a swing trading strategy so the behavior of this script is to buy on weakness and sell on strength. In trading parlance this is referred to as Support and Resistance Trading. Support being the point at which prices stop falling and start rising. Resistance being the point at which prices stop rising and fall. The chart real estate between these two points being defined as the range. This script seeks to implement strategies to profit from placing trades within this region. Short positions at resistance and long positions at support. 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 interleaved continuously as long as there exists a detectable vertex.

This is a non-hedging script so those of us subject to NFA FIFO Rule 2-43(b) should be generally safe to webhook into signals emitted from this script. However, as covered later in this document, there are some technical limitations to this statement. I have tested this script on various instruments for over two years and have configurations for forex, crypto and stocks. This script along with my TrendV2 script are my daily trading vehicles as a webhook into my forex and crypto accounts. This script employs various high risk features that could wipe out your account if not used judiciously. You should absolutely not use this script if you are a beginner or looking for a get-rich-quick strategy. Also please see my CFTC RULE 4.41 disclosure statement at the end of the document. Really!

Does this script repaint? The short answer is yes, it does, despite my best efforts to the contrary. EMAs are central to my strategy and TradingView calculates from the beginning of the series so there is just no getting around this. However, Pine is improving everyday and I am hopeful that this issue will be address from an architectural level at some point in the future. I have programmed my webhook to compensate for this occurrence so, in the mean time, this my recommended way to handle it (at the endpoint and before the broker).

Design

This strategy uses a ping pong algorithm of my own design. Basically, trades bounce off each other along the price stream. Trades are produced as a series of reversals. The point at which a trade reverses is a pivot calculation. A measurement is made between the recent valley to peak which results in a standard deviation value. This value is an input to implied probability calculation.Yes, the same implied probability used in sports betting. Odds are then calculated to determine the likelihood of price action continuing or retracing to the pivot. Based on where the account is at alert time, the action could be an entry, take profit or pyramid signal. In this design, trades must occur in alternating sequence. A long followed by a short then another long followed by a short and so on. In range bound price action trades appear along the outer bands of the channel in the aforementioned sequence. Shorts on the top and longs at the bottom. Generally speaking, the widths of the trading bands can be adjusted using the vertex dynamics in Section 2. There are a dozen inputs in this section used to describe the trading range. It is not a simple adjustment. If pyramids are enabled the strategy overrides the ping pong reversal pattern and begins an accumulation sequence. In this case you will see a series of same direction trades.

This script uses twelve indicators on a single time frame. The original trading algorithms are a port from a C++ program on proprietary 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 play a key role in identifying the pivot points. I really like the Hull Moving Average. I use it in all my systems, including 3 other platforms. It’s is an excellent leading indicator and a relatively light calculation.

The trend detection algorithms rely on several factors:
1. Smoothed EMAs in a Willams Alligator pattern.
2. Number of pivots encountered in a particular direction.
3. Which side debt is being incurred.
4. Settings in Section 4 and 5 (long and short)

The strategy uses these factors to determine the probability of prices continuing in the most recent direction. My TrendV2 script uses a higher time frame to determine trend direction. I can’t use that method in this script without exceeding various TradingView limitations on code size. However, the higher time frame is the best way to know which trend is worth pursuing or better to bet against.

The entire script is around 2400 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. The module has been through numerous refactoring passes and makes extensive use of ternary statements. As such, It takes a full minute 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. Scrolling the chart quickly may bring up an hour glass.

Regardless of the market conditions: range or trend. The behavior of the script is governed entirely by the 91 inputs. Depending on the settings, bar interval and symbol, you can configure a system to trade in small ranges producing a thousand or more trades. If you prefer wider ranges with fewer trades then the vertex detection settings in Section 2 should employ stiffer values. To make the script more of a trend follower, adjustments are available in Section 4 and 5 (long and short respectively). Overall this script is a range trader and the setups want to get in that way. It cannot be made into a full blown trend trading system. My TrendV2 is equipped for that purpose. Conversely, this script cannot be effectively deployed as a scalper either. The vertex calculation require too much data for high frequency trading. That doesn’t work well for retail customers anyway. The script is designed to function in bar intervals between 5 minutes and 4 hours. However, larger intervals require more backtest data in order to create reliable configurations. TradingView paid plans (Pro) only provide 10K bars which may not be sufficient. Please keep that in mind.

The transition from swing trader to trend follower typically happens after a stop is hit. That means that your account experiences a loss first and usually with a pyramid stack so the loss could be significant. Even then the script continues to alternate trades long and short. The difference is that the strategy tries to be more long on rising prices and more short on falling prices as opposed to simply counter trend trading. Otherwise, a continuous period of rising prices results in a distinctly short pyramid stack. This is much different than my TrendV2 script which stays long on peaks and short on valleys. Basically, the plan is to be profitable in range bound markets and just lose less when a trend comes along. How well this actually plays out will depend largely on the choices made in the sectioned input parameters.

Sections

The input dialog for this script contains 91 inputs separated into six sections.

Section 1: Global settings for the strategy including calculation model, trading direction, exit levels, pyramid and DCA settings. This is where you specify your minimum profit and stop levels. You should setup your Properties tab inputs before working on any of the sections. It’s really important to get the Base Currency right before doing any work on the strategy inputs. It is important to understand that the “Minimum Profit” and “Limit Offset” are conditional exits. To exit at a profit, the specified value must be exceeded during positive price pressure. On the other hand, the “Stop Offset” is a hard limit.

Section 2: Vertex dynamics. The script is equipped with four types of pivot point indicators. Histogram, candle, fractal and transform. Despite how the chart visuals may seem. The chart only receives prices. It’s up to the strategy to interpret patterns from the number stream. The quality of the feed and the symbol’s bar characteristics vary greatly from instrument to instrument. Each indicator uses a fundamentally different pattern recognition algorithm. Use trial and error to determine the best fit for your configuration. After selecting an indicator type, there are eight analog fields that must be configured for that particular indicator. This is the hardest part of the configuration process. The values applied to these fields determine how the range will be measured. They have a big effect on the number of trades your system will generate. To see the vertices click on the “Show Markers” check box in this section. Red markers are long positions and blue markers are short. This will give you an idea of where trades will be placed in natural order.

Section 3: Event thresholds. Price spikes are used to enter and exit trades. The magnitude which define these spikes are configured here. The rise and fall events are primarily for pyramid placement. The rise and fall limits determine the exit threshold for the conditional “Limit Offset” field found in Section 1. These fields should be adjusted one at a time. Use a zero value to disengage every one but the one you are working on. Use the fill colors found in Section 6 to get a visual on the values applied to these fields. To make it harder for pyramids to enter stiffen the Event values. This is more of a hack as the formal pyramid parameters are in Section 1.

Section 4 and 5: Long and short settings. These are mirror opposite settings with all opposing fields having the same meaning. Its really easy to introduce data mining bias into your configuration through these fields. You must combat against this tendency by trying to keep your settings as uniform as possible. Wildly different parameters for long and short means you have probably fitted the chart. There are nine analog and thirteen Boolean fields per trade direction. This section is all about how the trades themselves will be placed along the range defined in Section 2. Generally speaking, more restrictive settings will result in less trades but higher quality. Remember that this strategy will enter long on falling prices and short on rising prices. So getting in the trade too early leads to a draw-down. However, this could be what you want if pyramiding is enabled. I, personally, have found that the best configurations come from slightly skewing one side. I just accept that the other side will be sub-par.

Section 6: Chart rendering. This section contains one analog and four Boolean fields. More or less a diagnostic tool. Of particular interest is the “Symbol Debt Sequence” field. This field contains a whole number which paints regions that have sustained a run of bad trades equal or greater than specified value. It is useful when DCA is enabled. In this script Dollar Cost Averaging on new positions continues only until the symbol debt is recouped. To get a better understanding on how this works put a number in this field and activate DCA. You should notice how the trade size increases in the colored regions. The “Summary Report” checkbox displays a blue information box at the live end of the chart. It exposes several metrics which you may find useful if manually trading this strategy from audible alerts or text messages.

Pyramids

This script features a downward pyramiding strategy which increases your position size on losing trades. On purely margin trades, this feature can be used to, hypothetically, increase the profit factor of positions (not individual trades). On long only markets, such as crypto, you can use this feature to accumulate coins at depressed prices. The way it works is the stop offset, applied in the Section 1 inputs, determines the maximum risk you intend to bear. Additional trades will be placed at pivot points calculated all the way down to the stop price. The size of each add on trade is increased by a multiple of its interval. The maximum number of intervals is limited by the “Pyramiding” field in the properties tab. The rate at which pyramid positions are created can be adjusted in Section 1. To see the pyramids click on the “Mark Pyramid Levels” check box in the same section. Blue triangles are painted below trades other than the primary.

Unlike traditional Martingale strategies, the result of your trade is not dependent on the profit or loss from the last trade. The position must recover the R1 point in order to close. Alternatively, you can set a “Pyramid Bale Out Offset” in Section 1 which will terminate the trade early. However, the bale out must coincide with a pivot point and result in a profitable exit in order to actually close the trade. Should the market price exceed the stop offset set in Section 1, the full value of the position, multiplied by the accepted leverage, will be realized as a loss to the trading account. A series of such losses will certainly wipe out your account.

Pyramiding is an advanced feature intended for professional traders with well funded accounts and an appropriate mindset. The availability of this feature is not intended to endorse or promote my use of it. Use at your own risk (peril).

DCA

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 properties tab. The inputs for this feature are found in section 3 and 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 spot trading contest or just 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 of data mining bias. Please remember that.

Webhook Integration

The TradingView alerts dialog provides a way to connect your script to an external system which could actually execute your trade. This is a fantastic feature that enables you to separate the data feed and technical analysis from the execution and reporting systems. Using this feature it is possible to create a fully automated trading system entirely on the cloud. Of course, there is some work to get it all going in a reliable fashion. To that end this script has several things going for it. First off, it is a strategy type script. That means that the strategy place holders such as {{strategy.position_size}} can be embedded in the alert message text. There are more than 10 variables which can write internal script values into the message for delivery to the specified endpoint. Additionally, my scripts output the current win streak and debt loss counts in the {{strategy.order.alert_message}} field. Depending on the condition, this script will output other useful values in the JSON “comment” field of the alert message. Here is an excerpt of the fields I use in my webhook signal:

"broker_id": "kraken",
"account_id": "XXX XXXX XXXX XXXX",
"symbol_id": "XMRUSD",
"action": "{{strategy.order.action}}",
"strategy": "{{strategy.order.id}}",
"lots": "{{strategy.order.contracts}}",
"price": "{{strategy.order.price}}",
"comment": "{{strategy.order.alert_message}}",
"timestamp": "{{time}}"

Though TradingView does a great job in dispatching your alert this feature does come with a few idiosyncrasies. Namely, a single transaction call in your script may cause multiple transmissions to the endpoint. If you are using placeholders each message describes part of the transaction sequence. A good example is closing a pyramid stack. Although the script makes a single strategy.close() call, the endpoint actually receives a close message for each pyramid trade. The broker, on the other hand, only requires a single close. The incongruity of this situation is exacerbated by the possibility of messages being received out of sequence. Depending on the type of order designated in the message, a close or a reversal. This could have a disastrous effect on your live account. This broker simulator has no idea what is actually going on at your real account. Its just doing the job of running the simulation and sending out the computed results. If your TradingView simulation falls out of alignment with the actual trading account lots of really bad things could happen. Like your script thinks your are currently long but the account is actually short. Reversals from this point forward will always be wrong with no one the wiser. Human intervention will be required to restore congruence. But how does anyone find out this is occurring? In closed systems engineering this is known as entropy. In practice your webhook logic should be robust enough to detect these conditions. Be generous with the placeholder usage and give the webhook code plenty of information to compare states. Both issuer and receiver. Don’t blindly commit incoming signals without verifying system integrity.

Operation

This is a swing trading strategy so the fundamental 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. This is slightly misleading since a range as well as a trend are best recognized, in hindsight, after the patterns occur on the chart. In the middle of a trade, one never knows how deep valleys will drop or how high peaks will rise. For certain, long trades will continue to trigger as the market prices fall and short trades on rising prices. This means that the maximum efficiency of this strategy is achieved in choppy markets where the price doesn’t extend very far from its adjacent pivot point. Conversely, this strategy will be the least efficient when market conditions exhibit long continuous single direction price pressure. Especially, when measured in weeks. Translation, the trend is not your friend with this strategy. Internally, the script attempts to recognize prolonged price pressure and changes tactics accordingly. However, at best, the goal is to weather the trend until the range bound market returns. At worst, trend detection fails and pyramid trades continue to be placed until the limit specified in the Properties tab is reached. In all likelihood this could trigger a margin call and if it hits the stop it could wipe out your account.

This script has been in beta test four times since inception. During all that time no one has been successful in creating a configuration from scratch. Most people give up after an hour or so. To be perfectly honest, the configuration process is a bear. I know that but there is no way, currently, to create libraries in Pine. There is also no way specify input parameters other than the flattened out 2-D inputs dialog. And the publish rules clearly state that script variations addressing markets or symbols (suites) are not permitted. I suppose the problem is systemic to be-all-end-all solutions like my script is trying to be. I needed a cloud strategy for all the symbols that I trade and since Pine does not support library modules, include files or inter process communication this script and its unruly inputs are my weapon of choice in the war against the market forces. It takes me about six hours to configure a new symbol. Also not all the symbols I configure are equally successful. I should mention that I have a facsimile of this strategy written in another platform which allows me to run a backtest on 10 years of historical data. The results provide me a sanity check on the inputs I select on this platform.

My personal configurations use a 10 minute bar interval on forex instruments and 15 minutes on crypto. I try to align my TradingView scripts to employ standard intervals available from the broker so that I can backtest longer durations than those available on TradingView. For example, Bitcoin at 15 minute bars is downloadable from several sources. I really like the 10 minute bar. It provides lots of detectable patterns and is easy to store many years in an SQL database.

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 configurations that I use for my own trading that I can share with you if you like. To get hands on experience in setting up your own symbol from scratch please follow the steps below.

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 2. 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 4 and enable “Apply Red Base To Base Margin”.
Step 10. Go to Section 5 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. Turn off Show Markers in Section 2.
Step 13. 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. 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.
Step 14. 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 15. Take a look at the chart. Trades should be showing along the markers plotted earlier.
Step 16. 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 17.
Step 17. Improve the backtest profitability by adjusting the “Entry Net Change” and “Entry ROC” in Section 4 and 5.
Step 18. Enable the “Mandatory Snap” checkbox in Section 4 and 5 and adjust the “Snap Candle Delta” and “Snap Fractal Delta” in Section 2. This should reduce some chop producing unprofitable reversals.
Step 19. Increase the distance between opposing trades by adding an “Interleave Delta” in Sections 4 and 5. This is a floating point value which starts at 0.01 and typically does not exceed 2.0.
Step 20. Increase the distance between opposing trades even further by adding a “Decay Minimum Span” in Sections 4 and 5. 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 21. The “Buy Composite Strength” input works in tandem with “Long Decay Minimum Span” in Section 4. Try enabling and see if it improves the performance. This field is only relevant when there is a value in “Long Decay Minimum Span”.
Step 22. The “Sell Composite Weakness” input works in tandem with “Short Decay Minimum Span” in Section 5. Try enabling and see if it improves the performance. This field is only relevant when there is a value in “Short Decay Minimum Span”.
Step 23. Improve the backtest profitability by adjusting the “Adherence Delta” in Section 4 and 5. This field requires the “Adhere to Rising Trend” checkbox to be enabled.
Step 24. At this point your strategy should be more or less working. Experiment with the remaining check boxes in Section 4 and 5. Keep the ones which seem to improve the performance.
Step 25. 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 Fractal indicator captures the tallest peaks and valleys. The Transform indicator is the most reliable but doesn’t well work on all instruments.

Example Settings

To reproduce the performance shown on the chart please use the following configuration:

1. Select XBTUSD Kraken as the chart symbol.
2. On the properties tab set the Order Size to: 0.01 Bitcoin
3. On the properties tab set the Pyramiding to: 10
4. In Section 1: Select “Forex” for the Instrument Type
5. In Section 1: Select “Ping Pong” for the Trading Mode
6. In Section 1: Input 1200 for the Minimum Profit
7. In Section 1: Input 15000 for the Stop Offset
8. In Section 1: Input 1200 for the Pyramid Minimum Span
9. In Section 1: Check mark the Ultra Wide Pyramids
10. In Section 2: Check mark the Use Transform Indicator

So to be clear, I used a base position size of one - one hundredth of a Bitcoin and allow the script to add up to 10 downward pyramids. The example back-test did hit eight downward pyramids. That means the account would have to be able to withstand a base position size (0.01) times 28. The resulting position size is 0.28 of a Bitcoin. If the price of Bitcoin is 35K then the draw down amount (not including broker fees) would be $9800 dollars. Since I have a premium subscription my backtest chart includes 20K historical bars. That's roughly six months of data. As of today, pro accounts only get 10K bars so the performance cannot be exactly matched with such a difference in historical data. Please keep that in mind.

There are, of course, various ways to reduce the risk incurred from accumulating pyramids. You can increase the “Pyramid Minimum Span” input found in Section 2 which increases the space between each pyramid trade. Also you can set a “Pyramid Bale Out Offset” in the same input section. This lets you out of the trade faster on position recovery. For example: Set a value of 8000 into this input and the number of trades increase to 178 from 157. Since the positions didn’t go full term, more trades were created at less profit each. The total brute force approach would be to simply limit the number of pyramids in the Properties tab.

It should be noted that since this is crypto, accumulating on the long side may be what you want. If you are not trading on margin and thus outright buying coins on the Kraken exchange you likely are interested in increasing your Bitcoin position at depressed prices. This is a popular feature on some of the other crypto trading packages like CryptoHopper and Profit Trailer. Click on Enable TV Long Only Rule in Section 1. This switches the signal emitter to long only. However, you may still see short trades on the chart. They are treated as a close instead of a reversal.

Feel free to PM me with any questions related to this script. Thank you and happy trading!

CFTC RULE 4.41

These results are based on simulated or hypothetical performance results that have certain inherent limitations. Unlike the results shown in an actual performance record, these results do not represent actual trading. Also, because these trades have not actually been executed, these results may have under-or over-compensated for the impact, if any, of certain market factors, such as lack of liquidity. Simulated or hypothetical trading programs in general are also subject to the fact that they are designed with the benefit of hindsight. No representation is being made that any account will or is likely to achieve profits or losses similar to these being shown.
Notes de version
Build 369

I added a new Trading Mode called “Linear”. You will see it in the drop down below “Ping Pong”. This new mode makes it possible to make the script more of a trend follower versus its usual swing behavior. The feature required adding some significant code so I had to remove a few seldom used features to make room for it. As a result three previously documented inputs were removed and four new inputs were added.

When Linear mode is selected long trades are entered on strength and short trades on weakness. I use price pressure combined with my Williams Alligator to determine where the market is predominately heading (at least in the short term). As I have previously stated in the main document, using a higher time frame is the best way to track market trends but I do not have the space for that in my BoostV1 script. This is a single time frame script.

I also added a conditional stop to the long and short sections of the inputs dialog. This is a real number value similar to the Minimum Profit field only it works on losing trades. So the idea here is that you can set a fixed value stop in the Stop Offset field which could be relatively wide. Then set a smaller stop value in the Conditional Stop for the long or short side of the trade. This way the trade has room to fluctuate when market makers gyrate the symbol. If the internal trend lines confirm continuous unidirectional momentum, the trade will close when the loss exceeds the value specified in the Conditional Stop field. The next trade should be in the direction of the loss.

The Linear Trading Mode is a lot easier to set up than the Ping Pong Mode and results in more overall trades. This is because trades are entering on strength so it has less “travel” to get to the exit condition which is also strength. In Ping Pong Mode trades enter on weakness and the market has to “swing” to strength in order to exit. What you will see on the chart is lots of smaller trades with less pyramiding. This script has over 90 inputs so there is really a wide range of options in terms of how you want the strategy to behave. I think this new mode will add to this flexibility.

I fixed a bug in the alert comment where the embedded stop price was incorrectly calculated. A take profit price was added to the alert_message field of the strategy.entry call. This message now has four fields.

Two new check boxes were added to Section 3. Deterministic Rise Limits and Deterministic Fall Limits. When checked I apply default conditional logic to the Limit Offset set in Section 1. This makes it easier to set up the initial configuration by removing the need to discover the limit exit activation thresholds upfront.
Notes de version
Build 371

I had some reports that the Preserve Pyramid Stack feature in Section 4 and 5 does not always preserve it. What happens is that Ping Pong mode can indeed cut off the trade if a large stack has made a significant recovery even before the pyramid bale out. The science behind preserving the stack cannot put the account in jeopardy by indefinitely holding a losing position. However, I have made some changes to the point at which the recovery calculation begins. Instead of measuring the recovery from the last pyramid trade I start from the position MAE. Every new pyramid resets the MAE point so that recovery is calculated from the lowest point of the trade. The end result is that the pyramids are blocked from Ping Pong reversals for a longer period.

Please remember that pyramids are dangerous and should be used with care. Look at the chart and set the widest Pyramid Span afforded for the number of pyramids you indent to trade. Experiment with the Ultrawide Pyramids feature in Section 1. The Ultra Wide No Sheer can be used together with Ultrawide Pyramids for an even wider pyramid spread. Believe me pyramid trades can quickly buildup if you have a wide stop and the market goes against your position.
Notes de version
Build 372

This build adds the Build number label at the top of Section 1. This is a diagnostic device to distinguish the behavior between various builds traders may be using. It especially useful when comparing strategy and study versions of the same script. Other than the new label, there is no difference between this build (372) and the previous build (371).
Notes de version
snapshot

Build 379

This is a pretty big update containing many changes to the script. Most notable, is the inclusion of a higher time frame line. Hooray and Rejoice! BoostV1 was always intended to be a chart interval script with higher time frame duties relegated to my TrendV2 script. However, there was just no way to trade the S&P 500 Index without additional trend guidance. This script is at its maximum TradingView size. It barely compiles with the limits for “local scopes”, “calculation time” and “compile time”. I had to remove a feature and reduce the complexity of a few internal calculations in order to get in all the changes I needed. Some other stuff in this build is a new calculation mode called “Index”. You will see it in the drop down below FX-Milli. There is also a new Trading Mode called “Linear HFT” right below “Linear”. Last, but absolutely not least, is a redesigned DCA algorithm which is in response to several bug reports from users trying to make use of this feature in combination with pyramids. I tried, as much as possible to make these changes backward compatible but it didn’t really turn out that way. Depending on which inputs you are using it is likely that your current templates will have to change. Sorry about that!

Trend Bias Period

This is a new input where you can select the period of the higher time frame trend line. It works much like my other scripts. The trend line itself is a single line affair similar to the WebhookDrive script. Prices above the line indicate a rising trend and below a falling trend. Not very sophisticated but combined with my other algorithms, its enough. The trend line is created with the Pine security function and employs repaint protection as prescribed by TradingView. The higher time frame should be at least five times greater than the chart time frame.

Instrument Type - Index

The Index calculation model permits a greater resolution for vertex detection. Previously, on large whole number denominated instruments, the setups would miss trading opportunities causing gaps between closed positions. You really had to put work into discovering a good set of values for vertex calibration. With the “Index” model you can see the improvement by enabling the “Show Markers” setting in Section 2. The red markers show where short positions will enter and blue markers are for long positions. In Ping Pong mode its the opposite. Use this setting when configuring the S&P 500 symbol.

Trading Mode - Linear HTF

This is the only trading mode to use the higher time frame indicator. Use this mode to turn the BoostV1 script into limited a trend following strategy. When activated the Ping Pong algorithm will swing in the direction of the higher time frame trend line. What you will see on chart is long trades on upward price pressure and short trades on falling prices. In this mode there is no concept of tops and bottoms. No matter what, spikes are buying opportunities and drops are to be shorted. As with all trend follow systems, drawdowns are to be expected. Tight stops will get taken out often.

Degenerate Limit Exits

The limit events are conditional exits that are designed get out of the position on accelerating price pressure. Ahead of the minimum exit specified amount. If such price pressure does not occur, a test of the minimum exit threshold should get you out. So what was happening is a long run of accelerating prices produced a series of exits and reentries. That is not necessarily profitable since you are getting back in at a worse price. What I did is to add a small degeneracy algorithm to the conditional exit which breaks up the exit vector little. So now what you see on the chart is fewer trades at better prices. At least that is what is supposed to happen :).

Enable DCA

Among the traders that use my scripts there is some confusion about DCA versus pyramids. So let me be clear. DCA, in my implementation, is a loss recovery mechanism and pyramids are intended to generate gains. Dollar Cost Averaging on some platforms, notably crypto, are used as a tool to increase profits. I know. But my systems are designed for active trading and not buy and hold methodology. Pyramids are by nature short term increases in position size which ends when you close your position. When you enable DCA your are, in effect, trying to recover losses as the strategy accumulates them. The size of your base trade will automatically increase by a multiple of the bad trade sequence. So the next trade will be double the size of the first losing trade. The third trade will be triple the size, and so on. Up to the specified Maximum DCA Increments input value. When the number of losing pips is recovered the DCA system shuts down and the trade size returns to the normal amount. Until the next losing trade. Only the base trade (Order Size in the Properties tab) is affected by the DCA feature. The pyramids follow its own sizing algorithm.

In this version, Build 379, the DCA logic has been rewritten to better match the losing pips against the recovery pips. I also enhanced this feature with support for Linear mode trading. You will see “DCA Maximize Chop Size” in the DCA section. When enabled the position size increases on trend reversals where the position is cut and reversed.

Basic Plan Subscribers

I have received a number of complaints about this script not running when added to a chart. Actually, what happens is that the script is compiled on the TradingView servers and is metered according to the subscriber plan. Unfortunately, Basic Plan subscribers only receive half of the calculation time of the paid plans. My script is very large by TradingView standards and it needs all the calculation time it can get. This being the case, it is unlikely that this script will work well for a trader on the Basic Plan. Pro Plan subscribers and above will need to wait for the hovering dots to disappear after they add it to a chart. It takes a full minute for this script to compile for the first time. After that it is cached on the server for faster retrieval.
Notes de version
snapshot

Build 921

This build is a major revision which incorporates several requested features and operational enhancements. The main goal of this version is to increase the performance of small time frame configurations. Namely, one minute and five minute bar intervals. While the this script was always intended for swing trading, it had trouble detecting vertices below ten minutes on some symbols.

Another goal of this version is to streamline the coexistence of “Linear” mode and “Ping Pong”. This script is, fundamentally, a swing trader and “Linear” mode is trend follow. Though functional, the previous version did exhibit some quirky behavior when operating in “Linear” mode. To make this goal a reality I had to redesign my setups and entry logic. Since this script is already at the maximum size permissible in Pine, the setups share trend follow and swing trading functionality. I believe that my new entry algorithms provide a more homogeneous combination of swing and trend follow capability. Having both trading methodologies in a single script provides a cost effective solution to users of either discipline. It’s a really great feature to be able to switch from range trading to trend follow with a simple mouse click! OK, maybe a few clicks :)

The pyramiding algorithms were completely rewritten in this version. The goal here is to reduce the number of pyramid trades accumulated per standard deviation incline. The pyramid logic employs conditional clauses to regulate how frequent an open position is increased. The script can accommodate up to ten pyramid levels. Each add on trade is spaced according to the pyramid span input. In order for a new level to be added the trade must exceed the specified pyramid span and satisfy the conditional logic which identifies the entry point. In the previous version this condition was met too easily. Thereby, exhausting the pyramid supply before the completion of the market move.

Conditional take profit exits, both limit and minimum profit, were redesigned. Profitable exits are not a hard price or offset. In order for a trade to close at a profit the exit condition must be met in addition to the offset specified in the associated input. This was always the case but the difficulty has been increased so as to make it harder to satisfy the exit condition. The result is that trades stay in the market longer with the expectation of further gains. The exit conditions themselves can be adjusted using the associated net change and ROC input parameters in Section 3 of the inputs dialog.

The “Long/Short Decaying Exits” feature has been improved to extend trades beyond their natural exit point. The idea here is to adhere to market moves which demonstrate underlying momentum. Why exit the trade when the market swing still has plenty of gas to keep going? It’s really annoying when the script takes a fifteen pip profit but the market still moves a another 85 pips further. That’s what this feature seeks to address. When activated the Ping Pong logic tries not to reverse the trade until some of the thrust has waned. At least that is what I intend for it to do. While this feature has been available in this script since the beginning it is continually being reworked and improved and I believe it currently is the best that it can be given the code limitations of Pine.

I also added three new inputs:

Enable Scalp Mode

Enabling this feature turns on algorithms specifically designed to discriminate smaller vertex patterns. Generally speaking, the code is altered in various places including the setups, exits and indicator calculations. Since this mode is not mutually exclusive, it can be applied to any trading Mode from the drop down selector in Section 1 of the inputs dialog. Enabling this feature is not necessary to trade smaller time frames but you can give it a try when you can’t seem to get it to work otherwise. I plan to release some template examples using this feature you can use as a guide for your own projects.

Counter Trade Linear Fall

The trend follow discipline does not employ any notion of tops or bottoms. That is to say that there is no such thing as overbought or oversold to a trend trader. When trading in Linear mode continuously rising prices leads to a series of long positions all the way up. This may leave your position vulnerable to a sudden pullback and stop loss. Enable “Counter Trade Linear Fall” to introduce the concept of oversold to long entries and overbought to short entries.

Restrict Long to Hemisphere

This script creates a single higher time frame trend line. The period can be selected in Section 1 of the inputs dialog. By enabling “Restrict Long to Hemisphere” trades above the trend line are forced to long positions. Trades below are forced to short. You can set a wide stop and and small bale out to remain in a directional bias (hemisphere) for a while. When the price stream changes sides the trading bias will change with it. This is kind of a last ditch effort to stay with a long winding trend perhaps using the day or four hour higher time frame period.

Happy New Year Everyone! I wish you all an exciting and prosperous year.
Notes de version
Build 942

This build provides default parameters so that when applied to a chart the user can, at least, see some trades. The script exposes over 100 inputs so it is a daunting task to get a symbol fully configured. I have received many complaints that user’s couldn’t get it to do anything. Most people who receive access immediately apply this script to their favorite trading symbol and expect it to generate a great looking back-test. That certainly is not going to happen without putting in work. However, I have made some changes to help foster an incremental approach to the initial setup. To that end, I have enabled various check boxes which I think are generally used. I have also created internal calculations to determine threshold values for entry and exit even if those inputs are zero in the dialog box fields.

Beyond a cursory look at the script, I recommend starting with one of my templates on the closest symbol and time frame. Work with my example until you get a feel for the significance of each input. Gradually adapt my example to your needs. Do not blindly trade any of my templates. The likelihood of losing money, probably a lot, is quite high. Please keep in mind that a reliable trading system that you can feel safe enough to entrust your hard earned capital is only achieved through personal effort. There really is no way to avoid it.

These are the minimal steps to see trades on your chart:

1. Configure the Properties tab of the inputs dialog box. These are the TradingView base values used by their broker simulator. Be sure to get the “Base Currency” right.
2. Select the “Ping Pong” Trading Mode at the top of Section 1 of the Inputs tab. You should see trades appear on the chart. If not move on to Step 3.
3. Select the “Linear-HTF” Trading Mode at the top of Section 1 of the Inputs tab. Adjust the Trend Bias Period input. Experiment with different intervals until trades appear. Otherwise, continue to Step 4.
4. Put in a value for Stop Offset in Section 1. This is an offset measured in quote currency points (pips). It’s a hard stop loss given to the TradingView simulator. You should see trades now.
5. If by some remote circumstance you still do not see trades then select the EURUSD symbol from the Chart Symbol Search box. Select the “Linear-HTF” Trading mode. Then select a 60 minute Trend Bias period. You should see trades now.

To see pyramids on the chart simply apply a value to the Pyramid Minimum Span in Section 1. This is an offset measured quote currency points (pips). You must also supply a stop offset value in Section 1. This is a safety restriction. Be sure to set a value greater than 1 to the Pyramiding input of the Properties tab. It’s common sense, but your stop loss must exceed your pyramid span or it will get hit first.

I also added one new input:

Mid-Tier Bale Out
When enabled this feature prevents a pyramid bale out until the middle level trade is exceeded. So if you have five pyramid levels the close price needs to reach at least trade number three in order to exit the position. This feature reduces some of the data mining bias associated with choosing a bale out amount. However, it forces your position to remain in the market longer making it vulnerable to an adverse market event. The “Same Size Pyramids” input automatically enables this feature making it redundant to enable both.
Bill Williams IndicatorscryptointradayOscillatorsswingtradingVolatility

Script sur invitation seulement

L'accès à ce script est limité aux utilisateurs autorisés par l'auteur et nécessite généralement un paiement. Vous pouvez l'ajouter à vos favoris, mais vous ne pourrez l'utiliser qu'après avoir demandé et obtenu l'autorisation de son auteur. Contactez tradingtudi pour plus d'informations, ou suivez les instructions de l'auteur ci-dessous.

TradingView ne suggère pas de payer pour un script et de l'utiliser à moins que vous ne fassiez confiance à 100% à son auteur et que vous compreniez comment le script fonctionne. Dans de nombreux cas, vous pouvez trouver une bonne alternative open-source gratuite dans nos Scripts communautaires.

Instructions de l'auteur

Please PM me for access to this script.

Vous voulez utiliser ce script sur un graphique ?

Avertissement: veuillez lire avant de demander l'accès.

Clause de non-responsabilité