Troubled by the error there are no trading operations - page 19

 

Here I am, buying 1 quid with my money - and waiting for it to go up.

I like it, I bought 1 quid on loan, waiting for it to fall.

I get the impression that not everyone understands this.

 
I'll answer on the subject: no trading. Well, no, not at all.
 
Алексей Тарабанов:
To answer the subject: there are no trades. Well, no, not at all.

there's a delta between buying and selling

it moves the price, it is essentially the market price, let it become an open interest

the rest we will call the underlying asset, it is in the stock and it is out of the market and formed by the clearing procedure

 
Алексей Тарабанов:

It's encouraging.

You are so clever until you face the problem yourself...

 

This code will be rejected by the validator

   if(aTicket > 0)
      if(OrderSelect(aTicket, SELECT_BY_TICKET, MODE_TRADES))
         if(!OrderClose(aTicket, NormalizeDouble(OrderLots(), 2), NormalizeDouble(OrderType() == 0 ? Bid : Ask, Digits()), 30))
            return (false);

Validator says 131 error, wrong volume...

 

Good afternoon, forum users. Please advise, I am struggling with validation for mt5 for the second week. It gives me an error

test on EURUSD,H1 (hedging) 2019.04.16 22:00:00 failed cancel order #73 sell stop 0.6 EURUSD at 1.12685 sl: 1.12851 tp: 1.11503 [Invalid stops]

2019.05.02 12:00:00 failed cancel order #136 sell stop 0.55 EURUSD at 1.11636 sl: 1.11814 tp: 1.10367 [Invalid stops]

2019.05.06 03:00:00 failed cancel order #147 sell stop 0.45 EURUSD at 1.11359 sl: 1.11578 tp: 1.09797 [Invalid stops]

2019.05.06 08:00:00 failed cancel order #148 sell stop 0.5 EURUSD at 1.11447 sl: 1.11645 tp: 1.10036 [Invalid stops]

2019.05.06 18:00:00 failed cancel order #151 sell stop 0.5 EURUSD at 1.11585 sl: 1.11783 tp: 1.10175 [Invalid stops]

2019.05.08 14:00:00 failed cancel order #167 sell stop 0.6 EURUSD at 1.11772 sl: 1.11938 tp: 1.10593 [Invalid stops]

2019.05.09 21:00:00 failed cancel order #175 sell stop 0.45 EURUSD at 1.11921 sl: 1.12138 tp: 1.10377 [Invalid stops]

2019.05.13 16:00:00 failed cancel order #181 sell stop 0.6 EURUSD at 1.12225 sl: 1.12390 tp: 1.11054 [Invalid stops] strategy tester report 5 total trades


I did all of the checks. The weird thing is that only on Sell Stop order deletion. I simply remove Sell Stop order placement from the code.

It works. What may be the problem?

bool sqDeletePendingOrder(ulong ticket) {
   Verbose(" Deleting pending order, ticket: " + IntegerToString(ticket));
   
   if(!OrderSelect(ticket)) return false;
   
   double order_price = OrderGetDouble(ORDER_PRICE_OPEN);
   
   ENUM_ORDER_TYPE orderType = (ENUM_ORDER_TYPE) OrderGetInteger(ORDER_TYPE);

   if(orderType == ORDER_TYPE_BUY || orderType == ORDER_TYPE_SELL) {
      Verbose("Trying to delete non-pending order");
      return(false);
   }

  MqlTick tick;

   GetLastError(); // clear the global variable.
   int error = 0;
   int retries = 0;
   bool result;
   
   double stops_level = (double)SymbolInfoInteger(_Symbol, SYMBOL_TRADE_FREEZE_LEVEL);
   double freeze_level = (double)SymbolInfoInteger(_Symbol, SYMBOL_TRADE_STOPS_LEVEL);  
   double level = MathMax(stops_level,freeze_level);
   
   while (true) {  
      
      if (!SymbolInfoTick(_Symbol,tick)) return(false);
 
      double spread = ((tick.ask-tick.bid)/_Point); 
      if (level<=0) level = spread*3;

      bool del = true;
     
      if(orderType == ORDER_TYPE_BUY_LIMIT){ //Ask-Open  OrderGetDouble(ORDER_PRICE_CURRENT)
         if((tick.ask-order_price)/_Point <= level){
            VerboseLog("Cannot delete of order with Ticket#:", IntegerToString(ticket));            
            del = false;
         } 
      }
      else if(orderType == ORDER_TYPE_SELL_LIMIT){ //Open - Bid
         if((order_price-tick.bid)/_Point <= level) {
            VerboseLog("Cannot delete of order with Ticket#:", IntegerToString(ticket));           
            del = false;
         } 
      }
      else if(orderType == ORDER_TYPE_BUY_STOP){ //Open - Ask
         if((order_price-tick.ask)/_Point <= level) {
            VerboseLog("Cannot delete of order with Ticket#:", IntegerToString(ticket));           
            del = false;
         }
      }
      else if(orderType == ORDER_TYPE_SELL_STOP){ //Bid - Open
         //Print("SELLSTOP: ",(tick.bid-order_price)/_Point," ;  ",level);
         if((tick.bid-order_price) <= level*_Point) {        
            VerboseLog("Cannot delete of order with Ticket#:", IntegerToString(ticket));           
            del = false;
         } 
      }
      if (IsTradeAllowed() && del == true) {
         result = OrderDelete(ticket);    // Удаление отложки  Trade.Delete(ticket)                             
         if(result) {
            Verbose("Order deleted successfuly");
            return(true);
         }
      }

      retries++;
      if(!sqProcessErrors(retries, GetLastError())) {
         return(false);
      }
   }
 return(false);
}
 

Problem solved, but I think it's a validator bug. Took the price at tick.bid and the price OrderGetDouble(ORDER_PRICE_CURRENT).

And this error only applies to SellStop orders

 
Alexey Osipov:

Problem solved, but I think it's a validator bug. Took the price at tick.bid and the price OrderGetDouble(ORDER_PRICE_CURRENT).

And this error only applies to SellStop orders

I haven't worked with stop levels for a long time but I remember always adding 1 pip just because of Invalid stops. Try increasing the stop levels by one point.
 

New difficulty:


When publishing the Utility, the tester gives out

test on EURUSD,H1
strategy tester report not found

The utility does not have any trading functions.


How to pass such a validation?

 
Sergey Likho:

New difficulty:

When publishing the Utility, the tester outputs

The utility does not have any trading functions.

How to pass such validation?

This is a validator bug, wait for it to be fixed...