Download MetaTrader 5

When is CheckOpenLong called?

To add comments, please log in or register
Interested in MQL5 features? Find them in documentation!
rik
38
rik 2013.02.21 14:18 

posted this question under General, but this seems like a better place...

I'm creating my first EA following the instructions in MQL5 Wizard: How to Create a Module of Trading Signals

My init function gets called and returns true.  I set a break point in CheckOpenLong but the debugger never breaks there.

Under what conditions is CheckOpenLong called?  I searched the docs and don't see any explanation of it, so I don't know if I'm creating the right conditions for the method to be called.


thanks,
Rik 

MQL5 Wizard: Creating Expert Advisors without Programming
MQL5 Wizard: Creating Expert Advisors without Programming
  • 2011.01.11
  • MetaQuotes Software Corp.
  • www.mql5.com
Do you want to try out a trading strategy while wasting no time for programming? In MQL5 Wizard you can simply select the type of trading signals, add modules of trailing positions and money management - and your work is done! Create your own implementations of modules or order them via the Jobs service - and combine your new modules with existing ones.
phi nuts
2184
phi nuts 2013.02.25 04:49  
rik:

posted this question under General, but this seems like a better place...

I'm creating my first EA following the instructions in MQL5 Wizard: How to Create a Module of Trading Signals

My init function gets called and returns true.  I set a break point in CheckOpenLong but the debugger never breaks there.

Under what conditions is CheckOpenLong called?  I searched the docs and don't see any explanation of it, so I don't know if I'm creating the right conditions for the method to be called.


thanks,
Rik 

Have you ever try to set the breakpoint at the end of CheckOpenLong() ?
rik
38
rik 2013.02.26 12:24  
phi.nuts:
Have you ever try to set the breakpoint at the end of CheckOpenLong() ?

I didn't try that but thanks for responding. Long story short, this is what I get for trying to use someone else's code from a tutorial, where I didn't understand what the effect of the trading threshold parameter was. The fuller explanation follows, maybe it will help others...

When the program started, the value of the trading threshold input parameter was set to 10, which seemed fine, so I never changed it.  But internally one of the super classes was calling a method to get "direction", which was coming back 0.  0 doesn't exceed the threshold of 10, so my own CheckOpenLong method was not called in that case.  So I gather I have to write my own Direction method to overcome this.  I have just discovered this in the last 10 minutes, so haven't fully tested whether setting the threshold lower or making direction return a larger value will fix it, but at least I can see that the debugger steps to all those places, so I think I will fix this without much more trouble.

Thanks to the developers for a pretty good debugger.  Now if anyone can tell me how to launch it from MT5 and not from the meta editor, that would be better.  Then I could drop it onto the chart I want instead of it popping up a new chart based on (apparently) the top symbol in the market watch window.  I hope that's clear.  In other words, when I start the debugger from the meta editor, it doesn't know which chart I want to use, so it pops up a new one using whatever's at the top of the market watch list.  Instead, I would like to drop the EA onto an existing chart and have it start up in debug mode, if that's possible.  (I didn't make that link to the left.  I just checked where that goes and can't say it pertains to this discussion.)

phi nuts
2184
phi nuts 2013.02.26 15:02  
rik:

I didn't try that but thanks for responding. Long story short, this is what I get for trying to use someone else's code from a tutorial, where I didn't understand what the effect of the trading threshold parameter was. The fuller explanation follows, maybe it will help others...

When the program started, the value of the trading threshold input parameter was set to 10, which seemed fine, so I never changed it.  But internally one of the super classes was calling a method to get "direction", which was coming back 0.  0 doesn't exceed the threshold of 10, so my own CheckOpenLong method was not called in that case.  So I gather I have to write my own Direction method to overcome this.  I have just discovered this in the last 10 minutes, so haven't fully tested whether setting the threshold lower or making direction return a larger value will fix it, but at least I can see that the debugger steps to all those places, so I think I will fix this without much more trouble.

Thanks to the developers for a pretty good debugger.  Now if anyone can tell me how to launch it from MT5 and not from the meta editor, that would be better.  Then I could drop it onto the chart I want instead of it popping up a new chart based on (apparently) the top symbol in the market watch window.  I hope that's clear.  In other words, when I start the debugger from the meta editor, it doesn't know which chart I want to use, so it pops up a new one using whatever's at the top of the market watch list.  Instead, I would like to drop the EA onto an existing chart and have it start up in debug mode, if that's possible.  (I didn't make that link to the left.  I just checked where that goes and can't say it pertains to this discussion.)

About debug symbol, press F1 to open help file and search for debug - there's plenty interesting stuff there  about debug, or click tool menu in MetaEditor > select Option > and click debug tab.
To add comments, please log in or register