- Since ticket is an int, not a static int, it won't be valid on the next tick
- Did you check that the orderSend worked? Ask-10 is a negative number on most pairs. Did you mean Bid - 10*pips2dbl? You open a buy at the Ask, the stops are relative to the Bid.
- OrderClose (,, 10, Bid .. won't be valid generally If you do an OrderSelect first you can OrderClose( OrderTicket(), OrderLots(), OrderClosePrice(), ...
- Your orderSend won't work on ECN broker and isn't adjusting for 4/5 digit brokers
- Post ALL the code - No mind readers here.
Thank you for your answer. Well, there isn't any code yet, I'm trying some things, just to check if I'm able to do something big ;) I just didn't manage to close a position.
1. I'll have to check that
2. Yes, I did. The parameters are not from my tests, just to make sure you see I filled every parameter ;)
3. What do you mean with that? Sorry, I'm not native English speaking, and I'm not sure where I should insert the commas here ;)
- ... You open a buy at the Ask, the stops are relative to the Bid.
What I found now: The order is executed, I also see the line and the arrows on the chart. But it looks like the ticket variable is "0".
Does this information help a bit more?
Now I noticed something very interesting! The very first time I receive ticket=0; but only with the very first trade. The second trade gets the ticket 2. So ticket 1 is never issued. How is this possible?
Well i could check and check if ticket is 0 and change it to 1, but you see that this isn't the correct solution :D
This is an interesting comment. I have seen Raptor do the same thing. If the stop is how much you are willing to lose on the trade, as in "I am willing to lose 10 pips on this trade", then I would argue that you should use Ask throughout the Buy OrderSend. Otherwise you lose the 10 pips (of the stop) plus the spread on a bad trade. Now obviously you can change the stop to take into account the spread but that seems a more complicated way of doing it to my mind.
This is an interesting comment. I have seen Raptor do the same thing. If the stop is how much you are willing to lose on the trade, as in "I am willing to lose 10 pips on this trade", then I would argue that you should use Ask throughout the Buy OrderSend. Otherwise you lose the 10 pips (of the stop) plus the spread on a bad trade. Now obviously you can change the stop to take into account the spread but that seems a more complicated way of doing it to my mind.
If the spread becomes more than 10 pips (your example) the OrderSend/OrderModify fails.
If you want the stop near MarketInfo(chart.symbol, MODE_STOPLEVEL) then you have to subtract the spread or it fails.
Yes you can think about it your way but then 10 pips is a variable stop on variable spread brokers and fixed stop on fixed spread broker. Shouldn't it be the same for all orders?
Now I noticed something very interesting! The very first time I receive ticket=0; but only with the very first trade. The second trade gets the ticket 2. So ticket 1 is never issued. How is this possible?
Well i could check and check if ticket is 0 and change it to 1, but you see that this isn't the correct solution :D
WHRoeder:
Yes you can think about it your way but then 10 pips is a variable stop on variable spread brokers and fixed stop on fixed spread broker. Shouldn't it be the same for all orders?
As usual I think about the problem backwards compared to you and Raptor -apparently :-(
"My way", when setting a 10 pip stop and trading $10/pip (in terms of lotsize) you would always see a loss of $100 (not counting swap and commission) regardless of the spread. Obviously it makes no difference in the great scheme of things because we would all be back test using whatever stop-setting method was encoded in our EAs.
As far as I am concerned it is you guys who are effectively using a variable stop when the spread is variable, and it is interesting that you see it the other way around :-)
But since you guys are evidently profitable doing it that way, it must be ok!
But since you guys are evidently profitable doing it that way, it must be ok!
- 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 there!
This is probably easy for you, but I don't see my mistake. So I would be glad if you could give me some relief! :)
In short:
I open a position:
i want to close this position:
what I get:
Thank you!! :)