I'm trying to create an indicator to count some occurrencies and print them in the output window.
Let's say I want to count how many times Close is above a Moving Average that could loop from 10 to 20 periods.
For any of them, the code must return the number of occurrencies.
My output should look like:
EMA 10 = xxxx
EMA 11 = yyyy
EMA 12 = zzzz
.........
EMA 20 = wwww
I'm doing something like:
int OccFound = 0;
for (int x = 10; x < 19; x++)
{
if (Close[0] > EMA(x))
{
OccFound = OccFound + 1;
}
Print("EMA "+x+" # "+OccFound);
}
Thanks.


Comment