Even probably this code is not much used, I'm reporting this day zero bug for completeness, in case MQ wants to correct it.
Williams' %R oscillator (WPR) is in many way similar to RSI, with upper and lower ranges for detecting overbought and oversold price action. The theory is that one could look at reversals inthese areas only to form trading decisions.
However, due to what I believe is a bug of distraction, the code looks insteadoutside these areas:
MQL5\Include\Expert\Signal\SignalWPR.mqh
int CSignalWPR::LongCondition(void)
...
//--- if the model 1 is used, search for a reverse of the oscillator upwards behind the level of oversellingif(IS_PATTERN_USAGE(1) && Diff(idx+1)<0.0 && WPR(idx+1)>-80.0)
result=m_pattern_1; // signal number 1
...
int CSignalWPR::ShortCondition(void)
...
//--- if the model 1 is used, search for a reverse of the oscillator downwards behind the level of overbuyingif(IS_PATTERN_USAGE(1) && Diff(idx+1)>0.0 && WPR(idx+1)<-20.0)
result=m_pattern_1; // signal number 1
In both the if() statements, the WPR value check is done in error, as it should uselessinstead ofgreater, and viceversa. Which cause the condition to be valid only when a reversal happens outside the range of oversold/overbought, that is, in the non decisive area. Just flip the chevrons around to get what Larry Williams wanted to convey. It could have been caused by the peculiar negative scale of the oscillator as originally developed, which goes from 0 to -100, although the documentation duly notes this. In fact, the almost identically coded SignalRSI.mqh works fine, no surprise, as it uses a positive scale of 0 to +100.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Even probably this code is not much used, I'm reporting this day zero bug for completeness, in case MQ wants to correct it.
Williams' %R oscillator (WPR) is in many way similar to RSI, with upper and lower ranges for detecting overbought and oversold price action. The theory is that one could look at reversals in these areas only to form trading decisions.
However, due to what I believe is a bug of distraction, the code looks instead outside these areas:
In both the if() statements, the WPR value check is done in error, as it should use less instead of greater, and viceversa.
Which cause the condition to be valid only when a reversal happens outside the range of oversold/overbought, that is, in the non decisive area. Just flip the chevrons around to get what Larry Williams wanted to convey.
It could have been caused by the peculiar negative scale of the oscillator as originally developed, which goes from 0 to -100, although the documentation duly notes this. In fact, the almost identically coded SignalRSI.mqh works fine, no surprise, as it uses a positive scale of 0 to +100.