![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
:) In programming the Williams %R to buy/sell when it crosses the trigger line, I am having a problem with the fact that on a H1 chart, The Williams % R value may dip down below/above the trigger line for a split second, trigger the order, and then immediatley come back above/below the trigger line. How do I program the EA so that it doesn't signal an order until the Williams CLOSES above/below trigger line?
Here's the piece of code for a buy signal
williamsrcurrent = iWPR (NULL, 0, 50, 0);
williamsrprevious = iWPR (NULL, 0, 50, 1);
isBuying = (williamsrprevious < -80 && williamsrcurrent > -80);
Thanks folks :)
Pat