-
You buy at the Ask and sell at the Bid.
- Your buy order's TP/SL are triggered when the Bid reaches it. Not the Ask.
-
Your sell order's TP/SL will be triggered when the Ask reaches it. To trigger at
a specific Bid price, add the average spread.
MODE_SPREAD (Paul) - MQL4 and MetaTrader 4 - MQL4 programming forum - Page 3 - 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.)
- see also
Chart Price Max/Min - MQL4 and MetaTrader 4 - MQL4 programming forum - It doesn't modify itself, you have (broken) code running on some chart.
- When you post code please use the SRC button! Please edit your post.
General rules and best pratices of the Forum. - General - MQL5 programming forum

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Testing an EA in Strategy Tester. I am setting up pending BUYSTOP or SELLSTOP orders. When the order price for the BUYSTOP is reached the order is executed as expected (see code snippet)
price=(H+(1*EApips));
lotsize=0.1;
Initbsl=(price-(InitSL*EApips));
btp=(price+(InitTP*EApips));
expiry=TimeCurrent()+(OrderExpireTime*3600);
//
//Enter Initial Trade
InitTicket=OrderSend(Symbol(),OP_BUYSTOP,lotsize,price,3,Initbsl,btp,NULL,MagicNumber,expiry,clrGreen);
Teh code below is almost identical to the BUYSTOP code... When the order price for a SELLSTOP order is reached the order is executed BUT it is also being immediately modified to remove the SL and TP levels specified when the pending order was placed.
price=(L-(1*EApips));
lotsize=0.1;
Initssl=(price+(InitSL*EApips));
stp=(price-(InitTP*EApips));
expiry=TimeCurrent()+(OrderExpireTime*3600);
//
//Enter Initial Trade
InitTicket=OrderSend(Symbol(),OP_SELLSTOP,lotsize,price,3,Initssl,stp,NULL,MagicNumber,expiry,clrRed);
I do not have any OrderModify() in my code... Here are the results...
Any ideas on what is going on here?