Download MetaTrader 5

Problem with pending order

To add comments, please log in or register
Mahmood
75
Mahmood  

I use this code to open a pending order at 100 pips under current price, but it opens a market order at the current price please guide me

double point = MarketInfo("EURUSD",MODE_POINT);

OrderSend("EURUSD",0,.01,MarketInfo("EURUSD",MODE_ASK)-100*point,3,0,0,"",0,0,Green);

Keith Watford
Moderator
10568
Keith Watford  
OrderSend("EURUSD",OP_BUYLIMIT,.01,MarketInfo("EURUSD",MODE_ASK)-100*point,3,0,0,"",0,0,Green);
point needs to be calculated for the relevant pair
Mahmood
75
Mahmood  
Thanks man
whroeder1
15592
whroeder1  
GumRai: point needs to be calculated for the relevant pair
Point is a predefined variable. This is why I say:
Do not trade multiple currencies
  • You can't use any predefined variables, can't use the tester, must poll (not OnTick,) and usually other problems.
  • Code it to trade the chart pair only. Look at the others if you must.
  • Then put it on other charts to trade the other pairs. Done.
To add comments, please log in or register