OPEN-SOURCE SCRIPT

Buy / Sell Fractal Algorithm with SL Line Generation

Güncellendi
This algorithm is designed for usage across indices.

How it works?

The algorithm uses a variation of fractals, momentum, RSI and LRSI to determine a trends direction.

The Relative Strength Index (RSI) is a momentum-based oscillator used to measure the speed (velocity) and change (magnitude) of directional price movements. It provides a visual means to monitor both the current and historical strength and weakness of a particular market. The strength or weakness is based on closing prices over the duration of a specified trading period, creating a reliable metric of price and momentum changes

Momentum in trading refers to the direction and magnitude of price. Momentum plays a key role in assessing trend strength, and it is important to know when a trend is slowing down. Less momentum does not always lead to a reversal, but it does signal that something is changing, and the trend may consolidate or reverse

Fractals are patterns within price changes which are repeated across thousands of bars. Examples of fractals include the golden ratio, PHI and the spirals of the milk way. They are quite literally a universal concept.

Basics of usage:

When a bullish trend is detected; the algorithm will generate a green "SL Line" at a calculated point, which can be interpreted as an invalidation line.

If the price goes below this line, the bullish trend is invalidated. So long as it holds, the bullish trend is true until the next detection change.

When a bearish trend is detected; the algorithm will generate a red "SL Line", at a calculated point, which can be interpreted as an invalidation line.

If the prices goes above this line, the bearish trend is invalidated. So long as it holds, the bearish trend is true until the next detection change.

When a given trend is invalidated, the SL Line turns yellow and you enter a "pause zone", where neither a bearish nor bullish trend is calculated.
This resets itself on the next trend detection.

Additional information:

I have coded my own backtest to this algorithm, along with plotting the profit / loss of each generated trade.

The profit is calculated by the difference between the open bar of the trade after a long ( or short ) and the following trade.
If we are calculating a short, the resulting value is then multiplied by -1 to get a positive integer.

For calculating a loss we take the value of the open bar of the trade that generates a long, and take the difference between this and the SL line, and similarly for short positions. The code assumes the user is placing their SL at the indicated line.

Within the input settings there are a few customisation options:

Alpha & Fractal Energy Length & Source - Should not be changed.

Highly bands crossover? - Has no visible effect whether on or off. It refers to the fractal chart which in this iteration is not visible and rather a backend mechanic.

Apply fractal energy? - Should generally be left turned on. This is a noise reduction. Disabling will result in over-trading.

Apply normalization? - Has no impact, is solely used to make the fractal values more human-readable rather than decimal format.

Offset - refers to the offset value of the SL Line generations. This should be set to a value that gives you enough breathing room, and remember to include any spreads! Default is 0.2, written in %

Trading hours - This simply gives a session input for the trading hours you want to trade within, and then colours the background green for that session. Trading 24/7 is never a wise strategy, stick to whatever is most optimal for you.

Leverage - Whatever leverage you are using. Default is x20. This will affect the profit / loss calculations accordingly.

Start equity - refers to the equity value you want to backtest with. Some assets will generate NA for this in the backtest label explained later.

Label customisation options.

Note that the backtest label is by default hidden, and appears when you hover over the black label at the current bar. When enabled to visible, it will show a large text label that may cover your chart screen more than you wish.

Alerts -

There are dozens of alert functionalities here; first are the timeframe assignments for each alert, set by default to 2hrs.
These timeframes then affect the asset you select in the corresponding setting.

In total there are 8 additional assets you can set alerts for.
Once you have assigned the timeframe and asset for an alert, you can then check the tick box for that individual alert.

Once done, you set the alert as normal through the tradingview alerts window. Remember to set "alert function calls only"

-

Timers:

I have added some functionality for timers to be set, values are in minutes. These work on the exact time of placement. Do not change the extra symbol formula option.

-

Note that this backtest is not intended as a replacement for tradingview backtest, nor is there a guarantee that historical results are to be replicated in the future. Trading is inherently risky.
Sürüm Notları
Fixing auth error
Sürüm Notları
Updated image
Sürüm Notları
//Update contains:
//1. Secondary Chart overlay, displaying the last 9 bars of a custom asset according to a custom timeframe
//2. A calculation for the probability a bar goes up / down according to historical data, fib points, pivots etc. As well as a backtest for this probability to ensure reliability
//3. An embedded tradingview rating for buy/sells according to their own rating public rating system, converted into a label.
//4. Confirmation for values before loading algorithm, to get around some strange errors - Also a confirmation that life sucks...because...it does.
//5. Volume indicators MTF

As well as some optimisations.
Sürüm Notları
Cleaned up code to "tradingview standards"
Sürüm Notları
Removed some useless rubbish
Sürüm Notları
Updated to change a delisted asset provider
BTCbuysellsignalChart patternsger40multitimeframeNASDAQ 100 CFDTrend Analysis

Açık kaynak kodlu komut dosyası

Gerçek TradingView ruhuna uygun olarak, bu komut dosyasının yazarı komut dosyasını açık kaynak olarak yayınlamıştır, böylece yatırımcılar betiği anlayabilir ve doğrulayabilir. Yazar çok yaşa! Ücretsiz olarak kullanabilirsiniz, ancak bu kodun yayında yeniden kullanımı Ev kurallarına tabidir. Bir grafikte kullanmak için favorilere ekleyebilirsiniz.

Bu komut dosyasını bir grafikte kullanmak ister misiniz?

Feragatname