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 • 301 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 • 299 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 • 299 days ago #

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

  4. geroniman • 298 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
mfejza also, for long trailing stop d2=low d1=lowest[3](d2)+1/3*AverageTrueRange[20](close) d3...
Jiacky
3 years ago
Kalman Filter
Kalman Filter
0
Indicators
Stenozar Hi Sever, how can I visualize the coloured areas?
Sever Hi Stenozar, You need to add the color zones yourself , just go to Add Color Zone To set ...
CederTrader Hi Denis, does this indicator add to the chart as panel, or on the candles. Thanks
Nicolas Add it on the price chart as described in this video: https://www.prorealcode.com/blog/video...
Denis Hello Nicolas and Ceder Trader, Sorry, I only just saw your replies. The indicator is alre...
atlante hi nicolas this indicator have 2 wrong borderline and islalastbarupdate. thank you can you h...
Nicolas That'"s because you are not using PRT v11? Just remove lines 59 to 62
Kanamax Hi Roberto, sorry for my confusing previous posts (forget them). My request is very simple,...
robertogozzi Please start a new topic in ProOrder support.
robertogozzi There you go: myMagicTrend = CALL “Magic Trend custom”[20, 14, 1, 5] alpha = 105 b = 0...
johann8 exactly :) Thank you all for the help!
max_92 Ciao Roberto, ho scaricato l'indicatore e come ti avevano già scritto sopra anch'io vedo la ...
Xenotrax A première vue, sa à l'air d'être un indicateur très puissant sur de petites temporalités, j...
merri Bonjour Nicolas, Comment transformer cet indicateur en bot sur PRT ?
Nicolas Cela a déjà été fait, voir ce sujet: https://www.prorealcode.com/topic/strategia-con-lindica...
Nicolas change the last line with: return v coloured(r,g,b) style(line,2), v+band coloured(168,168,1...
Paolo.B Thanks ... works as i wanted.
Kanamax Bonjour Nicolas, comme Paolo.B je souhaiterais utiliser cette indicateur au sein d'un code. ...
zilliq Thanks @Nicolas. I tried to use it as Trend in a proorder system, but don't know why, it doe...
Suzu Yuk He is right. MT and mavgMT are not defined and causing errors.....
RakeshPoluri I have a question about the bands on the candles. Is it bollinger bands or something else?
Nicolas I think that's 2 Bollinger Bands
Emperor.it "style(line,2)" C'è una guida ai parametri che si possono modificare ? Tipo stile della lin...
IV Mcm https://www.prorealcode.com/programming-with-prorealtime/
Daniele Maddaluno Écrivez-moi où vous préférez you can easily find me on LinkedIn
AK27 C'est payant visiblement sur linkdin je peux pas vous envoyer, discord vous avez ?
Pensera Bonjour Nicolas, comment est-il possible de backtester cet indicateur? cela fait une erreu...
Nicolas Oui bien sûr, il doit y avoir pas mal de sujets dans le forum à ce propos.
simmerseb Bonjour, merci beaucoup pour cet indicateur je le trouve très clair et pertinent.
Nicolas Il doit s'agir d'un mauvais copier/coller. Je suggère de télécharger le fichier itf contenu ...
Bard Hello @Nicolas, I can get this to display in a separate indicator panel but not on Price as ...
Stenozar Hi @Nicolas, how can I put the bands on price? Thanks, Stefano
Guillaume Mcm I gave the above message fix ;)
Tradingrob Is it possible to put the itf-file in the right way here in Prorealcode? so the right 'trend...
Guillaume Mcm Update link ;) https://www.prorealcode.com/topic/trend-histogramme-cci-mise-a-jour-suite-...

Top