Of course, it does, that is what you wrote.
You open with the RSI is below 80 (assuming RSIlevel is 20) | if(RSIvalue[1] > (100 -RSIlevel) && RSIvalue[0] < (100 - RSIlevel) && CountOpenPositions() == 0){ |
On a new bar, the RSI is still below 80 and hasn't reached 20. You close. | if(RSIvalue[1] >= RSIlevel){ ClosePositionBuy(); } |
Use the debugger or print out your variables, including _LastError and prices and find out why. Do you really expect us to debug your code for you?
Code debugging - Developing programs - MetaEditor Help
Error Handling and Logging in MQL5 - MQL5 Articles (2015)
Tracing, Debugging and Structural Analysis of Source Code - MQL5 Articles (2011)
Introduction to MQL5: How to write simple Expert Advisor and Custom Indicator - MQL5 Articles (2010)
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
Of course, it does, that is what you wrote.
You open with the RSI is below 80 (assuming RSIlevel is 20) | |
On a new bar, the RSI is still below 80 and hasn't reached 20. You close. |
Use the debugger or print out your variables, including _LastError and prices and find out why. Do you really expect us to debug your code for you?
Code debugging - Developing programs - MetaEditor Help
Error Handling and Logging in MQL5 - MQL5 Articles (2015)
Tracing, Debugging and Structural Analysis of Source Code - MQL5 Articles (2011)
Introduction to MQL5: How to write simple Expert Advisor and Custom Indicator - MQL5 Articles (2010)
if I delete the if constructor to close buy position, the ea works the same way
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
HI everyone today I coded this ea and it works but I've a problem with the buy positions, when opening a buy positions, the ea close it at the next bar! please help me!