I want to create an indicator with 5 conditions if 3 or more are true than plot 1 else plot 0. This is what I have so far but It does not work. Please advise
protected override void OnBarUpdate()
{
// Use this method for calculating your indicator values. Assign a value to each
// plot below by replacing 'Close[0]' with your own formula.
int Strat1 = 0;
int Strat2 = 0;
int Strat3 = 0;
int Strat4 = 0;
int Strat5 = 0;
// Condition set 1
if (Close[0] >= Open[0])
{
Strat1 = 1;
}
if (Close[0] >= EMA(20)[0])
{
Strat2 = 1;
}
if (Rising(RVI(21)))
{
Strat3 = 1;
}
if (Close[0] >= EMA(25)[0])
{
Strat4 = 1;
}
if (Stochastics(7, 14, 3).D[0] >= 20)
{
Strat5 = 1;
}
if ((Strat1 + Strat2 + Strat3 + Strat4 + Strat5>=3))
Plot0.Set(1);
else
{
Plot0.Set(0);
}


Comment