Joze Silc:
Hello
Is it possible to set a conditional stop in MQL5? For example if Variable1==true
How?
BR
Joze
Yes, that is possible.
Basically, you call the function DebugBreak(), and you can do so with an if-statement.
There are debug helper libraries available in code base, they support some sophisticated debug stuff that comes in handy when developing code.
Dominik Egert #:
Yes, that is possible.
Basically, you call the function DebugBreak(), and you can do so with an if-statement.
There are debug helper libraries available in code base, they support some sophisticated debug stuff that comes in handy when developing code.
I have for example over 100x in code this statement:
PREDICTION=+1
Why must I set breakpoint over 100 times instead "somewhere" set only one condition: if PREDICTION==+1 then stop running my code .....
?!
You did not explain yourself properly in your posts. Please explain in detail.
What is it that you want to "stop"?
- Do you want to halt execution in the debugger?
- Do you want to return from the event handler?
- Do you want to stop and remove the program from the chart?
Explain in detail what it is you want to achieve. Show example code if necessary?
Joze Silc:
Hello
Is it possible to set a conditional stop in MQL5? For example if Variable1==true
How?
As explained in post #1 by @Dominik Egert
if( Variable1 ) DebugBreak();
Here is the example code from the documentation: Documentation on MQL5: Common Functions / DebugBreak
//+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { //--- compile the file using F5 //--- in debugging mode, if i == j, stop at the DebugBreak() string for(int i=0,j=20; i<20; i++,j--) { if(i==j) DebugBreak(); } }

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
Hello
Is it possible to set a conditional stop in MQL5? For example if Variable1==true
How?
BR
Joze