NinjaScript > Language Reference > Alert & Debug >

Alert()

Print this Topic Previous pageReturn to chapter overviewNext page

Definition

Generates a visual/audible alert for the Alerts window.

 

Syntax

Alert(string id, Priority priority, string message, string soundLocation, int rearmSeconds, Color backColor, Color foreColor)

 

* Calls to this method are ignored on historical data, it will only work in real-time.

 

Parameters

id

A unique id for this alert

priority

Any one of the following values:
 
NinjaTrader.Cbi.Priority.High

NinjaTrader.Cbi.Priority.Low

NinjaTrader.Cbi.Priority.Medium

message

Alert message

soundLocation

File name of .wav file to play. Provide either the absolute file path or just the name if the file is located in C:\Program Files\NinjaTrader Installation Folder\sounds folder

rearmSeconds

Sets the number of seconds an alert will rearm. If the same alert (identified by the id parameter) is called within a time window of the time of last alert + rearmSeconds, the alert will be ignored.

backColor

The alert row back color (reference)

foreColor

The alert row fore color (reference)

 

 

Examples

// Generates an alert
Alert("myAlert", NinjaTrader.Cbi.Priority.High, "Reached threshold", "Alert1.wav", 10, Color.Black, Color.Yellow);