TN Alerts: A Smart Approach to Trade Entries and Exits

TN Alerts: A Smart Approach to Trade Entries and Exits

Introduction

The indicator/system we will present is an alert system called TN alerts. This system is designed to identify entry and exit opportunities in the market using weighted moving averages and a trailing stop. The goal of this system is to provide clear signals for executing long and short trades while managing risk through the use of a dynamic trailing stop.

The TN alerts system stands out for its ability to adapt to different market conditions, offering a structured way to identify trends and manage trades efficiently. This system includes advanced features such as re-entries and signal visualization directly on the chart, facilitating decision-making for traders.

Indicator Parameters

The input parameters of the system are as follows:

  • TS (Trailing Stop): Percentage of trailing stop. This parameter defines the trailing stop adjustment percentage relative to the closing price.
  • TSswitch: Enable/disable the display of stop loss. When enabled, the stop loss is shown on the chart.
  • BGswitch: Enable/disable the background color on the chart. It allows clear visualization of long and short entry zones.
  • REswtich: Enable/disable the display of re-entries. Shows re-entry signals on the chart.
  • fastperiod: Fast period for calculating the moving average.
  • slowperiod: Slow period for calculating the moving average.
  • MAtype: Type of moving average to use (e.g., weighted).

These parameters allow high flexibility and customization of the system, adapting it to the trader’s specific needs and market behavior over different periods.

Moving Averages Calculation

Moving averages are a fundamental tool in technical analysis, and this system uses two:

  • wmaSlow: Slow moving average calculated over the period defined by slowperiod.
  • wmaFast: Fast moving average calculated over the period defined by fastperiod.

The moving averages are calculated as follows:

The fast moving average (wmaFast) and the slow moving average (wmaSlow) help identify short-term and long-term trends, respectively. These moving averages are essential for determining the entry and exit conditions in the market.

Entry and Re-entry Conditions (Long and Short)

The conditions for long and short entries are defined as follows:

  • Long Entry: The slow moving average is greater than its previous value, and the current closing price is above the fast moving average, among other conditions.
  • Short Entry: The slow moving average is less than its previous value, and the current closing price is below the fast moving average, among other conditions.

Re-entries

The system also considers re-entries in the same direction of the current trend, allowing to capitalize on extended market movements. This is visualized on the chart with specific colored arrows.

Re-entries are marked with blue arrows for long trades and gray arrows for short trades, indicating moments of reinforcement of the initial position.

Trailing Stop Calculation

The trailing stop is a crucial tool for risk management in trading. This system uses a dynamic trailing stop that adjusts based on the closing price. The trailing stop is calculated as follows:

In this code, tsPercent defines the trailing stop percentage. trailTop and trailBot are used to store the trailing stop values for long and short positions, respectively. The trailing stop adjusts dynamically, allowing to lock in profits while minimizing losses.

Exit Conditions (Long and Short)

The system’s exit conditions are determined by the trailing stop. When the price reaches the trailing stop level, an exit signal is generated. The exit conditions are implemented as follows:

Here, exitlong and exitsh determine if long or short positions should be closed based on the trailing stop. The variables inlong and inshort are used to track the current position status.

Visualization on the Chart

The system visualizes signals on the chart using arrows and background colors. This facilitates the interpretation of signals and decision-making in trading. The visualization is implemented as follows:

In this code, green and red arrows indicate long and short entries, respectively. Blue and gray arrows indicate re-entries, while black symbols indicate exits.

Complete Code of the Indicator/System

Conclusion

This system provides a powerful tool for identifying entry and exit opportunities in the market using moving averages and trailing stops. The customization of parameters allows the system to adapt to different trading styles and markets. It is important to test and adjust the system in various market conditions to maximize its effectiveness.

The TN alerts is a versatile system that can be used by both novice and experienced traders. Its clear visualization and well-defined rules make it a valuable addition to any trading strategy.

Share this

Risk disclosure:

No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.

ProRealTime ITF files and other attachments : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

  1. Fgats • 173 days ago #

    Thank Ivan for this code !
    Now could you clarify one detail : when I compare line 58 with line 50, I wonder if there is a typo. Shouldn’t we write inshort = inshort[1]?
    Thank for your reply.
    Gabriel

  2. Faisalx • 172 days ago #

    Hola Ivan. Thanks for your great job.
    I would appreciate if you have look at my request
    https://www.prorealcode.com/topic/convert-code-pivot-ribbon/

  3. roccafragius • 171 days ago #

    Thank you for all these useful information!! Very great job Ivan! THank you so much

  4. geroniman • 171 days ago #

    Merci Ivan, super travail. On peut toujours compter sur toi pour apporter des innovations sur ce site. Est-ce que tu as créé un groupe whatsapp ou telegram ?

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar
Related users ' posts
Iván
3 weeks ago
Madrosat Bonjour ivan Quelle différence il y a t il entre Extra trend et ultra trend lequel est le p...
MaoRai54 dear Ivan, it seems to be very interesting but please clarify what are all the lines I see i...
Iván Hi! you have the answer in the last line of code... MacdMiddle as "histo" style(histogra...
kats Le Top , a utiliser avec le nuage violet et alerte TN pour plus de précision.
roccafragius Hello Ivan, very good job! May I ask you to translate teh script from TradingView named Tre...
Iván Hi! yes. You can ask for it here: https://www.prorealcode.com/free-code-conversion/
roccafragius Thank you so much Ivan! I created this request in english Translate from TradingView Indicat...
Regisnew très bel indicateur merci
Jean2139 Bonjour Yvan, Merci pour ton indicateur que je trouve très intéressant. Je suppose que tu ...
Suffi Hier eine kleine Korrektur: //-----Inputs-----------------------------------------// MALengt...
kats Bonjour, J'ai une question etes vous trader? Je m'explique , j'ai téléchargé tous les indi...
Stenozar Ciao mi restituisce errore line 1; forse è perchè utilizzo la versione 11 ? in questo caso d...
Stenozar Ciao IVAN , mi da errore per la riga 49 "print tema low"; puoi suggerirmi la modifica da met...
Iván Avete provato a scaricare il file .itf?
Iván Allora crei un nuovo post. Lo aspetterò.
Stenozar Ciao Ivan, ho inserito il post con la richiesta di traduzione. Se puoi vedere, grazie!
Iván perfect!
kats BONSOIR c bon merci j ai trouve ce weekend merci de votre reponse cdlt
the_giorgio Hi, nice work I would like to understand something about prorealtime code. With your ...
Iván Hello. When you use the drawcandle() instruction then in the configuration window you add ...
Gaspare Ciao Ivan si puo' inserire una strategia su questo indicatore per ottimizzare le variabil...
Iván
8 months ago
Iván Si lo descargas e importas en tu PRT verás que se han creado las variables para luego config...
WhyAskOZ Hi, Ivan As always you are doing great coding. The code works on my PRT, however the issu...
Iván You can delete in the last line (return) the configuration for color. Delete coloured(xx,xx,...
Bernard13 (Je réécris mon commentaire -français- en français car certains mots ne correspondaient pas ...
Iván 1000 indicateurs !!! brutaux
Lean Me parece muy buen indicador, y se complementa muy bien en mi sistema, ¿podrías crear un scr...
Iván Gracias! Para el screener sólo tienes que copiar el indicador y poner como condición de búsq...
Lean Muchas gracias Iván, ya lo he podido crear.
Doddge Hola Iván, ¿sería posible crear un screener que indique cuándo las velas coloreadas del indi...
RTR Ivan thank you for the pro-screener. I a trying to understand how to write the signals from ...
Iván Hi, Lines 62 and 63. These lines define buy and sell conditions.
Iván Hi You should delete from the indicator code all drawing functions and all variables not us...
Iván I've created a screener to show [longcondition or shortcondition]
Chrisinobi Hallo Ivan, Danke das ist Perfekt !! Kannst du bitte in der Screener-Bibliothek die itf. hoc...
MaoRai54 Thanks, now it's OK. in your first code at line 15-16 it's missing.
Madrosat Hello Ivan Did you try a strategy with this indicator
Iván Hi. No I didn't. This is a code translation requested by an user a few days ago.
Iván
9 months ago
cjr30 Simplemente modifica las lineas 19 y 21 por las siguientes: drawtext("▲",barindex,low-0.1*a...
groelandes Gracias!!
WhyAskOZ i copied the code into strategy and it gives error on line 21 and 23. it says " Line 1: ...
Iván
9 months ago
Madrosat Hello Ivan You have interesting topics on indicators , smart supertrend, optimised trend t...
Iván Hi! thanks. All of these codes are translations requested in the forum. I've on mind to back...
Raspete01 Buenos días Iván, estoy intentando llevar el código eliminando los colores y pasando un Back...
Iván
10 months ago
winnie37 Hi Ivan, if i want to use it, and call the oscillator value (in grey, green or red), how to...
Iván The oscillator is smoothtype. In inputs there is de lag to configure the output

Top