double Stoploss = 50;
double Takeprofit = 50;
int ticket = OrderSend(Symbol(),OP_BUY,1.0,Ask,3,0,0,'Order #1',1234,0,Red);
if(ticket == -1) Print('error-',GetLastError());
You are probably dealing with a market execution broker(I don't use IBFX, so I am not sure). That means that you can only enter a stoploss & takeprofit AFTER they return a trade to you. This is simply because you do not know what price you will recieve from them......with market execution your slippage is unlimited.....you takes what you get.
As an en exercise try replacing your ordersend with this 'priceless' order........
int ticket = OrderSend(Symbol(),OP_BUY,1.0,0,0,0,0,'Order #1',1234,0,Red);
It still comes back with a price, meaning that asking price & slippage are ignored. The reason for this is simple, it is not used by the broker at all.....as I said, you take what you get. The reason it still exists is because metaquotes could not remove it from the code without causing massive incompatibilities with our instant execution bokers.
That said, I always still use the correct bid and ask prices for backwards compatibility with the instant execution brokers.
As far as normalising prices go, people tend to go overboard with this......stops do not need to be need to be normalised but I do it anyway as a good practice. When you have a problem caused by unnormalised doubles and price, you will get an error 129 which is invalid price rather than error 130 which is an incorrectly calculated stop. I don't think I have seen an error 129 since I gave up the instant execution brokers.
In terms of your 5 digit broker, you should use Point*10 since the code does not care about the 5 digits.....it simply has recalculated your stops as 5 pips instead of 50 pips. It is good practice to define your pips sizes in the init() function of your EA, so you would have variable 'Pip' declared at the start(global scope) of the EA and then assign it a value in your init() function like this :-
Pip = Point * 10;
Then when you want to turn your 'human pip' stops into 'computer pips' you simply say :-
double Stoploss = 50;
Stoploss = Stoploss * Pip;
Anyway, hope it helps.
Wealth Creation Through Technology