ORDER_TYPE_SELL attempts a buy?!

 
if (trade) PrintFormat("RSI: "+RSICur+",CCI: " + CCICur+", "+trade+", bid: "+bidCur+", Order:"+ordertype);

   
   
   if (trade)
      //if (!Buy_opened)
   {
   MqlTradeRequest request={0};
   MqlTradeResult  result={0};
   
   request.tp=tp;
   request.sl=sl;
   request.action   =TRADE_ACTION_DEAL;                     // type of trade operation
   request.symbol   =Symbol();                              // symbol
   request.volume   =size;                                  // volume of 0.1 lot
   request.type     =ordertype;                     // order type
   request.price    =price;                                 // price for opening
   request.deviation=5;                                     // allowed deviation from the price
   OrderSend(request,result);
   PrintFormat("retcode=%u  deal=%I64u  order=%I64u",result.retcode,result.deal,result.order);
   }
   

That's the relevant portion of the code. When I backtest it, it says "failed instant buy" (Image attached) . Maybe I'm configuring the order wrong?

Files:
FailedBuy.png  11 kb
 

Forum on trading, automated trading systems and testing trading strategies

When you post code please use the CODE button (Alt-S)!

Use the CODE button

 
 
Sergey Golubev:

No image icon :(


Files:
Imageless.png  3 kb
 
NarubiaN:

No image icon :(


I made a post on rus part of the forum related to this issue - #7 (on the thread where one person complained about the folowing: he could not register on the forum), and I got the following reply (from MK - machine translation to the english) - 

Forum on trading, automated trading systems and testing trading strategies

unable to register

MetaQuotes Software Corp. , 2019.02.05 16:16

The second page of discussions, but there is no email, no registration name, no IP.

Please give more details.

You can post on their thread in English, or you can post here (if you care about this icon for example) ... as to me so - I do not care much about this icon ...
:)

-----------

for information.