I have confirmed that the path is valid by calling the PlaySound function on each OnBarUpdate and the sound was played.
Problem is that when the condition to play sound is met the sound is not playing. There are other indicators on the chart which should play sound on the same condition. When this problematic indicator is present the other sounds won't play. When it is removed they will play.
Indicator draws dot and its color is changing according to the same condition which should play sound. Color changes correctly so I assume sound should be played as well.
There are no errors logged in the Log tab in NT.
Please see attached code. (Of course the variable EnableSoundAlerts is set to true)
protected override void OnBarUpdate()
{
if (w1[0] < w2[0] && w2[0] < w3[0] && w3[0] < w4[0] && w4[0] < w5[0])
{
alignmentUp = true;
brush = AlignmentUpColor;
}
else
{
alignmentUp = false;
}
if (w1[0] > w2[0] && w2[0] > w3[0] && w3[0] > w4[0] && w4[0] > w5[0])
{
alignmentDown = true;
brush = AlignmentDownColor;
}
else
{
alignmentDown = false;
}
if (alignmentUp != alignmentUpPrev)
{
if (EnableSoundAlerts)
{
DebugPrint("PlaySound");
PlaySound(SoundAlertFile);
}
}
if (alignmentDown != alignmentDownPrev)
{
if (EnableSoundAlerts)
{
DebugPrint("PlaySound");
PlaySound(SoundAlertFile);
}
}
alignmentUpPrev = alignmentUp;
alignmentDownPrev = alignmentDown;
}
Thanks in advance

Comment