MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal

Source code library - Expert Advisors, Indicators and Scripts

MQL5 Programming Articles Will Help You Develop Trading Robots
To post a new code, please log in or register

Interesting script?
So post a link to it -
let others appraise it

You liked the script? Try it in the MetaTrader 5 terminal

2010.05.17 08:14
Script opening orders

Script opening orders - script for MetaTrader 4

| English Spanish Portuguese Russian

votes: 2

Sometimes you want to help the advisor and add the order, but that Advisor has its own Magic number needed to be placed orders with its number.

  • stoploss - level exhibiting SL, if 0, then SL is not exposed
  • takeprofit - level exhibiting TP, if 0, then TP is not exposed
  • Magic - a unique order number
  • SELL - open SELL order
  • BUY - open BUY order
  • Lot - Order Quantity
  • slippage - the maximum deviation of the price for market orders

The simultaneous installation of different directions of orders for this variable SELL BUY and set to true.

When failures of connection or a sharp price movement will be exhibiting 10 attempts to place an order, after that the script stops.

To run the script, drop it on the chart window and the menu will appear, select the options and type of the opened orders.

Translated from Russian by MetaQuotes Software Corp.
Original code:

Last comments | Go to discussion (6)
MQL4 Comments
mql4_comments | 26 May 2010 at 10:46


Your script is good. I have been trying to write a script like this but it doesn't work.

Maybe you can help!!

When I open order, I will open 1, 2, 3 or 4 orders.

1 Order: Ord1, Lot=1, SL=70, TP=25

2 Orders: Ord1, Lot =0.5, SL=70, TP=25; Ord2, Lot =0.5, SL=70, TP=50

3 Orders: Ord1, Lot =0.3, SL=70, TP=25; Ord2, Lot =0.3, SL=70, TP=50; Ord3, Lot =0.3, SL=70, TP=75

4 Orders : Ord1, Lot =0.25, SL=70, TP=25; Ord2, Lot =0.25, SL=70, TP=50; Ord3, Lot =0.25, SL=70, TP=75; Ord4, Lot =0.25, SL=70, TP=0

Can the above script be modified to do the above steps. Variables are, Orders, Lot, SL and TP.


MQL4 Comments
mql4_comments | 26 May 2010 at 10:47
Vladimir Khlystov
cmillion | 26 May 2010 at 21:59

Glad to help! Ask!
MQL4 Comments
mql4_comments | 30 Sep 2010 at 20:31

Thank you

I search that for long time.

MQL4 Comments
mql4_comments | 1 May 2011 at 12:43

I was looking for something like this for some time. But sadly every time i'm trying to lunch the script i get error message 4109. I would be very grateful if can help me to solve the problem. Especially i'm interesting in the opening orders in different directions at the same time.

Best regards