Dynamic Price Swing

Solutions1978 Mis à jour   
Finally, a price channel oscillator that works.

I programmed three flavors into this.

The first flavor uses the Fast and Slow EMA to check for the trend to ensure you don't trade in the wrong direction simply because the price crosses the previous highest high or lowest low (based on lookback bars).

The second flavor uses a seven point average of the Fibonacci bands to create an upper and lower central channel for quick trades (like DOGE).

The third flavor uses the golden Fibonacci ratio of 1.618 and trades when the price moves above or below this band.
Notes de version:
Couple of tweaks to make this a better script with some additional precautionary checks for the trade triggers.

Basically this script is dynamically updated so it does not require constant maintenance. The basic price channel (Default selection) just looks for ups and downs from an average of the highest highs and lowest lows to trade based on volatility. It works best on a 30 minute timeframe. It depends on the lookback period, RSI, and risk management functions.

The other options require an understanding of the moving average and Fibonacci retracement to use. The fib portion is much less complicated since I've added the sequence selections as drop down choices. It's better suited for crypto that has wild swings above and below the Fibonacci retracement levels (like BTC and ETH have been doing lately).
Notes de version:
After working on this through another 300 revisions, I finally got it to be more realistic if using the mixed Long/Short strategy and by adding some linear regression logic to make the channel logic more aggressive.

All of the triggers use the Risk Management Inputs and Lookback Periods.

This script will aggressively scalp crypto using the Average Price Channel strategy. This strategy depends upon the RSI Length, EMA Fast & Slow Lengths. Since it is aggressive you can tweak it using the risk management inputs based on the amount of your capital you are willing to draw down.

The Moving Average is less aggressive and depends on the same parameters as the Price Channel, but only triggers when the price channel is crossed.

The Fibonacci Average has been tweaked considerably to be more reliable and to have additional retracement level options for the upper and middle bounds. This trigger uses the Fast & Slow EMA Lengths and does not use the RSI Length.

The Price dips and peaks is still being worked on, right now it does okay but I am looking at combining some additional trend indicators with it to make it more robust.
Notes de version:
Finally perfected this script after adding another 200 lines of code.

This strategy uses a blend of static and user input values for the indicators. I went over months of trade data to identify patterns that occur across multiple crypto currencies and used those common crosses or whether values were higher or lower than another and these are included as the triggers for buying and selling.

Additionally, since I have been contacted by many of you that would like to be able to send alerts to 3Commas or other webhook based bots I added an area in the strategy input for you to paste in the webhook message.

Since longs and shorts have different patterns this script is not intended to be used for both long and short at the same time. You will need to tweak the settings individually for long or short and have a one strategy to one bot ratio. In other words, if you are doing a long and short strategy for AMP, then you will set up two different alerts. One that is based on the long only settings for your long bot and another that is based on your short only settings for the short bot.

This strategy operates the best at a 15 minute resolution, any lower or higher has different patterns and I did not have the time to program all of the variations. This is why I am publishing this script as open source so you can have at it if you wish.
Notes de version:
I took @janor123 comments to heart and went back through the strategy and removed items which could lead to overfitting or complicated the script more than it should be.

Other changes: Instructions on how to use this script are included in the settings tab of the script.

Major change: First real walkthough of any of my scripts to explain precisely how to use it.

Using the Average Price Channel
Summary of Settings
Stop Loss = 7
Target Profit = 8.1
Stop Trading Days = 3
Maximum Equity Loss % = 10
EMA Fast = 20
EMA Slow = 8 (not a typo, read the logic below)
Avg # bars 12
Price Lookback = 7

Setting the EMA Crossover
1. Add EMA Crossing Indicator by traderscorner
2. Default settings – when the Fast EMA is above the Slow EMA it indicates an upward trend and vice versa. Lower numbers for both fast and slow indicate faster responses to price movements and more crosses while higher numbers have less crosses and can provide insight into resistance levels. There is a little known secret here, take a look at the arrow placement for default settings of 5 for fast and 9 for slow. As you can see by the red (sell) and green (buy) arrows the trigger happens too late and in the wrong places.

Have you ever tried switching the lengths? Well, if you break the rules to see what will happen you will see that the arrows actually do line up where you want them to and actually indicate the right zones for buying and selling. You do not have to follow this advice, it is a suggestion for innovative thinking as part of this walkthrough of how to use this script.

Knife Settings

Find the longest high wick and calculate the percentage difference between the high and the close (diff = (high-close)/close * 100%). Find more than one so you can take an average. For my settings, the average of the three I found was 3.2%.

Picking a Strategy Setting: Long or Short but not Long/Short

I look at the Performance Summary Tab with my default risk management settings and select the strategy with the highest gross profit. Now, due to the compounding nature of back testing when I change the strategy from Long/Short to Long Only the values in the Performance Summary tab will change to about 50% of what you see initially. Once I have selected a strategy, I go back and tweak the Average # of Bars and Price Lookback Period by +/- 3.

Risk Management Settings

The final setting to define are the risk management settings. What I do is take a look at the Drawdown and losing trade (negative profits) and add these two numbers up. I get the following values: 5.46, 6.71, 6.11, 8.63. I use these to test out a range of potential target profits that are realistic. I notice the highest profit at 8 and it went back down at 9. After a few more keystrokes of trial and error, I find that the sweet spot is 8.1%.

The stop loss is something you define based on comfort level. Setting it too low will skew the results and setting it too high will give you unrealistic expectations. For me, my comfort level is losing 7% on any trade.

Finally, if you leave this script on autopilot and want to make sure you don’t have it run awry then you would want to use the Stop Trading and Halt Trading settings. I set my losing days to 3 days in a row before the script halts and my maximum overall equity loss to 10%. This is based on personal preferences and does not have any logic or math behind it.

If you have any comments or questions, please feel free to reach out to me. As you can see by my update, I will listen to criticism and take a look at my scripts from your point of view to make it better for the TV community.
Notes de version:
1. Had a typo in the Moving Average strategy, fixed it.
2. Added colors for using this as an indicator until I publish the study version.

Note: For Moving Average and Fibonacci strategy selections, DO NOT reverse the EMA lengths. That works when trying to do quick scalps as part of price channel movements based only on lows and highs. The MA and Fib strategies work best with the slow EMA length of between 20 and 50 with the fast EMA length of 10 to 20.
Notes de version:
Another typo fixed on the coloring of the upper and lower price bands. It all works now, each strategy has been checked out as working and realistic.

Performers follow, high performers break from convention.
Script open-source

Dans le véritable esprit de TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par le règlement. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.

Vous voulez utiliser ce script sur un graphique ?