| New signals service! | |
|
|||||||
| Register in Forex TSD! | |
|
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information |
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Need Help!
i need a code that would close only the buy position or the close position?
i have multiple trades on this.. if (OrderType()==OP_BUY)){ OrderClose ( OrderTicket (), OrderLots (), Ask, 3, Yellow); } i use ticket before but it won't close? when i change the OrderTicker() to ticket but won't close anything.. what do i need to do or add a code? |
|
|||
|
Looks like you are not selecting the order from the server. you need something like this will find all buy orders and close them
total = OrdersTotal(); for(cnt=0;cnt<total;cnt++) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); if(OrderType()== OP_BUY) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet) ; // close position } } |
|
|||
|
if ihave sell is the code correct
total = OrdersTotal(); for(cnt=0;cnt<total;cnt++) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); if(OrderType()== OP_BUY) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet) ; // close position } OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); if(OrderType()== OP_SELL) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet) ; // close position } } } i have tried this but it will only close a one trade.. how will it close all buy trade or sell trade? Last edited by antone; 04-08-2007 at 01:38 PM. |
|
|||
|
Need more help?
i also tried this to modify the orders SL and Tp.. but the problem is when it modify the SL all the buy order or sell order have the same SL and some don't produce any cause it is to close..
i want it to have different calculation in SL for each order.. can someone help me? another thing? what is the code to limit the order for buy and limit order for sell? Last edited by antone; 04-09-2007 at 10:13 AM. |
|
|||
|
Try to look at this thread http://www.forex-tsd.com/general-dis...ing-forum.html
May be it will help. |
|
|||
|
i still can't find it.. if anyone can help me?
limit the order of sell or buy? LIKE only open 1 sell and 1 buy , total of 2 trades pair currency.. please help me? also close all trades if the profit is reach a certain amount? and also close all trade if the profit is a lose at a certain amount.. |
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|