Grid stop order management function - page 2 12 New comment Jonathan Olalekan Toyese 2023.12.14 06:59 #11 William Roeder #: 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) Your code Simplified For a new bar test, Bars is unreliable (a refresh/reconnect can change number of bars on chart), volume is unreliable (miss ticks), Price is unreliable (duplicate prices and The == operand. - MQL4 programming forum.) Always use time. MT4: New candle - MQL4 programming forum #3 (2014) MT5: Accessing variables - MQL4 programming forum #3 (2022) I disagree with making a new bar function, because it can only be called once per tick (second call returns false). A variable can be tested multiple times. Running EA once at the start of each bar - MQL4 programming forum (2011) The if statement is unnecessary. Your looking at history. That has nothing to do with checking for open orders. MT4: You can not use any Trade Functions until you first select an order. Thanks so much, I will work on it and get back. Much appreciated your efforts. 12 New comment
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)
For a new bar test, Bars is unreliable (a refresh/reconnect can change number of bars on chart), volume is unreliable (miss ticks), Price is unreliable (duplicate prices and The == operand. - MQL4 programming forum.) Always use time.
MT4: New candle - MQL4 programming forum #3 (2014)
MT5: Accessing variables - MQL4 programming forum #3 (2022)
I disagree with making a new bar function, because it can only be called once per tick (second call returns false). A variable can be tested multiple times.
Running EA once at the start of each bar - MQL4 programming forum (2011)
The if statement is unnecessary.
MT4: You can not use any Trade Functions until you first select an order.