a problem about function -- "ordersend()"

Fa Cao
1141
Fa Cao  

Now the symbol-" USDJPY " price is as below:

bid: 95.82 

ask: 95.84

I execute the below codes in my EA:

1. OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0,0,0,0,Red);                succeed

2. Ordersend(Symbol(),OP_BUY,Lots,Close[0],3,0,0,0,0,0,Red);              fail

3. OrderSend(Symbol(),OP_BUY,Lots,Ask+2*Point,3,0,0,0,0,0,Red);        fail

my questions are below: 

1. I don;t know why "1" can succed but "3" failed? and how / what shall I modify to make "2" succeed, the slippage can work a little?

2. Close[0] is always equal to bid, why?

3.  bid / ask spread sometime is 2 points, sometime is 1 point / 3 points, why? 

Ubzen
5300
Ubzen  
Fa Cao
1141
Fa Cao  
in the fact, I just want to know what price I should set when I don't know "cmd" is OP_BUY or OP_SELL.
Ubzen
5300
Ubzen  
vx0532:
in the fact, I just want to know what price I should set when I don't know "cmd" is OP_BUY or OP_SELL.
You're the trader, you should know if you want to buy or sell. Buy@Ask. Sell@Bid.
Ubzen
5300
Ubzen  

2. Close[0] is always equal to bid, why? Thats false. This is why I give you the first Link.

3. OrderSend(Symbol(),OP_BUY,Lots,Ask+2*Point,3,0,0,0,0,0,Red);  

Op_Buy is looking for "ask: 95.84"____Not 95.84+2*Point.____Not  95.8400000001. <-- This is what Close[0] could look like in double precision. Sigh.

Fa Cao
1141
Fa Cao  
ubzen:
You're the trader, you should know if you want to buy or sell. Buy@Ask. Sell@Bid.

thanks. in the fact my purpose is that regarding to "OrderSend(Symbol(),tradetype,Lots,XXX,3,0,0,0,0,0,Red); ", whether there is an good price XXX which can make me just change tradetype to send order without considering OP_BUY or OP_SELL.

If there is not, that is Ok, I know. 

Ubzen
5300
Ubzen  
vx0532:

thanks. in the fact my purpose is that regarding to "OrderSend(Symbol(),tradetype,Lots,XXX,3,0,0,0,0,0,Red); ", whether there is an good price XXX which can make me just change tradetype to send order without considering OP_BUY or OP_SELL.

If there is not, that is Ok, I know. 

You have to always tell it the Order_Type and the Price.
Fa Cao
1141
Fa Cao  
ubzen:

2. Close[0] is always equal to bid, why? Thats false. This is why I give you the first Link.

3. OrderSend(Symbol(),OP_BUY,Lots,Ask+2*Point,3,0,0,0,0,0,Red);  

Op_Buy is looking for "ask: 95.84"____Not 95.84+2*Point.____Not  95.8400000001. <-- This is what Close[0] would look like in double precision. Sigh.

3. if OP_Buy is just looking for "ask", i think the "price" in function "ordersend()" can be deleted when "cmd" is OP_buy or OP_sell.

in addition, what is the "slippage" 's meaning and when and how it work?

thanks a lot? 

Ubzen
5300
Ubzen  
vx0532:

3. if OP_Buy is just looking for "ask", i think the "price" in function "ordersend()" can be deleted when "cmd" is OP_buy or OP_sell.

in addition, what is the "slippage" 's meaning and when and how it work?

thanks a lot? 

1) That could be True. I've never tried it. Try it and see if it compiles.

2) Slippage. slippage is the maximum allowed deviation of the requested order open price from the market price for market orders (points). This parameter is not processed for placing of pending orders.

More. And More. Try finding answers by searching.

Fa Cao
1141
Fa Cao  

 thank you very much and you are so nice

i have other questions for you haha

1. Now I show a script code as below:

 

#property copyright "Copyright 2013, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
#property show_inputs
extern string My_Name;

int start()
  {
  Print("my name is :",My_Name);
   return(0);
  } 

I want to use this script to print "my name is ABC" for the first time , "my name is XYZ" for the second time and other something for the next time; I mean "ABC" and "XYZ" should be assigned to My_Name by me when the script is executing rather than written into the codes in advance. How shall I? I need the very details, thanks.

2.  I mean whether I can create an EA which can execute the above script to print "My_Name" just like that the EA calls other functions, such as ordersend() and so on? I hope I have clear my meaning.

Ubzen
5300
Ubzen  

You have to enter a Different name every time.