PROTECTED SOURCE SCRIPT

RSI Strategy - Backtest [AlgoRider]

█ OVERVIEW

Hello dear Tradingviewers !

We share with you this new indicator which simulates a trading strategy based solely on the well-known technical indicator RSI . We designed it for the sole educational and analytical purposes of showing novice traders and new investors that basing a trading strategy only on one such technical indicator is not necessarily a good thing to do. We do not recommend to apply this strategy for real.

Thanks to this indicator redesigned in our own way by incorporating our simple and easy-to-use Backtest functionality, you will be able to see and report on the performance and results that such a strategy has produced in the past.

The configuration window has also been designed to be easily readable and simple to use. Our goal is to make parameter customization as easy as possible.


█ HOW THE STRATEGY WORKS

  •   The script will trigger Long entries when the price crosses upwards the Oversold zone (Default 38.2) and Short entries when the price crosses downward the Overbought zone (Default 61.8).

  •   A Short signal ends a Long trade, a Long signal ends a Short trade.

  •   The script also allows setting up custom TP and SL.

  •   Several options allow you to reverse entry and exit conditions of trades. You can choose to reverse entries or/and exits (Ex: when the script detects a Long Entry, it will actually trigger a Short trade).

  •   You can also change the entry conditions of the strategy. Instead of entering oversold/overbought zone conditions, it will trigger entries when the Rsi changes direction and reverses (Ex: when the rsi has been going down for 5 candles, and the rsi starts going up) , regardless of the area in which the RSI is located.

  •   There is no repaint, once an entry/exit symbol or drawing is displayed it doesn't change anymore. The Short and Long signals appear at the open of the candles, just after the signal was confirmed at the close of the previous candle. The custom TP and custom SL signals can appear when a candle is not yet finished, but once displayed they don't change.


█ HOW TO PROCEED


 1 —  Once the script is applied to your chart, it already works with its default settings. You can already see the performance of the strategy in the data table directly on the chart (in the top right corner by default).

 2 —  You can customize the strategy and influence the results/performance by modifying its parameters. 4 types of parameters are present and can be modified.

 3 —  You can use this indicator in all types of markets.

 4 —  You can apply the script in every timeframe.


█ PARAMETERS


• Settings For Backtesting


  - Strategy     :   Choose from a drop-down list if the strategy should execute only Long trades or only Short trades or both. Default Both.

  - Invest.       :   Choose the amount you want to invest in the simulation. Default 10000.

  -  Position     :   Choose the amount of the position (Size order) that will be used during the simulation. This will be the $ amount staked/involved for each trade entry.
Ex: If you put 20000 in position and 10000 in Invest. We consider that you use at least a leverage x2. Default 10000.

  - Slipp. TP       :   Choose the amount in percentage of average slippage for Take Profits. This parameter makes it possible to predict a potential gap between the theoretical exit price for each TP (On the graph) and the real exit price on an exchange when implementing the strategy for real (slippage may be due to a time lag of a few seconds from execution time of the order on the exchange and/or due to the execution of a market order).
Ex: If a TP exit order of a Long trade, with entry $19000 (on BTCUSDT ), is carried out in theory on the chart at $20000, in practice on the exchange the script have indeed sent an exit order at 20000 , but if the true exit price is 20050, the TP slippage is then +0.25%. Default 0.

  - Slipp. SL     :   Choose the amount in percentage of average slippage for Stop Losses. This parameter makes it possible to predict a potential gap between the theoretical exit price for each SL (On the graph) and the real exit price on an exchange when implementing the strategy for real.
Ex: If an SL exit order of a Long trade, entry $19000 (on BTCUSDT ), is carried out in theory on the chart at $18000, in practice on the exchange the script have indeed sent an exit order at 18000 $, but if the true exit price is 17950, the slippage SL is then +0.278%. Default 0.

  - Fees %       :   Choose the percentage amount of fees applied to each trade to simulate the application of the strategy on the exchange of your choice. Applies to the entry and exit of each trade. Ex: For Binance Futures: 0.04; For Bybit futures: 0.06; For Ftx Futures: 0.075. Default 0.

  -  Cumulate Trades   :   If you check this, the Backtest will use 100% of the balance as Order Size (Position) for All or in the next X consecutive trades. Default not checked.
⚠️ Be Careful please, this option is available to show the full extent and possibilities of the algorithm when pushed to its limits thanks to the accumulation of profits (cumulative earnings ), but it is a strategy that involves great risk. If a bad trade suffers a -50% loss, 50% of the account balance is lost, if the position is liquidated, the entire account balance is lost.

  - All          :   If you check this All trades will be accumulated. Default not checked.

  - Consecutive Trades :   Choose the number of trades to accumulate. After X consecutive trades, the algorithm reassigns the initial order size to the current one and starts again for X consecutive trades. Minimum Value 2, Default 2.


• Change Entry & Exit conditions


  - Rsi Turns Up/Down     :  Enable this option to change conditions for trade entries. For Long entries : It will start a Long trade when RSI turns up and the RSI was falling on the last X bar(s). For Short entries : It will start a Short trade when RSI turns down and the RSI was rising on the last X bar(s). Default not checked.

  - After Falling/Rising Bars(s)   :  Choose the number of bars/candles since which the price was falling/rising. Default 5.

  - Reverse Entries        :  Enable this option to reverse conditions for trade entries. When a Short signal appears, it will actually start a Long trade. When a Long signal appears, it will actually start a Short trade. Default not checked.

  - Reverse Exits         :  Enable this option to reverse conditions for trade exits. Default not checked.

  - Safety Stop Loss         :  Enable this option to quickly cut the trade when the price turns quickly. For a Long trade : if the price returns to the oversold zone, it ends the trade. For a Short trade : if the price returns to the overbought zone, it ends the trade. Mainly useful for basic strategy (overbought/oversold conditions). Default not checked.


• Settings To Optimize Performances and Risk Management


  - Len RSI     :   The length of RSI . Default 14.

  - Overbuy      :  You can change the limit value of the overbought zone of the RSI . Default 61.8.

  - Oversell      :  You can change the limit value of the oversell zone of the RSI . Default 38.2.

  - Use TP / Use SL  :  If you check these, the algorithm will trigger personalized trade exit signals when the price evolution has reached the amounts indicated since the trade entry. Default not Checked.

  - % TP - SL     :  Indicate here the personalized amount in percentage that you want for your Take Profit and Stop Loss of each trade. Default 15-5.


• Settings For Appearances


  - Small-size Data Table  : If you check this, the data table will become smaller to free up more space on the chart to make it visually more pleasing. Default not checked.

       Hide Table  /
  -   Hide Labels /     : You can check these to get a cleaner chart and focus only on what interests you in the indicator. Default not checked.
   Hide Risk-Reward Areas


█ LIMITATIONS

  •   ⚠️ We repeat it once again, this strategy is not intended to be reproduced in real conditions, we have designed it for educational and analytical purposes only.

  •   Even if you see good performances when you backtest the strategy, you must take into account that these results are performed in the past and that in no case does this guarantee that these same performances will be repeated again in the future.

  •   When you run for real a trading strategy you must be aware of the fact that you are solely responsible for the results that you will be able to obtain and you must be aware of the possibility at all times of partial or even total losses of your invested capital.

  •   Keep in mind that generating profits in trading is difficult. A strategy can perform very well at one time in the past during a period that is favorable to it, then from one day to the next it can give really bad results for several months or years.

  •   When backtesting a trading strategy, there are many factors to consider, not just trade entries to which you add a Take Profit and sometimes a Stop Loss. You must at least take into account the size of the position in relation to the capital you want to invest, the trading fees, the slippages (which can be really important depending on the exchange on which you are trading and depending on the asset you are trading), trading frequency, risk management, momentum, volumes and even more.




The information published here on TradingView is not prohibited, doesn't constitute investment advice, and isn't created solely for qualified investors.




═════════════════════════════════════════════════════════════════════════

Important to note : our indicators with the same backtesting system are published in separate publications, because putting them together in a single script would considerably slow down the execution of the script. In addition each indicator, even when it is based on a simple technical indicator, has several options, parameters and entry/exit conditions specific to the underlying technical indicator. Finally, we want to keep the simplicity of use, configuration and understanding of our indicator by not mixing strategies that have nothing to do with each other.
Portfolio managementRelative Strength Index (RSI)statistics

نص برمجي محمي

تم نشر هذا النص البرمجي بمصدر غير مفتوح ويمكنك استخدامه بحرية. يمكنك جعله مفضلاً لاستخدامه على الرسم البياني. لا يمكنك مشاهدة أو تعديل كود المصدر الخاص به.

هل تريد استخدام هذا النص البرمجي على الرسم البياني؟


To know more about our indicators & strategies, please visit our website: algorider.io
يعمل أيضًا:

إخلاء المسؤولية