Help!! Position Reverse problemBack to topics list |
|
MrReza
2009.01.07 19:18
Hello, I have a very simple yet complex situation. I simply want to reverse buy to sell or sell to buy. I tried looking in the forum in the link below and got to the following lines of code on the last posting http://www.metatrader4.com/forum/780 Will this doit? OrderClose(OrderTicket(),OrderLots(),Bid,2,Violet); // close position I basically tried OrderClose followed by Ticket=Ordersend Tried it within the same and different curly braces. It didnt work in Real live trading but worked just fine in Demo I got an error message when tried to do it in Real Live. I have been losing as my EA kept failing to reverse my position. I tried another method as well. I first close the open position, go to return(0) so tht the EA will start again and be ready to open the opposite position when it restart. This still didnt work. Is there anyone out there who knows how the solution? If you've used the code above and it worked, pls let me know as well. An advice as to help me point out the location of the problem would also be great. |
|
CrispinScruby
2009.03.14 18:36
MrReza :
Hello, I have a very simple yet complex situation. I simply want to reverse buy to sell or sell to buy. I tried looking in the forum in the link below and got to the following lines of code on the last posting http://www.metatrader4.com/forum/780 Will this doit? OrderClose(OrderTicket(),OrderLots(),Bid,2,Violet); // close position I basically tried OrderClose followed by Ticket=Ordersend Tried it within the same and different curly braces. It didnt work in Real live trading but worked just fine in Demo I got an error message when tried to do it in Real Live. I have been losing as my EA kept failing to reverse my position. I tried another method as well. I first close the open position, go to return(0) so tht the EA will start again and be ready to open the opposite position when it restart. This still didnt work. Is there anyone out there who knows how the solution? If you've used the code above and it worked, pls let me know as well. An advice as to help me point out the location of the problem would also be great. You cannot "reverse" orders - you can only close a long/short order and then take an opposing position. This could be automated if required. |
