Orderselect

 

Hello guys,

I wanted to know what I am doing wrong, I do not get the ticket number, all I get is 0;

int ticket = OrderSend(symbol, OP_BUY, 0.5, Ask, 0, Ask -0.020, Ask +0.100, "BUY ORDER", 0, 0, Green);
     
      Print("TICKET NUMBER: ", ticket);
 
NoCool14: Hello guys, I wanted to know what I am doing wrong, I do not get the ticket number, all I get is 0;

Do some Debugging.

Follow the Documentation.

 
NoCool14: I do not get the ticket number, all I get is 0;
  1. What are Function return values ? How do I use them ? - MQL4 forum
  2. You are NOT getting zero. You are either getting -1 or you are forgetting the value.
 
WHRoeder:
  1. What are Function return values ? How do I use them ? - MQL4 forum
  2. You are NOT getting zero. You are either getting -1 or you are forgetting the value.

3. or you are not calling OrderSend() at all . . .
 
Thanks guys, I found what the problem was. The SL was not placed correctly as the level was to close and not allowed...So now it works.
 
NoCool14:
Thanks guys, I found what the problem was. The SL was not placed correctly as the level was to close and not allowed...So now it works.

Next time just use ...

((Ask-Bid)/Point)
Should work most of the time.
 
deysmacro:

Next time just use ...

Should work most of the time.

Don't use that . . . unless you want . . .

(Ask - ( Bid/Point) )

. . . which doesn't make much sense. Precedence


What was meant was . . .

( ( Ask - Bid ) / Point)

. . . but I'm not sure how this helps.

 
( ( Ask - Bid ) / Point)

Yeah, that one. I was in a bit hurry when I wrote it. LOL ...

Its a quick & dirty way to get the market orders gap though.

There is a fancier way, but we let people look (search) into it.

Reason: