Dislikedjust added break; in one more place. Originally it was not needed there, as the code was made to be in one loop only, but now because there is a second loop it is needed to stop the second loop. int minGrn=3; // (changed) int MAStrSf=0; int MAEndSf = 0; int cnGrn=0; bool checkStart=false; bool signalFound=false; for(int i=1; i<=600; i++) { double MA0=iMA(symbol,5,5,0,3,0,i), MA1=iMA(symbol,5,5,0,3,0,i+1); double MA2=iMA(symbol,5,5,0,3,0,i+2), MA3=iMA(symbol,5,5,0,3,0,i+3); if(!checkStart){ if(MA0>MA1 && MA1<=MA2 && MA2<=MA3) { MAStrSf=i; // MA 2-drop...Ignored
It is weekend now, only crypto BTCUSD is live, just tested your codes. Crypto is in bear trend now and with 600 bars, I managed to get a complete bull set-up at shift 288 (MAStrSf) and shift 280 (MAEndSf).
Currently, the codes are giving "0" output, means it does NOT keep on looking the complete set-up from bar1 to bar 600, yet wrong somewhere in the codes, kindly help to relook into the codes again. Thanks