Pending Buystop Sell Stop Orders Using Mouse Drop

 

Hi, i am trying to convert my mt4 codes which i created earlier into mt5, but the problem is i am not so good with mt5, i have the final code of mt5 which i tried my best to convert, with two errors for Ordersend (mt4 command), kindly take a look and let me know what possible solutions is possible,

It is a script file which on drag and drop on the chart produces multiple orders of the same price multiple times using the same price of pair (you can choose number of orders for the following pair)
kindly take a look at my mt4 to mt5 conversion of this script file and please kindly help me with 2 errors of Ordersend - wrong parameter count, as i don't know how to fix it.
Also i am getting implicit conversion of string to numbers, i do know it's wrong coding (or conversion of direct mt5) which is not recomended, it is completely wrong, but if someone really knows it, kindly help me clear the warnings too, as i really like program to be neat and properly coded, and i feel bad about my mt5 codings, please help me to improve ahead.
thank you


Error Log


#property copyright "Copyright © 2020"

//--------------------------------------------------------------------
extern int     Stoploss          = 250,     //
               Takeprofit        = 1200;     //
extern double  Lot               = 0.01;   //
extern int     NumberOfOrders    = 5;      //Number of Orders
extern int     Magic             = 0;      //
extern bool    comment           = true;   //display information on screen
//--------------------------------------------------------------------
int start()
{
   double SL,TP;
   double Price = NormalizeDouble(ChartPriceOnDropped(),_Digits);
   string txt=StringFormat("Stop the script issuing a warrant ",DoubleToString(Price,_Digits)," ñòàðò ",TimeToString(TimeCurrent(),TIME_DATE|TIME_SECONDS));
   
  
      
   if(Price>SYMBOL_ASK) 
   {
      if (Takeprofit!=0) TP = NormalizeDouble(Price + Takeprofit * _Point,_Digits); else TP=0;
      if (Stoploss!=0)   SL = NormalizeDouble(Price - Stoploss   * _Point,_Digits); else SL=0;
       for(int x=0;x<NumberOfOrders;x++)
      if (OrderSend(Symbol(),ORDER_TYPE_BUY_STOP,Lot,Price,0,SL,TP,"StopOrders",Magic,0,CLR_NONE)!=-1)
           txt = StringConcatenate(txt,"\nSet BUYSTOP ",DoubleToString(Price,_Digits));
      else txt = StringConcatenate(txt,"\nError ",GetLastError()," BUYSTOP ");
   }
   
   
   if(Price<SYMBOL_BID) 
   {
      if (Takeprofit!=0) TP = NormalizeDouble(Price - Takeprofit * _Point,_Digits); else TP=0;
      if (Stoploss!=0)   SL = NormalizeDouble(Price + Stoploss   * _Point,_Digits); else SL=0;
       for(int y=0;y<NumberOfOrders;y++)
      if (OrderSend(Symbol(),ORDER_TYPE_SELL_STOP,Lot,Price,0,SL,TP,"StopOrders",Magic,0,CLR_NONE)==-1)
           txt = StringConcatenate(txt,"\nSet SELLSTOP ",DoubleToString(Price,_Digits));
      else txt = StringConcatenate(txt,"\nError ",GetLastError()," SELLSTOP ");
   }
   if (comment) Comment(txt,"\nThe script has finished its work ",TimeToString(TimeCurrent(),TIME_DATE|TIME_SECONDS));
   return(0);
}
//--------------------------------------------------------------------


//--------------------------------------------------------------------

 

You cannot use OrderSend() in the same way as you for for MQL4.

https://www.mql5.com/en/docs/trading/ordersend

Documentation on MQL5: Trade Functions / OrderSend
Documentation on MQL5: Trade Functions / OrderSend
  • www.mql5.com
[in,out]  Pointer to a structure of MqlTradeResult type describing the result of trade operation in case of a successful completion (if true is returned). parameter are filled out correctly. If there are no errors, the server accepts the order for further processing. If the order is successfully accepted by the trade server, the OrderSend...
 
Yui kmitokawa: PENDING BUYSTOP SELL STOP ORDERS USING MOUSE DROP
Don't SHOUT at us; that is very RUDE.
 
William Roeder:
Don't SHOUT at us; that is very RUDE.
Keith Watford:

You cannot use OrderSend() in the same way as you for for MQL4.

https://www.mql5.com/en/docs/trading/ordersend

thank you keith 
 
Keith Watford:

You cannot use OrderSend() in the same way as you for for MQL4.

https://www.mql5.com/en/docs/trading/ordersend

i tried with many attempts keith, unable to do it, kindly help.
 
Yui kmitokawa:
i tried with many attempts keith, unable to do it, kindly help.

It is not easy when you are first trying it.

Study the documentation carefully and post your attempts at coding.

 
Keith Watford:

It is not easy when you are first trying it.

Study the documentation carefully and post your attempts at coding.

yes, i will try my best and will not give up, i am learning from Andrew Young Book for MT5
Reason: