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
Not real time.
Thank you for the info. I was not aware that "OrderClosePrice()" was buffered. So I guess that neither "OrderClosePrice()" nor the "Ask"/"Bid" is the ideal real-time solution.
However, do you agree that "OrderClosePrice()" is a better overall solution than the use of "Ask"/"Bid" after the "OrderSelect()" is made?
And for a Real-time solution, if it is indeed needed, then I guess we can fallback on the alternatives:
Why are you trying to invent the wheel again?
Look here - you'll find everything you need.
If not start amending its source code.
Thank you for Everyone's help so far. I think I have now resolved the error 130 issue, but there is something seriously wrong with my OrderSelect function, which is most likely why it only sometimes modify some of the orders. Below is a list of things that I printed. The OrderTicket # is completely wrong. That ticket number belong to a trade I have open for the EURAUD. While I did not include all the results, there are actually multiple Pairs where the OrderTicket numbers are not corresponding with the pair in the trade terminal.
Will someone please have a look and let me know what's wrong with OrderSelect? Thank you
2016.04.18 16:04:38.602 Trailing_v19 EURUSD,M15: ticket = 0 I think that ticket should print the same value as OrdersTotal, so it appears that my counter doesn't work.
2016.04.18 16:04:38.602 Trailing_v19 EURUSD,M15: OrderSelect = true
2016.04.18 16:04:38.602 Trailing_v19 EURUSD,M15: OrdersTotal = 11
2016.04.18 16:04:38.202 Trailing_v19 EURUSD,M15: Selectbypos = 0
2016.04.18 16:04:38.202 Trailing_v19 EURUSD,M15: Selectbyticket = 1
2016.04.18 16:04:38.202 Trailing_v19 EURUSD,M15: OrderTicket = 50213357
Hi Everyone. Thank you for all the help. I found the mistake and the issues have been resolved. Since I do not use a Stoploss, the value of OrderStopLoss() is always 0. This is not a problem when modifying the buy order because 0 is always less than Bid-TrailingStop*Pip. But with the sell order 0 can never be more than Ask+Trailingstop*Pip. So I had to add the or(|| OrderStopLoss()) to this line:
Thank you very much for the help. Yes, there is definitely an issue with OrderSelect because it only works on some charts. The other problem is that I cannot include a MagicNumber because the trades are placed manually. I used the portion of the code that I think is relevant, but I cannot get it to compile. It shows this error:
'MySelect' - function can be declared only in the global scope Trailing_v26.mq4 31 13
and line 31 is this one:
Here is the whole EA:
Yes, there is definitely an issue with OrderSelect because it only works on some charts. The other problem is that I cannot include a MagicNumber because the trades are placed manually. I used the portion of the code that I think is relevant, but I cannot get it to compile.
I gave you a perfectly good skeleton code on which to build on, which fixes your problems and even listed them prior to that, yet you choose to ignore it and continue to struggle wondering why your code is not doing what you want!
Why? Do you want your code not to work? Use the example and test it yourself!