1.sel price uses bid price not ask
2. it should be something like this ....Bid-10*Point....
HI,
MT4 EA...
I have created an EA that opens market orders, but I now want to open a Pending order + the market order.
here is my version, but i get error, not sure what is wrong.
The first line is fine and places the Market order.
No Pending order opens
300= 300seconds expiration
ticket = OrderSend(Symbol(), OP_BUY, NormalizeLots(_lots, Symbol()), Ask, 3, SL, TP, EA_Comment, MagicNumber, 0); //Market order ticket = OrderSend(Symbol(), OP_SELLSTOP, NormalizeLots(_lots, Symbol()),Ask-10*Point() ,3, SL, TP, EA_Comment, MagicNumber,300); //pending order
- Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid / OrderClosePrice reaches it. Using the 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 at 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 spread widen considerably at end of day (5 PM ET) ± 30 minutes. My GBPJPY (OANDA) shows average spread = 26 points, but average maximum spread = 134.
You buy at the Ask and sell at the Bid.
- Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid / OrderClosePrice reaches it. Using the 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 at 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 spread widen considerably at end of day (5 PM ET) ± 30 minutes. My GBPJPY (OANDA) shows average spread = 26 points, but average maximum spread = 134.
THanks
So would this be correct.
ticket = OrderSend(Symbol(), OP_BUY, NormalizeLots(_lots, Symbol()), Ask, 3, SL, TP, EA_Comment, MagicNumber, 0); //Market order ticket= OrderSend(Symbol(),OP_SELLSTOP,NormalizeLots(_lots,Symbol()),Bid-10,3,SL,TP,EA_Comment,MagicNumber,300); // Open Pending SellStop AND ticket = OrderSend(Symbol(), OP_SELL, NormalizeLots(_lots, Symbol()), Bid, 3, SL, TP, EA_Comment, MagicNumber, 0);// Open Market order ticket= OrderSend(Symbol(),OP_BUYSTOP,NormalizeLots(_lots,Symbol()),Ask+10,3,SL,TP,EA_Comment,MagicNumber,300); // Open Pending BuyStop
I also added (300) at the end, which is suppose to expire the Pending order for 5min / 300 sec.
Is that correct?
THanks
So would this be correct.
I also added (300) at the end, which is suppose to expire the Pending order for 5min / 300 sec.
Is that correct?
No , not
No , not
Can you help with the correct syntax?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
HI,
MT4 EA...
I have created an EA that opens market orders, but I now want to open a Pending order + the market order.
here is my version, but i get error, not sure what is wrong.
The first line is fine and places the Market order.
No Pending order opens
300= 300seconds expiration