OrderSend(_Symbol,OP_BUY,0.001,Bid,0,0,Bid+0.09); OrderSend(_Symbol,OP_BUYSTOP,0.001,Bid+1.60,0,0,Bid+0.09);
-
Check your return codes, and report your errors (including market prices and your variables). Don't look at GLE/LE unless you have an error. Don't just silence the compiler (MT5/MT4+strict), it is trying to help you.
What are Function return values ? How do I use them ? - MQL4 programming forum 2012.05.20
Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles 25 March 2014 -
You buy at the Ask and sell at the Bid. Pending Buy Stop orders become market orders when hit and open at the Ask.
-
Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid / OrderClosePrice reaches it. Using Ask±n, makes your SL shorter and your TP longer, by the spread. Don't you want the specified amount used in either direction?
-
Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask / OrderClosePrice reaches it. To trigger close to a specific Bid price, add the average spread.
MODE_SPREAD (Paul) - MQL4 programming forum - Page 3 #25 -
The charts show Bid prices only. Turn on the Ask line to see how big the spread is (Tools → Options (control+O) → charts → Show ask line.)
Most brokers with variable spreads widen considerably at end of day (5 PM ET) ± 30 minutes. My GBPJPY (OANDA) shows average spread = 26 points, but average maximum spread = 134 (your broker will be similar).
-
-
You can't move stops (or pending prices) closer to the market than the minimum: MODE_STOPLEVEL * _Point or SymbolInfoInteger(SYMBOL_TRADE_STOPS_LEVEL).
Requirements and Limitations in Making Trades - Appendixes - MQL4 TutorialOn some ECN type brokers the value might be zero (the broker doesn't know). Use a minimum of two (2) PIPs.
The checks a trading robot must pass before publication in the Market - MQL5 Articles 1 August 2016
- What is your broker's minimum lot size?
Can anyone help me
bool OrderSendResult; OrderSendResult=OrderSend(_Symbol,OP_BUY,0.01,Ask,3,0,Bid+900*Point,"Buy Market Order",123,0,clrAliceBlue); OrderSendResult=OrderSend(_Symbol,OP_BUYSTOP,0.01,Bid+160*Point,3,0,Bid+900*Point,"Buy Stop Order",123,0,clrAliceBlue); ExpertRemove();
Mehmet Bastem:
bool OrderSendResult; OrderSendResult=OrderSend(_Symbol,OP_BUY,0.01,Ask,3,0,Bid+900*Point,"Buy Market Order",123,0,clrAliceBlue); OrderSendResult=OrderSend(_Symbol,OP_BUYSTOP,0.01,Bid+160*Point,3,0,Bid+900*Point,"Buy Stop Order",123,0,clrAliceBlue);
Ideally any Buy orders' prices should be related to Ask, not Bid (see William's reply above yours).
OrderSend() returns, the ticket number, an int, not a bool. Please check the documentation.
If the compiler issues a warning don't ignore it, fix it.
OrderSend(); may give you the error that the return value of OrderSend should be checked. The minimum that should be done is to print the error if it fails.
You have already been told this.
![MQL4 Simple Open Order Script MQL4 Simple Open Order Script](https://c.mql5.com/36/48/mql4-simple-open-order-script.jpg)
- 2021.05.17
- www.mql5.com
Can anyone help me
void OnStart() { while (1==1) { OrderSend(_Symbol,OP_BUY,0.001,Bid,0,0,Bid+0.09); OrderSend(_Symbol,OP_BUYSTOP,0.001,Bid+1.60,0,0,Bid+0.09); Sleep(10000); } }
Your code will get stuck in a permanent loop.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Can anyone help me