OPEN-SOURCE SCRIPT

[imba]lance algo

🟩 INTRODUCTION
Hello, everyone!
Please take the time to review this description and source code to utilize this script to its fullest potential.

🟩 CONCEPTS
This is a trend indicator. The trend is the 0.5 fibonacci level for a certain period of time.
snapshot
A trend change occurs when at least one candle closes above the level of 0.236 (for long) or below 0.786 (for short). Also it has massive amout of settings and features more about this below.

With good settings, the indicator works great on any market and any time frame!

A distinctive feature of this indicator is its backtest panel. With which you can dynamically view the results of setting up a strategy such as profit, what the deposit size is, etc.
Please note that the profit is indicated as a percentage of the initial deposit. It is also worth considering that all profit calculations are based on the risk % setting.

🟩 FEATURES
First, I want to show you what you see on the chart. And I’ll show you everything closer and in more detail.
snapshot
1. Position
snapshot
2. Statistic panel
snapshot
3. Backtest panel
snapshot

Indicator settings:
snapshot
Let's go in order:
1. Strategies
This setting is responsible for loading saved strategies. There are only two preset settings, MANUAL and UNIVERSAL. If you choose any strategy other than MANUAL, then changing the settings for take profits, stop loss, sensitivity will not bring any results.
You can also save your customized strategies, this is discussed in a separate paragraph “🟩HOW TO SAVE A STRATEGY”
2. Sensitive
Responsible for the time period in bars to create Fibonacci levels
3. Start calculating date
This is the time to start backtesting strategies
4. Position group
Show checkbox - is responsible for displaying positions
Fill checkbox - is responsible for filling positions with background
Risk % - is responsible for what percentage of the deposit you are willing to lose if there is a stop loss
BE target - here you can choose when you reach which take profit you need to move your stop loss to breakeven
Initial deposit- starting deposit for profit calculation
5. Stoploss group
Fixed stoploss % checkbox - If choosed: stoploss will be calculated manually depending on the setting below(formula: entry_price * (1 - stoploss percent)) If NOT choosed: stoploss will be (formula: fibonacci level(0.786/0.236) * (1 + stoploss percent))
6. Take profit group
This group of settings is responsible for how far from the entry point take profits will be and what % of the position to fix
7. RSI
Responsible for configuring the built-in RSI. Suitable bars will be highlighted with crosses above or below, depending on overbought/oversold
8. Infopanels group
Here I think everything is clear, you can hide or show information panels
9. Developer mode
If enabled, all events that occur will be shown, for example, reaching a take profit or stop loss with detailed information about the unfixed balance of the position

🟩 HOW TO USE
Very simple. All you need is to wait for the trend to change to long or short, you will immediately see a stop loss and four take profits, and you will also see prices. Like in this picture:
snapshot

🟩 ALERTS
There are 3 types of alerts:
1. Long signal
2. Short signal
3. Any alert() function call - will be send to you json with these fields


🟩 HOW TO SAVE A STRATEGY
First, you need to make sure that the “MANUAL” strategy is selected in the strategy settings.
After this, you can start selecting parameters that will show the largest profit in the statistics panel.
I have highlighted what you need to pay attention to when choosing a strategy
snapshot

Let's assume you have set up a strategy. The main question is how to preserve it?
Let’s say the strategy turned out with the following parameters:

snapshot
Next we need to find this section of code:


Let's uncomment on the latest strategy called "NEW STRATEGY" rename it to "SOL 5m" and change the sensitivity:


Now let's find this code:


And let's add our new strategy there, it turned out like this:


That's all. Our new strategy is now saved! It's simple! Now we can select it in the list of strategies:
snapshot
Bands and ChannelsTrend Analysis

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer