OPEN-SOURCE SCRIPT

RMI Trend Sniper with Enhancements by Artem

This strategy ‘RMI Trend Sniper with Enhancements’ combines the RMI (Relative Momentum Index) indicator with an EMA (Exponential Moving Average) trend filter and the addition of Stop-Loss levels. The main goal is to open trades only in the direction of a strong trend and automatically close them when the set risk level is reached. Here is a detailed explanation of how each element of the strategy works:
1. main indicator: Relative Momentum Index (RMI)
RMI is a variation of the RSI (Relative Strength Index) indicator, but taking into account price changes over longer time frames. RMI helps to find overbought and oversold points where the price may change direction.
RMI parameters:
Length - the length of the RMI (20 in this case), specifying the number of periods to calculate.
pmom and nmom - RMI levels, based on which buy and sell decisions are made. If RMI is above pmom (66), it is considered positive, if it is below nmom (30) - negative.
2. Trend Filter: EMA 200
EMA 200 (exponential moving average with a period of 200) is a standard indicator for determining a long-term trend.
EMA filter: The strategy opens trades only in the direction of the current trend. If the price is above the EMA 200, the strategy considers only buy trades, if it is below, it considers only sell trades. This helps to avoid trading against the main trend and reduce the number of false signals.
3. Buy and sell conditions (signals)
Buy signal:
The RMI indicator should be above the pmom level (66).
The price should be above the EMA 200.
If these conditions are met, the strategy opens a long position (buy).
Sell signal:
The RMI indicator should be below the nmom (30) level.
The price should be below the EMA 200.
Under these conditions, the strategy opens a short position (sell).
4. Stop-Loss levels
ATR (Average True Range) is used to calculate stop-loss levels. ATR measures price volatility, which allows you to set a flexible Stop-Loss level.
Calculation of Stop-Loss:
For long positions (purchases): Stop-Loss is set at close - stopLossATR * atr, where stopLossATR is the ATR multiplier (here 1.5).
For short positions (sales): Stop-Loss is set at close + stopLossATR * atr.
Using ATR allows you to set Stop-Loss at a reasonable distance from the price, taking into account the current volatility. This reduces the probability of premature closing of a position in high volatility conditions.
5. Visualisation
Bar colour: Bars are coloured green if there is a positive (buy signal) and red if there is a negative (sell signal).
TheEMA 200 is displayed on the chart with a yellow line to show the trend line and to follow the direction of the underlying trend.
Exponential Moving Average (EMA)Relative Strength Index (RSI)

نص برمجي مفتوح المصدر

قام مؤلف هذا النص البرمجي بنشره وجعله مفتوح المصدر، بحيث يمكن للمتداولين فهمه والتحقق منه، وهو الأمر الذي يدخل ضمن قيم TradingView. تحياتنا للمؤلف! يمكنك استخدامه مجانًا، ولكن إعادة استخدام هذا الرمز في المنشور يخضع لقواعد‎‎قوانين الموقع. يمكنك جعله مفضلاً لاستخدامه على الرسم البياني.

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

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