Skip to content

NearestAlert() Function

By Optuma Team · Updated 2019-11-14

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.

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).

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

Choose which categories of cookies you allow. Strictly-necessary cookies are always on. You can change this any time via the "Cookie Settings" link in the footer.

  • Functional

    Remember preferences like dismissed banners and your dark-mode choice.

  • Analytics

    Help us understand how the site is used so we can improve it.

  • Marketing

    Measure our advertising and help us reach people who may be interested in Optuma.