I wrote this simple indicator to throw an alert and play a sound file. It does throw an alert to alert window but is not playing sound file. I put the wav file in the sounds folder under "C:\Program Files (x86)\NinjaTrader 7\sounds". It's for the Combined Put Call Ratio ^VRCT.Z chart I have. I did not cut and paste the entire Indciator Any help will be greatly appreciated.
Thank you.
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
///<summary>
/// PCR Alert above 1 and below 0.6 throws an alerts both with audio.
///</summary>
[Description("PCR Alert above 1 and below 0.6 throws an alerts both with audio. ")]
publicclass PCRalert : Indicator
{
#region Variables
// Wizard generated variables
// User defined variables (add any user defined variables below)
#endregion
///<summary>
/// This method is used to configure the indicator and is called once before any bar data is loaded.
///</summary>
protectedoverridevoid Initialize()
{
Overlay = true;
CalculateOnBarClose =false;
}
///<summary>
/// Called on each bar update event (incoming tick)
///</summary>
protectedoverridevoid OnBarUpdate()
{
// Use this method for calculating your indicator values. Assign a value to each
// plot below by replacing 'Close[0]' with your own formula.
if (Close[0]>1)
{
// Generates an alert
Alert("PCRabove1", NinjaTrader.Cbi.Priority.High, "PCR above 1", "PCR above1.wav", 30, Color.Green, Color.Black);
}
elseif (Close[0]<0.6)
{
// Generates an alert
Alert("PCRbelow0.6", NinjaTrader.Cbi.Priority.High, "PCR below 0.6", "PCR below0.6.wav", 30, Color.Red, Color.Black);
}
}

Comment