NearestAlert() Function
Overview
Introduced in the Optuma v1.5 update the NearestAlert()
function allows you to reference the closest alert you have set for a code in either direction (higher / lower).
This can be used (for example) in scans to find where alerts are within a specific range of the closing price, or display the proximity the close is to the nearest alert as a Watchlist column.
Properties
Alert Position: Allows you to select whether the script references the closest higher alert (Price Crosses Above) or the closest lower alert (Price Crosses Below).
Time Frame: Allows you to overwrite the underlying chart / scan / watchlist time frame and use a different one (Weekly, Monthly ,etc).
Examples
The Closing prices proximity to the closest higher alert displayed as a custom column on a watchlist.
NEARESTALERT() - CLOSE()
The range (as a percentage) between the current closing price and the nearest lower alert displayed as a Chart Element value:
P1 = CLOSE() ;
P2 = NEARESTALERT(TYPE=Lower);
ABS(P2-P1) /P1**