Download MetaTrader 5

Orderselect

To add comments, please log in or register
NoCool14
239
NoCool14  

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);
Ubzen
5394
Ubzen  
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.

whroeder1
14780
whroeder1  
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.
Simon Gniadkowski
Moderator
18003
Simon Gniadkowski  
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 . . .
NoCool14
239
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.
SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI  
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.
Simon Gniadkowski
Moderator
18003
Simon Gniadkowski  
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.

SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI  
( ( 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.

To add comments, please log in or register