MACD of Relative Strenght Strategy

MACD Relative Strenght Strategy :


This strategy is based on two well-known indicators: MACD and Relative Strenght (RS). By coupling them, we obtain powerful buy signals. In fact, the special feature of this strategy is that it creates an indicator from an indicator. Thus, we construct a MACD whose source is the value of the RS. The strategy only takes buy signals, ignoring SHORT signals as they are mostly losers. There's also a money management method enabling us to reinvest part of the profits or reduce the size of orders in the event of substantial losses.


RS is an indicator that measures the anomaly between momentum and the assumption of market efficiency. It is used by professionals and is one of the most robust indicators. The idea is to own assets that do better than average, based on their past performance. We calculate RS using this formula :

RS = close/highest_high(RS_Length)

Where highest_high(RS_Length) = highest value of the high over a user-defined time period (which is the RS_Length).

We can thus situate the current price in relation to its highest price over this user-defined period.

MACD (Moving Average Convergence - Divergence) :

This is one of the best-known indicators, measuring the distance between two exponential moving averages : one fast and one slower. A wide distance indicates fast momentum and vice versa. We'll plot the value of this distance and call this line macdline. The MACD uses a third moving average with a lower period than the first two. This last moving average will give a signal when it crosses the macdline. It is therefore constructed using the values of the macdline as its source.
It's important to note that the first two MAs are constructed using RS values as their source. So we've just built an indicator of an indicator. This kind of method is very powerful because it is rarely used and brings value to the strategy.


  • RS Length : Relative Strength length i.e. the number of candles back to find the highest high and compare the current price with this high. Default is 300.
  • MACD Fast Length : Relative Strength fast EMA length used to plot the MACD. Default is 14.
  • MACD Slow Length : Relative Strength slow EMA length used to plot the MACD. Default is 26.
  • MACD Signal Smoothing : Macdline SMA length used to plot the MACD. Default is 10.
  • Max risk per trade (in %) : The maximum loss a trade can incur (in percentage of the trade value). Default is 8%.
  • Fixed Ratio : This is the amount of gain or loss at which the order quantity is changed. Default is 400, meaning that for each $400 gain or loss, the order size is increased or decreased by a user-selected amount.
  • Increasing Order Amount : This is the amount to be added to or subtracted from orders when the fixed ratio is reached. The default is $200, which means that for every $400 gain, $200 is reinvested in the strategy. On the other hand, for every $400 loss, the order size is reduced by $200.
  • Initial capital : $1000
  • Fees : Interactive Broker fees apply to this strategy. They are set at 0.18% of the trade value.
  • Slippage : 3 ticks or $0.03 per trade. Corresponds to the latency time between the moment the signal is received and the moment the order is executed by the broker.
  • Important : A bot has been used to test the different parameters and determine which ones maximize return while limiting drawdown. This strategy is the most optimal on ETHUSD in 8h timeframe with the parameters set by default.


The entry rules are very simple : we open a long position when the MACD value turns positive. You are therefore LONG when the MACD is green.


We exit a position (whether losing or winning) when the MACD becomes negative, i.e. turns red.


This strategy can incur losses, so it's important to manage our risks well. If the position is losing and has incurred a loss of -8%, our stop loss is activated to limit losses.


The fixed ratio method was used to manage our gains and losses. For each gain of an amount equal to the value of the fixed ratio, we increase the order size by a value defined by the user in the "Increasing order amount" parameter. Similarly, each time we lose an amount equal to the value of the fixed ratio, we decrease the order size by the same user-defined value. This strategy increases both performance and drawdown.

Enjoy the strategy and don't forget to take the trade :)
Open-source Skript

Ganz im Spirit von TradingView hat der Autor dieses Skripts es als Open-Source veröffentlicht, damit Trader es besser verstehen und überprüfen können. Herzlichen Glückwunsch an den Autor! Sie können es kostenlos verwenden, aber die Wiederverwendung dieses Codes in einer Veröffentlichung unterliegt den Hausregeln. Sie können es als Favoriten auswählen, um es in einem Chart zu verwenden.


Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.

Möchten Sie dieses Skript auf einem Chart verwenden?