Hi, I've started learning some MQL4 but I'm running into problems and I can't seem to find a fix.
I'm just trying to use a simple indicator like Williams Percent Range (WPR) to enter and exit trades.
Before a trade is entered, I want it to close any open trades.
The WPR indicator is used to short when price crosses below -20 and long when it crosses above -80. I've put this in the OnTick() section.
Where do I put the close function so that it's not opening and closing trades on every tick?
Attached is my code so far. I don't know if the close function is even correct. Any help is appreciated.
I'm just trying to use a simple indicator like Williams Percent Range (WPR) to enter and exit trades.
Before a trade is entered, I want it to close any open trades.
The WPR indicator is used to short when price crosses below -20 and long when it crosses above -80. I've put this in the OnTick() section.
Where do I put the close function so that it's not opening and closing trades on every tick?
Attached is my code so far. I don't know if the close function is even correct. Any help is appreciated.
Attached File(s)
WPRtest.mq4
3 KB
|
287 downloads