In future please post in the correct section
I will move your topic to the MQL4 and Metatrader 4 section.
Keith Watford:
I am sorry, I didn't notice it. I will be careful from now on. Thank you.
In future please post in the correct section
I will move your topic to the MQL4 and Metatrader 4 section.
-
if(rates_total<2*sMA-2|| rates_total<2*bMA-2|| rates_total<2*rSI-2) return(0); int limit; if(prev_calculated==0) limit=0; else limit=prev_calculated-1;
Your look back is the maximum of sMA, bMA and rSI+1. Limit=0 and limit=prev_calculated is bogus.
How to do your lookbacks correctly. - You want only the first one, but your test is for both at the same time. When the MAs cross, set your boolean to false. Only when the boolean is false do you test RSI. When you find the retracement, mark it and set your boolean to true.
- You need to remember the results. Your boolean must be static.
- You are looking at short above long. Look for a cross.
double aPrev = …, aCurr = …, bPrev = …, bCurr = …; bool wasUp = aPrev > bPrev, isUp = aCurr > bCurr, isCross = isUp != wasUp;
-
bool rsibool = 0; rsibool = 1; rsibool = 2;
True is non-zero. Why are you using ints? There is no difference between the two assignments.
William Roeder:
Thank you so much, William!- Your look back is the maximum of sMA, bMA and rSI+1. Limit=0 and limit=prev_calculated is
bogus.
How to do your lookbacks correctly. - You want only the first one, but your test is for both at the same time. When the MAs cross, set your boolean to false. Only when the boolean is false do you test RSI. When you find the retracement, mark it and set your boolean to true.
- You need to remember the results. Your boolean must be static.
- You are looking at short above long. Look for a cross.
- True is non-zero. Why are you using ints? There is no difference between the two assignments.
I am a complete newbie. You don't know how much valuable and help I have received from your comment. I will do it again and increase my understanding.
Thank you so much again :)
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
For eg, if 50 ema goes above 100 EMA and RSI level crosses above 30, it should show arrow. Only the first RSI signal aka first retracement. It should ignore other ones. What am i doing wrong?