What is the point of this loop?
for (int b=2; b<=10; b++) { if (c) break; }
It does nothing!
for (int b=2; b<=10; b++) { if (c) break; } /* b begin number canldes 2 b<=10 is number max candles b++ increase if (c) break; condition to be searched */I thought I had understood the cycle could you give me a help please!
I thought I had understood the cycle could you give me a help please!
I can't help because I have no idea what you are hoping to achieve.
IF c is true, the for loop is broken and does nothing
If c is false the loop runs full cycle and does nothing.
2 possibilities and both possibilities means that it is code that executes and achieves nothing.
The first time that c is true, I go out of the loop and I visualize the buffer.
I do not understand my mistake ... I apologize.
bool c= iMA(NULL, PERIOD_CURRENT, 5, 0, MODE_SMA, PRICE_CLOSE, 2+i) > iMA(NULL, PERIOD_CURRENT, 30, 0, MODE_SMA, PRICE_CLOSE, 2+i) && iMA(NULL, PERIOD_CURRENT, 5, 0, MODE_SMA, PRICE_CLOSE, 1+i) < iMA(NULL, PERIOD_CURRENT, 30, 0, MODE_SMA, PRICE_CLOSE, 1+i); //Indicator Buffer 1 if(Open [1+i] < iMA(NULL, PERIOD_CURRENT, 30, 0, MODE_SMA, PRICE_CLOSE, 1+i) && Close[1+i] > iMA(NULL, PERIOD_CURRENT, 30, 0, MODE_SMA, PRICE_CLOSE, 1+i)) // 1° step, Cross Candle in the Moving average for (int b=2; b<=10; b++) // 2° step, count the candles up to 10 and if "c" is true I get out of the loop { if (c) break; } { Buffer1[i] = High[i] + 1 * myPoint; // 3° step Display the buffer in the graph
Candle 1: cross the candle on the moving average 30
the next step is to search through the cycle for loop of the cross moving average 5 on the 30... end of the code that return buffer1 in the graph
I need to continue with the code when the "c" condition is true.
help me please
for (int b=2; b<=10; b++) // 2° step, count the candles up to 10 and if "c" is true I get out of the loop { if (c) break; }
You don't need to continue - the code does nothing. If c is true, then exit the loop. otherwise the for loop continues incrementing until b is 11 and the loop exits. Nothing.
Delete the for/if/break.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
With the for loop, I have to try the first cross of the Moving Average 5 on 50 by 9 candles and when the cross was found, I get out of the loop and finish with buffer 1
The code does not error but does not work as I have studied.
How could I solve?
Thank you all for your patience and help.