So I created the If-instructions to select the Priceposition near the Bands.
The If-instructions are not working and I don´t know why.
I would be glad if someone can help me.
I have here my cod -- OnBarUpdate:
protected override void OnBarUpdate()
{
double smaValue = SMA(Period)[18];
double stdDevValue = StdDev(Period)[0];
Upper.Set(smaValue + NumStdDev * stdDevValue);
Middle.Set(smaValue);
Lower.Set(smaValue - NumStdDev * stdDevValue);
if (Close[0] >= (smaValue + NumStdDev * stdDevValue))
{
Value.Set(1); // to be green in Market Analyzer
}
else if (Close[0] <= (smaValue - NumStdDev * stdDevValue))
{
Value.Set(2); // to be red in Market Analyzer
}
else if (Close[0] >= smaValue)
{
Value.Set(3); // to be dark green in Market Analyzer
}
else if (Close[0] <= smaValue)
{
Value.Set(4); // to be dark red in Market Analyzer
}
else Value.Set(5);
// Alert("myAlert", NinjaTrader.Cbi.Priority.High, "Reached threshold", "Alert1.wav", 10, Color.Black, Color.Yellow);
}
For reply many thanks.

Comment