Alert Sender Library [TradingFinder]Library "AlertSenderLibrary_TradingFinder"
🔵 Introduction
The "Alert Sender Library" is a management and production program for "Alert Messages" that enables the creation of unique messages for any type of signal generated by indicators or strategies.
These messages include the direction of the signal, symbol, time frame, the date and time the condition was triggered, prices related to the signal, and a personal message from you. To make better and more optimal use of this "library", you should carefully study " Key Features" and "How to Use".
🔵 Key Features
Automatic Detection of Appropriate Type :
Using two parameters, "AlertType" and "DetectionType", which you must enter at the beginning into the "AlertSender" function, the type of the alert message is determined.
For example, if you select one of the "DetectionType"s such as "Order Block Signal", "Signal", and "Setup", your alert type will be chosen based on "Long" and "Short". Whether it's "Long" or "Short" depends on the "AlertType" you have set to either "Bullish" or "Bearish".
Automatic Symbol Detection :
Whenever you add an alert for a specific symbol, if you want the name of that symbol to be in your message text, you must manually write the name of the symbol in your message. One of the capabilities of the "Alert Sender" is the automatic detection of the symbol and adding it to the message text.
Automatic Time Frame Detection :
When adding your alert, the "Alert Sender" detects the time frame of the symbol you intend to add the alert for and adds it to the text. This feature is very practical and can prevent traders from making mistakes.
For example, a trader might add alerts for a specific symbol using a specific indicator in different time frames, taking the main signal in the 1-hour time frame and only a confirmation signal in the 15-minute time frame. This feature helps to identify in which time frame the signal is set.
Detection of Date and Time When the Signal is Triggered :
You can have the date and time at the moment the message is sent. This feature has various uses. For example, if you use the Webhook URL feature to send messages to a Telegram channel, there might be issues with alert delivery on your server, causing delays, and you might receive the message when it has lost its validity.
With this feature, you can match the sending time of the message from TradingView with the receipt time in your messenger and detect if there is a delay in message delivery.
Important :
You can also set the Time Zone you wish to receive the date and time based on.
Display of "Key Prices" :
Key prices can vary based on the type of signals. For example, when the "DetectionType" is in "Order Block Signal" mode, the key prices are the "Distal" and "Proximal" prices. Or if the "DetectionType" is in "Setup" mode, the key prices are "Entry", "Stop Loss", and "Take Profit".
Receipt of Personal "Messages" :
You can enter your personal message using "input.string" or "input.text_area" in addition to the messages that are automatically created.
Beautiful and Functional Display of Messages :
The titles of messages sent by "AlertSender" are displayed using related emojis to prevent mistakes due to visual errors, enhancing beauty.
🔵 How to Use
🟣 Familiarity with Function and Parameters
AlertSender(Condition, Alert, AlertName, AlertType, DetectionType, SetupData, Frequency, UTC, MoreInfo, Message, o, h, l, c, Entry, TP, SL, Distal, Proximal)
Parameters:
- Condition (bool)
- Alert (string)
- AlertName (string)
- AlertType (string)
- DetectionType (string)
- SetupData (string)
- Frequency (string)
- UTC (string)
- MoreInfo (string)
- Message (string)
- o (float)
- h (float)
- l (float)
- c (float)
- Entry (float)
- TP (float)
- SL (float)
- Distal (float)
- Proximal (float)
To add "Alert Sender Library", you must first add the following code to your script.
import TFlab/AlertSenderLibrary_TradingFinder/1
🟣 Parameters
"Condition" : This parameter is a Boolean. You need to set it based on the condition that, when met (or fired), you want to receive an alert. The output should be either "true" or "false".
"Alert" : This parameter accepts one of two inputs, "On" or "Off". If set to "On", the alarm is active; if "Off", the alarm is deactivated. This input is useful when you have numerous alerts in an indicator or strategy and need to activate only a few of them. "Alert" is a string parameter.
Alert = input.string('On', 'Alert', , 'If you turn on the Alert, you can receive alerts and notifications after setting the "Alert".', group = 'Alert')
"AlertName" : This is a string parameter where you can enter the name you choose for your alert.
AlertName = input.string('Order Blocks Finder ', 'Alert Name', group = 'Alert')
"AlertType" : The inputs for this parameter are "Bullish" or "Bearish". If the condition selected in the "Condition" parameter is of a bullish bias, you should set this parameter to "Bullish", and if the condition is of a bearish bias, it should be set to "Bearish". "AlertType" is a string parameter.
"DetectionType" : This parameter's predefined inputs include "Order Block Signal", "Signal", "Setup", and "Analysis". You may provide other inputs, but some functionalities, like "Key Price", might be lost. "DetectionType" is a string parameter.
"SetupData" :
If "DetectionType" is set to "Setup", you must specify "SetupData" as either "Basic" or "Full". In "Basic" mode, only the "Entry" price needs to be defined in the function, and "TP" (Take Profit) and "SL" (Stop Loss) can be any number or NA. In "Full" mode, you need to define "Entry", "SL", and "TP". "Setup" is a string parameter.
"Frequency" : This string parameter defines the announcement frequency. Choices include: "All" (activates the alert every time the function is called), "Once Per Bar" (activates the alert only on the first call within the bar), and "Once Per Bar Close" (the alert is activated only by a call at the last script execution of the real-time bar upon closing). The default setting is "Once per Bar".
Frequency = input.string('Once Per Bar', 'Message Frequency', , 'The triggering frequency. Possible values are: All (all function calls trigger the alert), Once Per Bar (the first function call during the bar triggers the alert), Per Bar Close (the function call triggers the alert only when it occurs during the last script iteration of the real-time bar, when it closes). The default is alert.freq_once_per_bar.', group = 'Alert')
"UTC" : With this parameter, you can set the Time Zone for the date and time of the alert's dispatch. "UTC" is a string parameter and can be set as "UTC-4", "UTC+1", "UTC+9", or any other Time Zone.
UTC = input.string('UTC', 'Show Alert time by Time Zone', group = 'Alert')
"MoreInfo" : This parameter can take one of two inputs, "On" or "Off", which are strings. Additional information, including "Time" and "Key Price", is included. If set to "On", this information is received; if "Off", it is not displayed in the sent message.
MoreInfo = input.string('On', 'Display More Info', , group = 'Alert')
"Message" : This parameter captures the user's personal message through an input and displays it at the end of the sent message. It is a string input.
MessageBull = input.text_area('Long Position', 'Long Signal Message', group = 'Alert') MessageBear = input.text_area('Short Position', 'Short Signal Message', group = 'Alert')
"o" (Open Price): A floating-point number representing the opening price of the candle. This input is necessary when the "DetectionType" is set to "Signal". Otherwise, it can be any number or "na".
"h" (High Price): A float variable for the highest price of the candle. Required when "DetectionType" is "Signal"; in other cases, any number or "na" is acceptable.
"l" (Low Price): A float representing the lowest price of the candle. This field must be filled if "DetectionType" is "Signal". If not, it can be any number or "na".
"c" (Close Price): A floating-point variable indicating the closing price of the candle. Needed for "Signal" type detections; otherwise, it can take any value or "na".
"Entry" : A float variable indicating the entry price into a trading setup. This is relevant when "DetectionType" is in "Setup" mode. In other scenarios, it can be any number or "na". It denotes the price at which the trade setup is entered.
"TP" (Take Profit): A float that is necessary when "DetectionType" is "Setup" and "SetupData" is "Full". Otherwise, it can be any number or "na". It signifies the price target for taking profits in a trading setup.
"SL" (Stop Loss): A float required when "DetectionType" is "Setup" and "SetupData" is "Full". It can be any number or "na" in other cases. This value represents the price at which a stop loss is set to limit losses.
"Distal" : A float important for "Order Block Signal" detection. It can be any number or "na" if not in use. This variable indicates the price reaching the distal line of an order block.
"Proximal" : A float needed for "Order Block Signal" detection mode. It can take any value or "na" otherwise. It marks the price reaching the proximal line of an order block.
Alarm
Alert on Candle CloseAlert on Candle Close is a simple indicator allowing you to set alerts when a candlestick closes.
Instructions for use
From the chart window, click on "Indicators" and search for "Alert on Candle Close".
Click on "Alert on Candle Close" to add the indicator to your chart. Click on the star icon to add it to your favourites to easily access later.
Set your chart timeframe to the timeframe you wish to alert on. For example, to create an alert when a 4h candlestick closes, set your chart to the "4h" timeframe.
Hover over the "Alert on Candle Close" indicator which has been added to your chart and click the ellipsis "..." icon, then click "Add alert on Alert on Candle Close" or use the keyboard shortcut "Alt+A" from the chart.
In the alert pop-up window, make sure "Condition" is set to "Alert on Candle Close" and "Trigger" is set to "Once Per Bar".
Optionally, you can set a custom expiry for the alert, give the alert a name and customise the alert message. You can configure notification settings from the "Notifications" tab.
Click "Create" and your alert is set up!
Each alert is tied to the timeframe and chart it was created on, so you can change the timeframe or asset and create more alerts by repeating the above process.
Note : this indicator is only designed to work with time-based chart types, such as Bars, Candles or Heikin Ashi. It will not work for non-time charts such as Renko.
FAQs
Why do my alerts sometimes not fire as soon as the candle closes?
This is a limitation with Pine Script's execution model. Indicators are calculated whenever a price or volume change occurs i.e. when a new trade happens. For illiquid or slow moving markets, there may be some time between when a candle closes and the next trade, leading to a delay in the alert triggering. The alert will trigger on the next tick of data on the chart.
Why can't I create more alerts?
TradingView has a limit on the number of active technical alerts you can have based on your membership tier. To configure more alerts, consider upgrading your TradingView plan to a higher tier. See a comparison of TradingView plans at www.tradingview.com
My alert only fired once, how can I get it to keep working?
When configuring the alert in the alert pop-up window, make sure you set "Trigger" to "Once Per Bar" and "Expiration" to "Open-ended alert".
Key Levels (Time Frames - Weekly,Monthly,Quarterly,Yearly)This indicator plots the 4h, Daily, Weekly, Monthly, Quarterly, Yearly Open High, Low and Mids.
You can watch how these institutional trading levels work as support and resistance.
Most Important you can add alerts to these levels with a few clicks.
Just add/remove unnecessary levels for scaling problems.
For any error/suggestion/improvement just let me know.
[Alarm] GetTrendStrategyAll credits to the original strategy creator.
I simply converted it to an alarm to save others some time :)