Hi everybody,
I need help to solve a little problem; I did create this simple code
I don't know how to get the 2 variables upsum and dnsum calculated having to change the "Candles" parameter without change the formula all the time... I suppose that I'll have to use an array but my mq4 knowledge is not so deep...


Your help will be really appreciated...
Best Regards
I need help to solve a little problem; I did create this simple code
PHP Code
int start() { int Candles = 4; int dig = MarketInfo(Symbol(), MODE_DIGITS); int modifier = 1; if(dig == 3 || dig == 5) modifier = 10; double factor = Point * modifier; for(int i = 0; i <= Candles; i++) { if(Close[i] >= Open[i]) {Up[i] = (High[i] - Close[i]); Dn[i] = (Open[i] - Low[i]);} if(Close[i] < Open[i]) {Up[i] = (High[i] - Open[i]); Dn[i] = (Close[i] - Low[i]);} } double upsum = (Up[0] + Up[1] + Up[2] + Up[3] + Up[4]) / factor; double dnsum = (Dn[0] + Dn[1] + Dn[2] + Dn[3] + Dn[4]) / factor; double bullpower = dnsum/upsum; double bearpower = upsum/dnsum;
Your help will be really appreciated...
Best Regards
brax64