BarrowBoy wrote >>
KM
One definite problem - your values for OrderType are wrong - see https://docs.mql4.com/constants/trading
I would check for a trend change - if it has occurred, then loop through orders to see if they are pending, i.e OrderType() > 1
and then close them
FWIW
-BB-
Hey BB
You are !00% right, I need to rely less on my faulty memory and check all aspects of problem. That was the problem.
Many thanks
Keith
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
Hi all
This bit of code code checks to see if the market trend has changed and if there is a pending order and if so it deletes the pending order.
When I run it in the tester I get:2008.06.21 01:20:51 2008.05.15 21:59 INSIDEBARGBPYEN GBPJPY,H1: OrderDelete error 4108
2008.06.21 01:20:51 2008.05.15 21:59 INSIDEBARGBPYEN GBPJPY,H1: unknown ticket 39 for OrderDelete function.
The 2 digit ticket number 39 occurs because, I think, that the testerjust assigns numbers from 1 on up to track what is going on, but these numbers of course do not have the properties of the real time ticket numbers. So my questions are, is my theory correct that the problems stem from the fact that the the tester numbers do not have the same format as real time trades or is there an error in the code?
If so, any ideas for a work around for this?
The routine works otherwise, the calls to delete are valid and appropriate,the ticket numbers do represent pending orders which need to be cancelled.
I have it running in real time but on a 1 hour chart this situation may not occur for several days, so I'd like to be able to run it in tester and get it fixed.
As always, thoughts, ideas, sugggestions, correct solutions, all deeply appreciated!
Keith