For buy orders tp is always above Ask and for sell tp is below bid. :-)
Try lookin up mq4 documentation/ beginer articles for more...

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
Hi all experts,
This code does work but very erratically. Quite often when the conditions below are met i.e Ask >= buyprice, this block is entered but the ORDERSEND command does not process the order! I have checked it enters by looking at the new values of 'newcandle' which only change when it enters these conditional statements.
Why does the Ordersend command only work sometimes? (n.b 'lots' value is small compared to account equity)
thanks
if(newcandle!= Time[0]) //check for new candle
{
buyprice= high + 1*Point;
sellprice = low - 1*Point;
hightp=Ask + tp * Point;
lowtp=Bid - tp * Point;
highstop=High[1];
lowstop=Low[1];
if(Ask >= buyprice)
{
OrderSend(Symbol(),OP_BUY,lots,Ask,3,lowstop,hightp); //open BUY order
newcandle=Time[0];
}
if(Bid <= sellprice)
{
OrderSend(Symbol(),OP_SELL,lots,Bid,3,highstop,lowtp); //open SELL order
newcandle=Time[0];
}
}