• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 12:06am
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 12:06am
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

Closing all trades? 15 replies

Closing multiple positions at the same time 5 replies

Closing Multiple lots with EA 1 reply

closing of trades 4 replies

About closing a position 3 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe

closing

  • Post #1
  • Quote
  • First Post: Apr 11, 2008 6:24am Apr 11, 2008 6:24am
  •  lillelise
  • | Joined Jan 2007 | Status: Member | 1,101 Posts
is it possibel to close a bunch of positions at same time ? (different pairs )
if so how ?

thanks
StopLoss is for none belivers... Trust the Gurus..
  • Post #2
  • Quote
  • Apr 11, 2008 6:49am Apr 11, 2008 6:49am
  •  Akuma99
  • Joined Nov 2005 | Status: Trading, writing, conquering. | 721 Posts
Sure you can ... all orders currently open or pending are stored .. you can access it .. and then close it with something like this:

Inserted Code
for (int i = 0;i < OrdersTotal();i++) {

   // check there are trades available
   if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
   
   // check order type and close accordingly
   if(OrderType() == OP_BUY) {
      OrderClose(OrderTicket(),OrderLots(),Bid,3,White);
   } else if (OrderType() == OP_SELL) {
      OrderClose(OrderTicket(),OrderLots(),Ask,3,White);
   }

}
Best of luck.
You can quit and they won't care, but you will always know.
 
 
  • Post #3
  • Quote
  • Apr 11, 2008 6:58am Apr 11, 2008 6:58am
  •  lillelise
  • | Joined Jan 2007 | Status: Member | 1,101 Posts
thanks
StopLoss is for none belivers... Trust the Gurus..
 
 
  • Post #4
  • Quote
  • Apr 11, 2008 7:00am Apr 11, 2008 7:00am
  •  MrForex123
  • | Joined Nov 2007 | Status: Member | 53 Posts
Hi,

I open buystop and sellstop at the same time.
When one is hit, I want to close the other one and let hit order to continue till TP or SL.

I try using the command like yours, but it close both buystop and sellstop.

Can help me with the command?
 
 
  • Post #5
  • Quote
  • Apr 11, 2008 7:02am Apr 11, 2008 7:02am
  •  MrForex123
  • | Joined Nov 2007 | Status: Member | 53 Posts
Hi Akuma, I see u are still in this tread.

Appreciate if u can help.
 
 
  • Post #6
  • Quote
  • Apr 11, 2008 8:04am Apr 11, 2008 8:04am
  •  Akuma99
  • Joined Nov 2005 | Status: Trading, writing, conquering. | 721 Posts
Ah, just check for a different order type, so if you have opened a sell order, you want to close all BUYLIMIT and BUYSTOP orders ... and of course vise versa.
You can quit and they won't care, but you will always know.
 
 
  • Post #7
  • Quote
  • Last Post: Apr 11, 2008 8:15am Apr 11, 2008 8:15am
  •  syanwar
  • | Joined May 2007 | Status: Motivated by the fear of mediocrity | 149 Posts
you may use it like this:
Inserted Code
for (int i = 0;i < OrdersTotal();i++) {
   // 1st level (opened order) Select
   OrderSelect(i,SELECT_BY_POS);
   string PairSym = OrderSymbol();

   if(OrderType() == OP_BUY) {
      for(int o = 0;o < OrdersTotal();o++) {
         if(OrderSymbol() != PairSym) continue;
      // 2nd level to select the pending opponent
         if(OrderType() == OP_SELLSTOP && OrderSymbol() == PairSym)
            OrderDelete(OrderTicket(),White);   
      }
   }
         
   if (OrderType() == OP_SELL) {
      for(o = 0;o < OrdersTotal();o++) {
         if(OrderSymbol() != PairSym) continue;
      // 2nd level to select the pending opponent
         if(OrderType() == OP_BUYSTOP && OrderSymbol() == PairSym)
            OrderDelete(OrderTicket(),White);   
      }
   }
}
Keep your hands up, and use your pant! - FxMatics
 
 
  • Platform Tech
  • /
  • closing
  • Reply to Thread
0 traders viewing now
Top of Page
Forex Factory Blog Updated: Alerting All Members
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2022