Hi,
First of all, here is the graph
https://www.mql5.com/en/charts
And here the code:
Following my coding, on the 5th of October, a sell should have been triggered. (as kingnow is > 80 and is < to kingprevious)
However, there is no sale. Why? Thanks a lot for your help!
Was the OrderSend() called but failed ? or was the OrderSend() not called ? what were the actual values of kingnow and kingprevious ? did you Print() them ?
Why aren't you doing this ? What are Function return values ? How do I use them ?
Hi,
First of all, here is the graph
https://www.mql5.com/en/charts
And here the code:
Following my coding, on the 5th of October, a sell should have been triggered. (as kingnow is > 80 and is < to kingprevious)
However, there is no sale. Why? Thanks a lot for your help!
Your OrderClose function is garbage
for closing and selecting by position you have to know
if the position you close is from your EA and if the orderType() is the Type you wanna close
now you close trades without knowing what the trade is you do the OrderClose command
Select all your trades one by one with using an orderloop counting down
check every position if it is one you wanna select
then if so you do your orderclose
See this Loops and Closing or Deleting Orders
I don't get your point with orderType? All the trades from the EA are shorts, I just use the EA and closing orders seems to be working fine. (anyways it's a test)
The problem here is not that it's not closing but rather that it's not selling.
@RaptorUK
I looks like there was just nothing called. Those are the orders before and after.
2013.07.16 11:10:28 2012.11.20 00:00 Third test GOLD,Daily: close #29 sell 0.10 GOLD at 1726.03 at price 1730.13
2013.07.16 11:10:26 2012.11.13 00:00 Third test GOLD,Daily: open #29 sell 0.10 GOLD at 1726.03 ok
2013.07.16 11:10:12 2012.09.30 22:01 Third test GOLD,Daily: close #28 sell 0.10 GOLD at 1760.08 at price 1771.05
2013.07.16 11:10:05 2012.09.18 00:00 Third test GOLD,Daily: open #28 sell 0.10 GOLD at 1760.08 ok
... I got it. It was 79.9492 -> no trigger.
For the print function I had tried that in previous code but it never displayed the text on the graph so I just abandoned it.
I just read what you wrote on the other topic... this time from beginning to end. Last time I had stopped reading prematurely. I had thought it was just talking about what a function is returning. My bad. Thanks for the help!
I don't get your point with orderType? All the trades from the EA are shorts, I just use the EA and closing orders seems to be working fine. (anyways it's a test)
The problem here is not that it's not closing but rather that it's not selling.
you haven't done following Loops and Closing or Deleting Orders so you can't know if this is placed on an account
if it selects the right trade So your test might be looking good to you but it keeps garbage the code you are using here
Your Slippage is 3 that is 3 Points on a 5 digit account it will result often in requote price changed
then your trade will not be placed ......
but you have hassold made true
Also NULL is a string !!! .... 0 is what you have to use here for your TP or SL level

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
First of all, here is the graph
https://www.mql5.com/en/charts
And here the code:
Following my coding, on the 5th of October, a sell should have been triggered. (as kingnow is > 80 and is < to kingprevious)
However, there is no sale. Why? Thanks a lot for your help!