Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 528

 
MEN_Odessa:

I'm not getting any error codes processed in the strategy tester. What's wrong there? Is there a problem with Sleep or are the errors just not being generated?


Sleep is not working in the tester.
 

Help.

As far as I understand, there is no trailing stop on an order in mql 4?

And if not, how can I use a simple method to execute a trailing stop on an open order?

 
culler:

Help.

As far as I understand, there is no Trailing Order function built into mql 4?

And if not, how can I trailing an open order be done in a simple line?


Something like this
 
evillive:

Something like this


Wow... I did not realise there were so many trailing stops. My head's spinning )))) Anything you want )))

I'd like a simple one, like the one built into MT4 on an order from the current price. )))

 
culler:


Wow... I didn't realise there were so many trailing stops. My head is spinning )))) Whatever you want )))

I would like a simple trailing stop, like built in MT4 on order of the current price. )))


) ) The primitive trawl from MACD Sample corresponds to the trawl in the terminal and the server is bombarded with orders on every tick:

extern TrailingStop=100;   
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
        {
         //--- long position is opened
         if(OrderType()==OP_BUY)
           {
            //--- check for trailing stop
            if(TrailingStop>0)
              {
               if(Bid-OrderOpenPrice()>Point*TrailingStop)
                 {
                  if(OrderStopLoss()<Bid-Point*TrailingStop)
                    {
                     //--- modify order and exit
                     OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);
                     return;
                    }
                 }
              }
           }
         else // go to short position
           {
            //--- check for trailing stop
            if(TrailingStop>0)
              {
               if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
                 {
                  if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))
                    {
                     //--- modify order and exit
                     OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red);
                     return;
                    }
                 }
              }
           }
        }
     }
 

When debugging, "USDCHF" window opens by default...

Can you tell me how to make during debugging from MeteEditor to initialize and work in MetaTrader

with determined or already opened window, and not with window "USDCHF" by default?

 
Orangetree:

When debugging, "USDCHF" window opens by default...

Can you tell me how to make during debugging from MeteEditor to initialize and work in MetaTrader

with determined or already opened window, and not with window "USDCHF" by default?

In the terminal settings, search through the tabs. You will find it.
 
artmedia70:
In the terminal settings, search through the tabs. You will find it.


You can change the pair and timeframe, but not the terminal settings ;)
 

Hello, I don't know where to place this question, the gist of it is this: sometimes EA writes a 7 gigabyte log file with one error, it writes (EURUSD,M15: Failed to close leading order, repeat operation), although it closes everything without error. I try to prohibit this EA to record its actions in the log, but it's no use, I need the log of the terminal.

Please advise how to prohibit this "creep" to keep the log? I understand that I have to use the Print option but how?

            if ((OrderSymbol() == Symbol()) && (OrderMagicNumber() == mNumber)) {
               if (OrderType() == OP_BUY) {
                  error1 =  (OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), Spread, Blue));
                  if (error1 == 1) {
                     Print ("Лидирующий ордер закрыт успешно."); 
                     Sleep (500);   
                  } else {
                     Print ("Ошибка закрытия лидирующего ордера, повторяем операцию. ");
 
I hardly scraped together 100$ to start trading and get out of the deepest hole in Forex. I've known about 2 months of trading. I just opened a real account yesterday but I don't know how to install an EA, what is the subscription and how much it costs.
Reason: