Experts: Droneox Equity Guardian

To add comments, please log in or register
Automated-Trading
147051
Automated-Trading  

Droneox Equity Guardian:

Expert Advisor that will close all orders and disable another Expert Advisor / AutoTrading at desired level.

Author: Yogie Pratama

meshulro
22
meshulro  
Automated-Trading:

Droneox Equity Guardian:

Author: Yogie Pratama

Change

//close all open trade
int CloseAllTrade() 
  {
   int total=OrdersTotal();
   int t;
   int cnt=0;
   for(cnt=0; cnt<=total; cnt++)
     {
      bool s=OrderSelect(0,SELECT_BY_POS,MODE_TRADES);
      if(OrderType()==OP_BUY)
         t=OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),5,Violet);
      if(OrderType()==OP_SELL)
         t=OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),5,Violet);
      if(OrderType()>OP_SELL//pending orders
         t=OrderDelete(OrderTicket());
     }
   return(0);
  }

 to

   for(cnt=total-1; cnt>=0; cnt--)

Yogie Pratama
921
Yogie Pratama  

Hello roy,

I think its the same approach,

for(cnt=0; cnt<=total; cnt++), it's select index from 0 - last index. ex: 0,1,2,3,4, until last index

for(cnt=total-1; cnt>=0; cnt--), it's select last index - 0. ex: last index, last index-1, last index-2, until 0

Carl Schreiber
Moderator
7831
Carl Schreiber  
Yogie Pratama:

Hello roy,

I think its the same approach,

for(cnt=0; cnt<=total; cnt++), it's select index from 0 - last index. ex: 0,1,2,3,4, until last index

for(cnt=total-1; cnt>=0; cnt--), it's select last index - 0. ex: last index, last index-1, last index-2, until 0

No it is not!!

If you close order with cnt=0 the order with cnt=1 becomes the order with cnt=0.

Therefore you HAVE to count down!!

In addition to that may be a RefreshRates() might be helpful especially if there are a bit exotic Symbols() that do not have so many ticks!!

Dan Andersson
151
Dan Andersson  

Carl, you would have been correct if Yogie would have used the index "cnt" in the OrderSelect statement, like this:

bool s=OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES); 

 but now he wrote

bool s=OrderSelect(0,SELECT_BY_POS,MODE_TRADES); 

So the order with index zero is selected every time for closing, so that also works just fine. After first Closing, order with index 1 becomes index 0 and is thus deleted next iteration.

in addition, if your broker has a FIFO rule, then the order with index 0 is the oldest, and must be closed before any other, and in that case it would not work to do it your way and count backwards. 

Juvenille Emperor Limited
Moderator
11374
Eleni Anna Branou  

How can I use this EA with VPS hosting?

It is removed when I am trying to synchronise MT4 environment with VPS. 

tom922
62
tom922  
input: close all order close also pending order?can you add the input Allsymbols     true/false?
bosslife
89
bosslife  

thanks a lot for this EA!! exactly what i need. gave it 5 stars.

would be even better if i could enable push alerts, for example alert 1 2 and 3 with specific amounts.

BluTrading
9
BluTrading  

thanks before anything for your contribution. I just would like to know why I can't make it work with an EA. I would love some step by step instructions on how to make it work. Since I'm missing something. I've made it work on my platform while testing but later, doing the same, in my real account, I couldn't make it work. The result 0 kept coming like it the Auto Trading or the DLL weren't allowed (when they were).

Thanks 

BluTrading
9
BluTrading  
Automated-Trading:

Droneox Equity Guardian:

Author: Yogie Pratama

Eleni Anna Branou:

How can I use this EA with VPS hosting?

It is removed when I am trying to synchronise MT4 environment with VPS.

Hi there, I have the same problem, did you get to fix it?  thanks


To add comments, please log in or register