double slowerMAafter=iMA(NULL,0,100,0,MODE_SMA,PRICE_MEDIAN,-1);
Bogus call.- Drop all your "after" things. The comparison of now vs after will be done only once, on the first tick of bar zero, and they will essentially be the same so your comparison is bogus.
- Now is i, previous is i+1. Don't just set your buffer[i], you must unset it (EMPTY_VALUE) if the condition becomes false for bar zero.
- Do your lookbacks correctly.
- Are your books one column but two feet wide? No because that is unreadable. They are 6 inches, sometimes two columns, so you can read it easily. So should be your code. I'm not going to go scrolling (or moving my eyes) back and forth trying to read it.
- Write self documenting code
// if((fasterMAnow>slowerMAnow && fasterMAprevious<=slowerMAprevious && fasterMAafter>slowerMAafter && mediumMAnow>slowerMAnow) // || (fasterMAnow>slowerMAnow && mediumMAnow>slowerMAnow && mediumMAprevious<=slowerMAprevious && mediumMAafter>slowerMAafter)) bool isFastUp = fasterMAnow>slowerMAnow; bool wasFastUp = fasterMAprevious>slowerMAprevious; bool fastCrossed = isFastUp && !wasFastUp; bool isMediUp = mediumMAnow>slowerMAnow; bool wasMediUp = mediumMAprevious>slowerMAprevious; bool mediCrossed = isMediUp && !wasMediUp; if(isFastUp && isMediUp && (fastCrossed || mediCrossed) ) ...
Hi!
double slowerMAafter=iMA(NULL,0,100,0,MODE_SMA,PRICE_MEDIAN,-1);
Shall ther be an additional i.
Split your if statement into simpler statements to find your error.
thanks guys will take your helpful comments on board :)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi, I hope some one can help fix the coding error here? It draws the green up arrow OK but not the red a down arrow.
I need a fresh pair of eyes to fix the fault!! Hope some one can solve the riddle THANKS