This forum is in read-only mode now. You may discuss your questions on forums of MQL4.community and MQL5.community

TrailingStop vs Ordermodify ( Problem with live acc )


Back to topics list
avatar
100
mpfx 2006.12.18 23:13 
Greeting MT,

I run a trailing stop on my EA using the code

for(cnt=0;cnt<total;cnt++)
     {
      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
      if(OrderType()<=OP_SELL &&   // check for opened position 
         OrderSymbol()==Symbol())  // check for symbol
        {
         if(OrderType()==OP_BUY)   // long position is opened
         if(TrailingStop>0)  
              
                 {
                  if(OrderStopLoss()<Bid-Point*TrailingStop)
                    {
                     OrderModify(OrderTicket(),OrderOpenPrice(),Bid-TrailingStop*Point,
                                 OrderTakeProfit(),0,Green);
                     return(0);
                    }}}}
                  



Now this works fine but I receieved an alert from my broker telling me that there were too many order modify request and could I shut my ea down......
He told me that I was NOT using a trailing stop but an ordermodify order.
The order was going via the trading desk every pip.

I then used the manual trailing stop which highlights the stoploss yellow and he has no problem with this.

How can I code, or can you create a function, that activates this traingstop instead of using ordermodify.

The other option I have is to close my live acc with them and find a broker who uses auto pilot instead of the dealing desk.

Thanks and have a great xmas............




avatar
64
Alexandr 2006.12.19 12:46 
Greeting MT,

I run a trailing stop on my EA using the code

Now this works fine but I receieved an alert from my broker telling me that there were too many order modify request and could I shut my ea down......
He told me that I was NOT using a trailing stop but an ordermodify order.
The order was going via the trading desk every pip.

I then used the manual trailing stop which highlights the stoploss yellow and he has no problem with this.

How can I code, or can you create a function, that activates this traingstop instead of using ordermodify.

The other option I have is to close my live acc with them and find a broker who uses auto pilot instead of the dealing desk.

Thanks and have a great xmas............



The standard trailing stop modifies only one position per tick, but your EA will modify ALL positions for a symbol per tick. So if you have 10 position you EA will make 10 modification but standard trailing stop will always make only one.
avatar
100
mpfx 2006.12.19 21:38 
Hi Alexandr,

The problem is not the code but the type of order it sends.

The ordermodify order goes via their dealing desk and has to be changed manually each pip, but by using the manal trailing stop the orders go straight to the server.

I need to activate this manual stop via code.
Instead of using ordermodify there needs to be a OrderTrailingStop function or something simular.

Thanks




Back to topics list  
Download MetaTrader 5 (450 Kb, web installer) — a new terminal for financial markets