bool HTFOn = true;
if(Close[0] > SMA(20)[0])
{
//if prev. bar HTF 20 SMA is greater than/equal to TTF 20 SMA, and Curr. bar HTF 20 SMA is less than TTF 20 SMA, and bool HTFOn is equal to true
if(SMA(BarsArray[1],20)[1] >= SMA(20)[1] && SMA(BarsArray[1],20)[0] < SMA(20)[0] && HTFOn == true)
{
PlaySound(NinjaTrader.Core.Globals.InstallDir + @"\sounds\Alert1.wav");
}
}
In this scenario, the alert will keep beeping for every TTF candle close until there's a new HTF candle close.
I would have to manually go into the indicator parameters and set the boolean varible to false.
Is there another way of coding this where it will only alert me once in this scenario?

Comment