I try to open order with OrderSend function

Back to topics list To post a new topic, please log in or register
markga 2015.01.09 14:42

I try to open order with OrderSend function. But it makes error code 136


Code that i use 


void OnStart()


//---/--- get minimum stop level

  double minstoplevel=MarketInfo(Symbol(),MODE_STOPLEVEL);

   Print("Minimum Stop Level=",minstoplevel," points");

   double price=Ask;

//--- calculated SL and TP prices must be normalized

   double stoploss=NormalizeDouble(Bid-10*Point,Digits);

   double takeprofit=NormalizeDouble(Bid+10*Point,Digits);

   Print("price ", price);

   Print("stoploss ", stoploss);

   Print("takeprof ", takeprofit);

   Print("Ask ",Ask);

   Print("Bid ", Bid);

//--- place market order to buy 1 lot

   int ticket=OrderSend("USDCHF",OP_BUY,1,price,1000,stoploss,takeprofit,"My order",16384,0,clrGreen);

 Print("ticket ", ticket);



      Print("OrderSend failed with error #",GetLastError());



      Print("OrderSend placed successfully");





Any assistance will be appriciated 

gooly 2015.01.09 15:02 #

1) use the SRC-button to post code (beside the camera!)

2) Do you know what error 136 means. It tells you where to search for a correction! (Look it up in the MQL4 Reference)

markga 2015.01.09 15:53 #
It said off quotes. But how to make work this function. I'm very new. Please assist on this issue
gooly 2015.01.09 17:28 #

Read the book or the Documentation (links at the top!).

Look for the examples of opening orders.

Study the sample EAs in the Expert folder how they set their prices for OrderSend(..)

Search for other examples...

WHRoeder 2015.01.09 18:39 #
You are mixing apples and oranges. Ask/Bid are the current chart pair but you are opening a USDCHF pair. Fails if the current chart is not USDCHF
   double price=Ask;
// int ticket=OrderSend("USDCHF",OP_BUY,1,price, ...
   int ticket=OrderSend(NULL,    OP_BUY,1,price,

Back to topics list  

To add comments, please log in or register