Adding a price alert quickly
If you need to add a price alert from the chart, the most efficient way is to do it with a script like this.
$MYSYMB=$MONTAGE.SYMB;
$MYALERT=NewAlertObj();
$MYALERT.name="Price Reached";
if($MONTAGE.PRICE<$MONTAGE.LAST)
{
$MYALERT.AddItem("Last Sale","<",$MONTAGE.PRICE);
}
else
{
$MYALERT.AddItem("Last Sale",">",$MONTAGE.PRICE);
}
$MYALERT.Speak=1;
$MYALERT.SYMB=$MYSYMB;
$MYALERT.PlaySound=0;
$MYALERT.Autodelete=1;
$MYALERT.Loop=0;
$MYALERT.save();It can be a hotkey, a hot button or a window button and it will create an alert like this.

We can tune the needs for autodelete or speak by changing the 1 to 0 in the corresponding lines as needed.
Usage
Just click to the chart and press the hotkey/hot button.
It automatically detects if the price you clicked is above or below the current price and will create a corresponding alert.
The alert will delete itself once triggered, so no need to do cleanup. For more visibility, keep your Alert & Trigger window opened.
That is just a simple price alert. With the usage of the script field in the alert we can use the alerts for various useful things like
- monitoring custom variables
-like a value of an indicator or any calculated variable - calling existing hotkeys
-like exit a position or take a partial - calling external programs
-like powershell script on your pc - monitor for price action events
-like price crossing a moving average - play a sound or read a text
I will be covering the above use cases in future posts
Delete single alert by a script
to delete one script by its name we can use the GetAlertObj() function like this:
GetAlertObj("Price Reached").delete();
which will delete the last created alert.
To delete all alerts with the same name we can repeat the same command maximum 199 times in a "while loop" script like this
$loop=10;
while ($loop>0)
{
$TODELALERT=GetAlertObj("Price Reached");
if (IsObj($TODELALERT))
{
$TODELALERT.delete();
}
$loop=$loop-1;
}The number 10 means I want to do 10 loops because I am not expecting more than 10 alerts with that name.
For more advanced scripting, You can visit my substack - Peter's Substack where I elaborate on newest features, ideas and do custom solutions for specific needs.
Author: PeterB
Disclosure Statement 1. Hotkey scripts should always be thoroughly tested in a paper trading environment prior to any live deployment. Guardian Trading assumes no responsibility for errors, malfunctions, or financial losses arising from the use, misuse, or modification of custom hotkey configurations. Traders are solely responsible for the creation, testing, and implementation of their own scripts.This guide is provided for informational and educational purposes only and does not constitute trading advice or an endorsement of any specific configuration. The examples herein are illustrative in nature and should not be copied, replicated, or relied upon without independent verification and testing. Use of this material constitutes acknowledgment and acceptance of these terms.
2. No information provided by Velocity Clearing, LLC (“Velocity” or the “Firm”), directly or indirectly, should be considered a recommendation or solicitation to adopt any particular trading or investment strategy or to invest in, or liquidate, a particular security or type of security. Information provided by Velocity on its Twitter, Facebook or Blog pages is for informational and educational purposes only and is not intended as a recommendation of any particular security, transaction or strategy. Commentary and opinions expressed are those of the author/speaker and not necessarily those of the Firm. Velocity does not guarantee the accuracy of, or endorse, the statements of any third party, including guest speakers or authors of commentary or news articles. All information regarding the likelihood of potential future investment outcomes are hypothetical. Future results are never guaranteed. Any examples that discuss potential trading profits or losses may not take into account trading commissions or fees, which means that potential profits could be lower and potential losses could be greater than illustrated in any example. Users are solely responsible for making their own, independent decisions about whether to use any of the research, tools or information provided, and for determining their own trading and investment strategies.

